bezierTools.c 1.8 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731
  1. /* Generated by Cython 3.2.2 */
  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_2"
  35. #define CYTHON_HEX_VERSION 0x030202F0
  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. #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
  1130. #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
  1131. #define __PYX_DEFAULT_STRING_ENCODING ""
  1132. #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
  1133. #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  1134. #define __Pyx_uchar_cast(c) ((unsigned char)c)
  1135. #define __Pyx_long_cast(x) ((long)x)
  1136. #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
  1137. (sizeof(type) < sizeof(Py_ssize_t)) ||\
  1138. (sizeof(type) > sizeof(Py_ssize_t) &&\
  1139. likely(v < (type)PY_SSIZE_T_MAX ||\
  1140. v == (type)PY_SSIZE_T_MAX) &&\
  1141. (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
  1142. v == (type)PY_SSIZE_T_MIN))) ||\
  1143. (sizeof(type) == sizeof(Py_ssize_t) &&\
  1144. (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
  1145. v == (type)PY_SSIZE_T_MAX))) )
  1146. static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
  1147. return (size_t) i < (size_t) limit;
  1148. }
  1149. #if defined (__cplusplus) && __cplusplus >= 201103L
  1150. #include <cstdlib>
  1151. #define __Pyx_sst_abs(value) std::abs(value)
  1152. #elif SIZEOF_INT >= SIZEOF_SIZE_T
  1153. #define __Pyx_sst_abs(value) abs(value)
  1154. #elif SIZEOF_LONG >= SIZEOF_SIZE_T
  1155. #define __Pyx_sst_abs(value) labs(value)
  1156. #elif defined (_MSC_VER)
  1157. #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
  1158. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  1159. #define __Pyx_sst_abs(value) llabs(value)
  1160. #elif defined (__GNUC__)
  1161. #define __Pyx_sst_abs(value) __builtin_llabs(value)
  1162. #else
  1163. #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
  1164. #endif
  1165. static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s);
  1166. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
  1167. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
  1168. static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*);
  1169. #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
  1170. #define __Pyx_PyBytes_FromString PyBytes_FromString
  1171. #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
  1172. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
  1173. #if CYTHON_ASSUME_SAFE_MACROS
  1174. #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
  1175. #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
  1176. #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
  1177. #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
  1178. #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
  1179. #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
  1180. #define __Pyx_PyByteArray_AsString(s) PyByteArray_AS_STRING(s)
  1181. #else
  1182. #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AsString(s))
  1183. #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AsString(s))
  1184. #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AsString(s))
  1185. #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AsString(s))
  1186. #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AsString(s))
  1187. #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AsString(s))
  1188. #define __Pyx_PyByteArray_AsString(s) PyByteArray_AsString(s)
  1189. #endif
  1190. #define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
  1191. #define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
  1192. #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
  1193. #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
  1194. #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
  1195. #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
  1196. #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
  1197. #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
  1198. #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
  1199. #define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o)
  1200. #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
  1201. static CYTHON_INLINE PyObject *__Pyx_NewRef(PyObject *obj) {
  1202. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_NewRef)
  1203. return Py_NewRef(obj);
  1204. #else
  1205. Py_INCREF(obj);
  1206. return obj;
  1207. #endif
  1208. }
  1209. static CYTHON_INLINE PyObject *__Pyx_XNewRef(PyObject *obj) {
  1210. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030a0000 || defined(Py_XNewRef)
  1211. return Py_XNewRef(obj);
  1212. #else
  1213. Py_XINCREF(obj);
  1214. return obj;
  1215. #endif
  1216. }
  1217. static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b);
  1218. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
  1219. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
  1220. static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
  1221. static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x);
  1222. #define __Pyx_PySequence_Tuple(obj)\
  1223. (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
  1224. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
  1225. static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t);
  1226. static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
  1227. #if CYTHON_ASSUME_SAFE_MACROS
  1228. #define __Pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
  1229. #define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AS_DOUBLE(x)
  1230. #else
  1231. #define __Pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
  1232. #define __Pyx_PyFloat_AS_DOUBLE(x) PyFloat_AsDouble(x)
  1233. #endif
  1234. #define __Pyx_PyFloat_AsFloat(x) ((float) __Pyx_PyFloat_AsDouble(x))
  1235. #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
  1236. #if CYTHON_USE_PYLONG_INTERNALS
  1237. #if PY_VERSION_HEX >= 0x030C00A7
  1238. #ifndef _PyLong_SIGN_MASK
  1239. #define _PyLong_SIGN_MASK 3
  1240. #endif
  1241. #ifndef _PyLong_NON_SIZE_BITS
  1242. #define _PyLong_NON_SIZE_BITS 3
  1243. #endif
  1244. #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
  1245. #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0)
  1246. #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x))
  1247. #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1)
  1248. #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0)
  1249. #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0])
  1250. #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
  1251. #define __Pyx_PyLong_SignedDigitCount(x)\
  1252. ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
  1253. #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
  1254. #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x)
  1255. #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x)
  1256. #else
  1257. #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
  1258. #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
  1259. #endif
  1260. typedef Py_ssize_t __Pyx_compact_pylong;
  1261. typedef size_t __Pyx_compact_upylong;
  1262. #else
  1263. #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0)
  1264. #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0)
  1265. #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0)
  1266. #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0)
  1267. #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
  1268. #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x))
  1269. #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x)
  1270. #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
  1271. #define __Pyx_PyLong_CompactValue(x)\
  1272. ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
  1273. typedef sdigit __Pyx_compact_pylong;
  1274. typedef digit __Pyx_compact_upylong;
  1275. #endif
  1276. #if PY_VERSION_HEX >= 0x030C00A5
  1277. #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit)
  1278. #else
  1279. #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit)
  1280. #endif
  1281. #endif
  1282. #if __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
  1283. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
  1284. #elif __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  1285. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeASCII(c_str, size, NULL)
  1286. #else
  1287. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
  1288. #endif
  1289. /* Test for GCC > 2.95 */
  1290. #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  1291. #define likely(x) __builtin_expect(!!(x), 1)
  1292. #define unlikely(x) __builtin_expect(!!(x), 0)
  1293. #else /* !__GNUC__ or GCC < 2.95 */
  1294. #define likely(x) (x)
  1295. #define unlikely(x) (x)
  1296. #endif /* __GNUC__ */
  1297. /* PretendToInitialize */
  1298. #ifdef __cplusplus
  1299. #if __cplusplus > 201103L
  1300. #include <type_traits>
  1301. #endif
  1302. template <typename T>
  1303. static void __Pyx_pretend_to_initialize(T* ptr) {
  1304. #if __cplusplus > 201103L
  1305. if ((std::is_trivially_default_constructible<T>::value))
  1306. #endif
  1307. *ptr = T();
  1308. (void)ptr;
  1309. }
  1310. #else
  1311. static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
  1312. #endif
  1313. #if !CYTHON_USE_MODULE_STATE
  1314. static PyObject *__pyx_m = NULL;
  1315. #endif
  1316. static int __pyx_lineno;
  1317. static int __pyx_clineno = 0;
  1318. static const char * const __pyx_cfilenm = __FILE__;
  1319. static const char *__pyx_filename;
  1320. /* Header.proto */
  1321. #if !defined(CYTHON_CCOMPLEX)
  1322. #if defined(__cplusplus)
  1323. #define CYTHON_CCOMPLEX 1
  1324. #elif (defined(_Complex_I) && !defined(_MSC_VER)) || ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_COMPLEX__) && !defined(_MSC_VER))
  1325. #define CYTHON_CCOMPLEX 1
  1326. #else
  1327. #define CYTHON_CCOMPLEX 0
  1328. #endif
  1329. #endif
  1330. #if CYTHON_CCOMPLEX
  1331. #ifdef __cplusplus
  1332. #include <complex>
  1333. #else
  1334. #include <complex.h>
  1335. #endif
  1336. #endif
  1337. #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
  1338. #undef _Complex_I
  1339. #define _Complex_I 1.0fj
  1340. #endif
  1341. /* #### Code section: filename_table ### */
  1342. static const char* const __pyx_f[] = {
  1343. "Lib/fontTools/misc/bezierTools.py",
  1344. };
  1345. /* #### Code section: utility_code_proto_before_types ### */
  1346. /* Atomics.proto (used by UnpackUnboundCMethod) */
  1347. #include <pythread.h>
  1348. #ifndef CYTHON_ATOMICS
  1349. #define CYTHON_ATOMICS 1
  1350. #endif
  1351. #define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS
  1352. #define __PYX_GET_CYTHON_COMPILING_IN_CPYTHON_FREETHREADING() CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  1353. #define __pyx_atomic_int_type int
  1354. #define __pyx_nonatomic_int_type int
  1355. #if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
  1356. (__STDC_VERSION__ >= 201112L) &&\
  1357. !defined(__STDC_NO_ATOMICS__))
  1358. #include <stdatomic.h>
  1359. #elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
  1360. (__cplusplus >= 201103L) ||\
  1361. (defined(_MSC_VER) && _MSC_VER >= 1700)))
  1362. #include <atomic>
  1363. #endif
  1364. #if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
  1365. (__STDC_VERSION__ >= 201112L) &&\
  1366. !defined(__STDC_NO_ATOMICS__) &&\
  1367. ATOMIC_INT_LOCK_FREE == 2)
  1368. #undef __pyx_atomic_int_type
  1369. #define __pyx_atomic_int_type atomic_int
  1370. #define __pyx_atomic_ptr_type atomic_uintptr_t
  1371. #define __pyx_nonatomic_ptr_type uintptr_t
  1372. #define __pyx_atomic_incr_relaxed(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed)
  1373. #define __pyx_atomic_incr_acq_rel(value) atomic_fetch_add_explicit(value, 1, memory_order_acq_rel)
  1374. #define __pyx_atomic_decr_acq_rel(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel)
  1375. #define __pyx_atomic_sub(value, arg) atomic_fetch_sub(value, arg)
  1376. #define __pyx_atomic_int_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
  1377. #define __pyx_atomic_load(value) atomic_load(value)
  1378. #define __pyx_atomic_store(value, new_value) atomic_store(value, new_value)
  1379. #define __pyx_atomic_pointer_load_relaxed(value) atomic_load_explicit(value, memory_order_relaxed)
  1380. #define __pyx_atomic_pointer_load_acquire(value) atomic_load_explicit(value, memory_order_acquire)
  1381. #define __pyx_atomic_pointer_exchange(value, new_value) atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
  1382. #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) atomic_compare_exchange_strong(value, expected, desired)
  1383. #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
  1384. #pragma message ("Using standard C atomics")
  1385. #elif defined(__PYX_DEBUG_ATOMICS)
  1386. #warning "Using standard C atomics"
  1387. #endif
  1388. #elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
  1389. (__cplusplus >= 201103L) ||\
  1390. \
  1391. (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\
  1392. ATOMIC_INT_LOCK_FREE == 2)
  1393. #undef __pyx_atomic_int_type
  1394. #define __pyx_atomic_int_type std::atomic_int
  1395. #define __pyx_atomic_ptr_type std::atomic_uintptr_t
  1396. #define __pyx_nonatomic_ptr_type uintptr_t
  1397. #define __pyx_atomic_incr_relaxed(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed)
  1398. #define __pyx_atomic_incr_acq_rel(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_acq_rel)
  1399. #define __pyx_atomic_decr_acq_rel(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel)
  1400. #define __pyx_atomic_sub(value, arg) std::atomic_fetch_sub(value, arg)
  1401. #define __pyx_atomic_int_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
  1402. #define __pyx_atomic_load(value) std::atomic_load(value)
  1403. #define __pyx_atomic_store(value, new_value) std::atomic_store(value, new_value)
  1404. #define __pyx_atomic_pointer_load_relaxed(value) std::atomic_load_explicit(value, std::memory_order_relaxed)
  1405. #define __pyx_atomic_pointer_load_acquire(value) std::atomic_load_explicit(value, std::memory_order_acquire)
  1406. #define __pyx_atomic_pointer_exchange(value, new_value) std::atomic_exchange(value, (__pyx_nonatomic_ptr_type)new_value)
  1407. #define __pyx_atomic_pointer_cmp_exchange(value, expected, desired) std::atomic_compare_exchange_strong(value, expected, desired)
  1408. #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
  1409. #pragma message ("Using standard C++ atomics")
  1410. #elif defined(__PYX_DEBUG_ATOMICS)
  1411. #warning "Using standard C++ atomics"
  1412. #endif
  1413. #elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\
  1414. (__GNUC_MINOR__ > 1 ||\
  1415. (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2))))
  1416. #define __pyx_atomic_ptr_type void*
  1417. #define __pyx_nonatomic_ptr_type void*
  1418. #define __pyx_atomic_incr_relaxed(value) __sync_fetch_and_add(value, 1)
  1419. #define __pyx_atomic_incr_acq_rel(value) __sync_fetch_and_add(value, 1)
  1420. #define __pyx_atomic_decr_acq_rel(value) __sync_fetch_and_sub(value, 1)
  1421. #define __pyx_atomic_sub(value, arg) __sync_fetch_and_sub(value, arg)
  1422. static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
  1423. __pyx_nonatomic_int_type old = __sync_val_compare_and_swap(value, *expected, desired);
  1424. int result = old == *expected;
  1425. *expected = old;
  1426. return result;
  1427. }
  1428. #define __pyx_atomic_load(value) __sync_fetch_and_add(value, 0)
  1429. #define __pyx_atomic_store(value, new_value) __sync_lock_test_and_set(value, new_value)
  1430. #define __pyx_atomic_pointer_load_relaxed(value) __sync_fetch_and_add(value, 0)
  1431. #define __pyx_atomic_pointer_load_acquire(value) __sync_fetch_and_add(value, 0)
  1432. #define __pyx_atomic_pointer_exchange(value, new_value) __sync_lock_test_and_set(value, (__pyx_atomic_ptr_type)new_value)
  1433. static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) {
  1434. __pyx_nonatomic_ptr_type old = __sync_val_compare_and_swap(value, *expected, desired);
  1435. int result = old == *expected;
  1436. *expected = old;
  1437. return result;
  1438. }
  1439. #ifdef __PYX_DEBUG_ATOMICS
  1440. #warning "Using GNU atomics"
  1441. #endif
  1442. #elif CYTHON_ATOMICS && defined(_MSC_VER)
  1443. #include <intrin.h>
  1444. #undef __pyx_atomic_int_type
  1445. #define __pyx_atomic_int_type long
  1446. #define __pyx_atomic_ptr_type void*
  1447. #undef __pyx_nonatomic_int_type
  1448. #define __pyx_nonatomic_int_type long
  1449. #define __pyx_nonatomic_ptr_type void*
  1450. #pragma intrinsic (_InterlockedExchangeAdd, _InterlockedExchange, _InterlockedCompareExchange, _InterlockedCompareExchangePointer, _InterlockedExchangePointer)
  1451. #define __pyx_atomic_incr_relaxed(value) _InterlockedExchangeAdd(value, 1)
  1452. #define __pyx_atomic_incr_acq_rel(value) _InterlockedExchangeAdd(value, 1)
  1453. #define __pyx_atomic_decr_acq_rel(value) _InterlockedExchangeAdd(value, -1)
  1454. #define __pyx_atomic_sub(value, arg) _InterlockedExchangeAdd(value, -arg)
  1455. static CYTHON_INLINE int __pyx_atomic_int_cmp_exchange(__pyx_atomic_int_type* value, __pyx_nonatomic_int_type* expected, __pyx_nonatomic_int_type desired) {
  1456. __pyx_nonatomic_int_type old = _InterlockedCompareExchange(value, desired, *expected);
  1457. int result = old == *expected;
  1458. *expected = old;
  1459. return result;
  1460. }
  1461. #define __pyx_atomic_load(value) _InterlockedExchangeAdd(value, 0)
  1462. #define __pyx_atomic_store(value, new_value) _InterlockedExchange(value, new_value)
  1463. #define __pyx_atomic_pointer_load_relaxed(value) *(void * volatile *)value
  1464. #define __pyx_atomic_pointer_load_acquire(value) _InterlockedCompareExchangePointer(value, 0, 0)
  1465. #define __pyx_atomic_pointer_exchange(value, new_value) _InterlockedExchangePointer(value, (__pyx_atomic_ptr_type)new_value)
  1466. static CYTHON_INLINE int __pyx_atomic_pointer_cmp_exchange(__pyx_atomic_ptr_type* value, __pyx_nonatomic_ptr_type* expected, __pyx_nonatomic_ptr_type desired) {
  1467. __pyx_atomic_ptr_type old = _InterlockedCompareExchangePointer(value, desired, *expected);
  1468. int result = old == *expected;
  1469. *expected = old;
  1470. return result;
  1471. }
  1472. #ifdef __PYX_DEBUG_ATOMICS
  1473. #pragma message ("Using MSVC atomics")
  1474. #endif
  1475. #else
  1476. #undef CYTHON_ATOMICS
  1477. #define CYTHON_ATOMICS 0
  1478. #ifdef __PYX_DEBUG_ATOMICS
  1479. #warning "Not using atomics"
  1480. #endif
  1481. #endif
  1482. /* CriticalSectionsDefinition.proto (used by CriticalSections) */
  1483. #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  1484. #define __Pyx_PyCriticalSection void*
  1485. #define __Pyx_PyCriticalSection2 void*
  1486. #define __Pyx_PyCriticalSection_End(cs)
  1487. #define __Pyx_PyCriticalSection2_End(cs)
  1488. #else
  1489. #define __Pyx_PyCriticalSection PyCriticalSection
  1490. #define __Pyx_PyCriticalSection2 PyCriticalSection2
  1491. #define __Pyx_PyCriticalSection_End PyCriticalSection_End
  1492. #define __Pyx_PyCriticalSection2_End PyCriticalSection2_End
  1493. #endif
  1494. /* CriticalSections.proto (used by ParseKeywordsImpl) */
  1495. #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  1496. #define __Pyx_PyCriticalSection_Begin(cs, arg) (void)(cs)
  1497. #define __Pyx_PyCriticalSection2_Begin(cs, arg1, arg2) (void)(cs)
  1498. #else
  1499. #define __Pyx_PyCriticalSection_Begin PyCriticalSection_Begin
  1500. #define __Pyx_PyCriticalSection2_Begin PyCriticalSection2_Begin
  1501. #endif
  1502. #if PY_VERSION_HEX < 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
  1503. #define __Pyx_BEGIN_CRITICAL_SECTION(o) {
  1504. #define __Pyx_END_CRITICAL_SECTION() }
  1505. #else
  1506. #define __Pyx_BEGIN_CRITICAL_SECTION Py_BEGIN_CRITICAL_SECTION
  1507. #define __Pyx_END_CRITICAL_SECTION Py_END_CRITICAL_SECTION
  1508. #endif
  1509. /* IncludeStructmemberH.proto (used by FixUpExtensionType) */
  1510. #include <structmember.h>
  1511. /* #### Code section: numeric_typedefs ### */
  1512. /* #### Code section: complex_type_declarations ### */
  1513. /* Declarations.proto */
  1514. #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
  1515. #ifdef __cplusplus
  1516. typedef ::std::complex< double > __pyx_t_double_complex;
  1517. #else
  1518. typedef double _Complex __pyx_t_double_complex;
  1519. #endif
  1520. #else
  1521. typedef struct { double real, imag; } __pyx_t_double_complex;
  1522. #endif
  1523. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
  1524. /* #### Code section: type_declarations ### */
  1525. /*--- Type declarations ---*/
  1526. struct __pyx_defaults;
  1527. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr;
  1528. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr;
  1529. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC;
  1530. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC;
  1531. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr;
  1532. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t;
  1533. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr;
  1534. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr;
  1535. /* "fontTools/misc/bezierTools.py":815
  1536. *
  1537. *
  1538. * def solveQuadratic(a, b, c, sqrt=sqrt): # <<<<<<<<<<<<<<
  1539. * """Solve a quadratic equation.
  1540. *
  1541. */
  1542. struct __pyx_defaults {
  1543. PyObject_HEAD
  1544. PyObject *arg0;
  1545. };
  1546. /* "fontTools/misc/bezierTools.py":546
  1547. * a[isHorizontal], b[isHorizontal], c[isHorizontal] - where
  1548. * )
  1549. * solutions = sorted(t for t in solutions if 0 <= t < 1) # <<<<<<<<<<<<<<
  1550. * if not solutions:
  1551. * return [(pt1, pt2, pt3)]
  1552. */
  1553. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr {
  1554. PyObject_HEAD
  1555. PyObject *__pyx_genexpr_arg_0;
  1556. PyObject *__pyx_v_t;
  1557. };
  1558. /* "fontTools/misc/bezierTools.py":583
  1559. * a[isHorizontal], b[isHorizontal], c[isHorizontal], d[isHorizontal] - where
  1560. * )
  1561. * solutions = sorted(t for t in solutions if 0 <= t < 1) # <<<<<<<<<<<<<<
  1562. * if not solutions:
  1563. * return [(pt1, pt2, pt3, pt4)]
  1564. */
  1565. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr {
  1566. PyObject_HEAD
  1567. PyObject *__pyx_genexpr_arg_0;
  1568. PyObject *__pyx_v_t;
  1569. };
  1570. /* "fontTools/misc/bezierTools.py":644
  1571. *
  1572. *
  1573. * @cython.locals( # <<<<<<<<<<<<<<
  1574. * pt1=cython.complex,
  1575. * pt2=cython.complex,
  1576. */
  1577. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC {
  1578. PyObject_HEAD
  1579. __pyx_t_double_complex __pyx_v_a;
  1580. __pyx_t_double_complex __pyx_v_b;
  1581. __pyx_t_double_complex __pyx_v_c;
  1582. __pyx_t_double_complex __pyx_v_d;
  1583. __pyx_t_double_complex __pyx_v_pt1;
  1584. __pyx_t_double_complex __pyx_v_pt2;
  1585. __pyx_t_double_complex __pyx_v_pt3;
  1586. __pyx_t_double_complex __pyx_v_pt4;
  1587. PyObject *__pyx_v_ts;
  1588. };
  1589. /* "fontTools/misc/bezierTools.py":770
  1590. *
  1591. *
  1592. * @cython.locals( # <<<<<<<<<<<<<<
  1593. * a=cython.complex,
  1594. * b=cython.complex,
  1595. */
  1596. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC {
  1597. PyObject_HEAD
  1598. __pyx_t_double_complex __pyx_v_a;
  1599. __pyx_t_double_complex __pyx_v_a1;
  1600. __pyx_t_double_complex __pyx_v_b;
  1601. __pyx_t_double_complex __pyx_v_b1;
  1602. __pyx_t_double_complex __pyx_v_c;
  1603. __pyx_t_double_complex __pyx_v_c1;
  1604. __pyx_t_double_complex __pyx_v_d;
  1605. __pyx_t_double_complex __pyx_v_d1;
  1606. double __pyx_v_delta;
  1607. double __pyx_v_delta_2;
  1608. double __pyx_v_delta_3;
  1609. PyObject *__pyx_v_i;
  1610. PyObject *__pyx_v_pt1;
  1611. PyObject *__pyx_v_pt2;
  1612. PyObject *__pyx_v_pt3;
  1613. PyObject *__pyx_v_pt4;
  1614. double __pyx_v_t1;
  1615. double __pyx_v_t1_2;
  1616. double __pyx_v_t1_3;
  1617. double __pyx_v_t2;
  1618. PyObject *__pyx_v_ts;
  1619. PyObject *__pyx_t_0;
  1620. PyObject *(*__pyx_t_1)(PyObject *);
  1621. };
  1622. /* "fontTools/misc/bezierTools.py":1252
  1623. * else:
  1624. * raise ValueError("Unknown curve degree")
  1625. * return sorted(i for i in intersections if 0.0 <= i <= 1) # <<<<<<<<<<<<<<
  1626. *
  1627. *
  1628. */
  1629. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr {
  1630. PyObject_HEAD
  1631. PyObject *__pyx_genexpr_arg_0;
  1632. PyObject *__pyx_v_i;
  1633. };
  1634. /* "fontTools/misc/bezierTools.py":1313
  1635. *
  1636. *
  1637. * def _curve_curve_intersections_t( # <<<<<<<<<<<<<<
  1638. * curve1, curve2, precision=1e-3, range1=None, range2=None
  1639. * ):
  1640. */
  1641. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t {
  1642. PyObject_HEAD
  1643. PyObject *__pyx_v_precision;
  1644. };
  1645. /* "fontTools/misc/bezierTools.py":1382
  1646. * def _is_linelike(segment):
  1647. * maybeline = _alignment_transformation(segment).transformPoints(segment)
  1648. * return all(math.isclose(p[1], 0.0) for p in maybeline) # <<<<<<<<<<<<<<
  1649. *
  1650. *
  1651. */
  1652. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr {
  1653. PyObject_HEAD
  1654. PyObject *__pyx_genexpr_arg_0;
  1655. PyObject *__pyx_v_p;
  1656. };
  1657. /* "fontTools/misc/bezierTools.py":1485
  1658. * return "%g" % obj
  1659. * else:
  1660. * return "(%s)" % ", ".join(_segmentrepr(x) for x in it) # <<<<<<<<<<<<<<
  1661. *
  1662. *
  1663. */
  1664. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr {
  1665. PyObject_HEAD
  1666. PyObject *__pyx_genexpr_arg_0;
  1667. PyObject *__pyx_v_x;
  1668. };
  1669. /* #### Code section: utility_code_proto ### */
  1670. /* --- Runtime support code (head) --- */
  1671. /* Refnanny.proto */
  1672. #ifndef CYTHON_REFNANNY
  1673. #define CYTHON_REFNANNY 0
  1674. #endif
  1675. #if CYTHON_REFNANNY
  1676. typedef struct {
  1677. void (*INCREF)(void*, PyObject*, Py_ssize_t);
  1678. void (*DECREF)(void*, PyObject*, Py_ssize_t);
  1679. void (*GOTREF)(void*, PyObject*, Py_ssize_t);
  1680. void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
  1681. void* (*SetupContext)(const char*, Py_ssize_t, const char*);
  1682. void (*FinishContext)(void**);
  1683. } __Pyx_RefNannyAPIStruct;
  1684. static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  1685. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  1686. #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  1687. #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  1688. if (acquire_gil) {\
  1689. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  1690. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
  1691. PyGILState_Release(__pyx_gilstate_save);\
  1692. } else {\
  1693. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
  1694. }
  1695. #define __Pyx_RefNannyFinishContextNogil() {\
  1696. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  1697. __Pyx_RefNannyFinishContext();\
  1698. PyGILState_Release(__pyx_gilstate_save);\
  1699. }
  1700. #define __Pyx_RefNannyFinishContextNogil() {\
  1701. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  1702. __Pyx_RefNannyFinishContext();\
  1703. PyGILState_Release(__pyx_gilstate_save);\
  1704. }
  1705. #define __Pyx_RefNannyFinishContext()\
  1706. __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  1707. #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  1708. #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  1709. #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  1710. #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
  1711. #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0)
  1712. #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
  1713. #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
  1714. #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
  1715. #else
  1716. #define __Pyx_RefNannyDeclarations
  1717. #define __Pyx_RefNannySetupContext(name, acquire_gil)
  1718. #define __Pyx_RefNannyFinishContextNogil()
  1719. #define __Pyx_RefNannyFinishContext()
  1720. #define __Pyx_INCREF(r) Py_INCREF(r)
  1721. #define __Pyx_DECREF(r) Py_DECREF(r)
  1722. #define __Pyx_GOTREF(r)
  1723. #define __Pyx_GIVEREF(r)
  1724. #define __Pyx_XINCREF(r) Py_XINCREF(r)
  1725. #define __Pyx_XDECREF(r) Py_XDECREF(r)
  1726. #define __Pyx_XGOTREF(r)
  1727. #define __Pyx_XGIVEREF(r)
  1728. #endif
  1729. #define __Pyx_Py_XDECREF_SET(r, v) do {\
  1730. PyObject *tmp = (PyObject *) r;\
  1731. r = v; Py_XDECREF(tmp);\
  1732. } while (0)
  1733. #define __Pyx_XDECREF_SET(r, v) do {\
  1734. PyObject *tmp = (PyObject *) r;\
  1735. r = v; __Pyx_XDECREF(tmp);\
  1736. } while (0)
  1737. #define __Pyx_DECREF_SET(r, v) do {\
  1738. PyObject *tmp = (PyObject *) r;\
  1739. r = v; __Pyx_DECREF(tmp);\
  1740. } while (0)
  1741. #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
  1742. #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
  1743. /* PyErrExceptionMatches.proto (used by PyObjectGetAttrStrNoError) */
  1744. #if CYTHON_FAST_THREAD_STATE
  1745. #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
  1746. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
  1747. #else
  1748. #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
  1749. #endif
  1750. /* PyThreadStateGet.proto (used by PyErrFetchRestore) */
  1751. #if CYTHON_FAST_THREAD_STATE
  1752. #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
  1753. #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
  1754. #if PY_VERSION_HEX >= 0x030C00A6
  1755. #define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL)
  1756. #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL)
  1757. #else
  1758. #define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL)
  1759. #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type)
  1760. #endif
  1761. #else
  1762. #define __Pyx_PyThreadState_declare
  1763. #define __Pyx_PyThreadState_assign
  1764. #define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL)
  1765. #define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred()
  1766. #endif
  1767. /* PyErrFetchRestore.proto (used by PyObjectGetAttrStrNoError) */
  1768. #if CYTHON_FAST_THREAD_STATE
  1769. #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
  1770. #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
  1771. #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
  1772. #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
  1773. #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
  1774. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  1775. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1776. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6
  1777. #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
  1778. #else
  1779. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1780. #endif
  1781. #else
  1782. #define __Pyx_PyErr_Clear() PyErr_Clear()
  1783. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1784. #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
  1785. #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
  1786. #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
  1787. #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
  1788. #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
  1789. #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
  1790. #endif
  1791. /* PyObjectGetAttrStr.proto (used by PyObjectGetAttrStrNoError) */
  1792. #if CYTHON_USE_TYPE_SLOTS
  1793. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
  1794. #else
  1795. #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
  1796. #endif
  1797. /* PyObjectGetAttrStrNoError.proto (used by GetBuiltinName) */
  1798. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
  1799. /* GetBuiltinName.proto */
  1800. static PyObject *__Pyx_GetBuiltinName(PyObject *name);
  1801. /* TupleAndListFromArray.proto (used by fastcall) */
  1802. #if CYTHON_COMPILING_IN_CPYTHON
  1803. static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n);
  1804. #endif
  1805. #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_METH_FASTCALL
  1806. static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n);
  1807. #endif
  1808. /* IncludeStringH.proto (used by BytesEquals) */
  1809. #include <string.h>
  1810. /* BytesEquals.proto (used by UnicodeEquals) */
  1811. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
  1812. /* UnicodeEquals.proto (used by fastcall) */
  1813. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
  1814. /* fastcall.proto */
  1815. #if CYTHON_AVOID_BORROWED_REFS
  1816. #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_PySequence_ITEM(args, i)
  1817. #elif CYTHON_ASSUME_SAFE_MACROS
  1818. #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_NewRef(__Pyx_PyTuple_GET_ITEM(args, i))
  1819. #else
  1820. #define __Pyx_ArgRef_VARARGS(args, i) __Pyx_XNewRef(PyTuple_GetItem(args, i))
  1821. #endif
  1822. #define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds)
  1823. #define __Pyx_KwValues_VARARGS(args, nargs) NULL
  1824. #define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s)
  1825. #define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw)
  1826. #if CYTHON_METH_FASTCALL
  1827. #define __Pyx_ArgRef_FASTCALL(args, i) __Pyx_NewRef(args[i])
  1828. #define __Pyx_NumKwargs_FASTCALL(kwds) __Pyx_PyTuple_GET_SIZE(kwds)
  1829. #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs))
  1830. static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s);
  1831. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
  1832. CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues);
  1833. #else
  1834. #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw)
  1835. #endif
  1836. #else
  1837. #define __Pyx_ArgRef_FASTCALL __Pyx_ArgRef_VARARGS
  1838. #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS
  1839. #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS
  1840. #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS
  1841. #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS
  1842. #endif
  1843. #define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop)
  1844. #if CYTHON_METH_FASTCALL || (CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
  1845. #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(args + start, stop - start)
  1846. #else
  1847. #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop)
  1848. #endif
  1849. /* py_dict_items.proto (used by OwnedDictNext) */
  1850. static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d);
  1851. /* CallCFunction.proto (used by CallUnboundCMethod0) */
  1852. #define __Pyx_CallCFunction(cfunc, self, args)\
  1853. ((PyCFunction)(void(*)(void))(cfunc)->func)(self, args)
  1854. #define __Pyx_CallCFunctionWithKeywords(cfunc, self, args, kwargs)\
  1855. ((PyCFunctionWithKeywords)(void(*)(void))(cfunc)->func)(self, args, kwargs)
  1856. #define __Pyx_CallCFunctionFast(cfunc, self, args, nargs)\
  1857. ((__Pyx_PyCFunctionFast)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs)
  1858. #define __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, nargs, kwnames)\
  1859. ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))(PyCFunction)(cfunc)->func)(self, args, nargs, kwnames)
  1860. /* PyObjectCall.proto (used by PyObjectFastCall) */
  1861. #if CYTHON_COMPILING_IN_CPYTHON
  1862. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
  1863. #else
  1864. #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
  1865. #endif
  1866. /* PyObjectCallMethO.proto (used by PyObjectFastCall) */
  1867. #if CYTHON_COMPILING_IN_CPYTHON
  1868. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
  1869. #endif
  1870. /* PyObjectFastCall.proto (used by PyObjectCallOneArg) */
  1871. #define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
  1872. static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs);
  1873. /* PyObjectCallOneArg.proto (used by CallUnboundCMethod0) */
  1874. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
  1875. /* UnpackUnboundCMethod.proto (used by CallUnboundCMethod0) */
  1876. typedef struct {
  1877. PyObject *type;
  1878. PyObject **method_name;
  1879. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && CYTHON_ATOMICS
  1880. __pyx_atomic_int_type initialized;
  1881. #endif
  1882. PyCFunction func;
  1883. PyObject *method;
  1884. int flag;
  1885. } __Pyx_CachedCFunction;
  1886. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  1887. static CYTHON_INLINE int __Pyx_CachedCFunction_GetAndSetInitializing(__Pyx_CachedCFunction *cfunc) {
  1888. #if !CYTHON_ATOMICS
  1889. return 1;
  1890. #else
  1891. __pyx_nonatomic_int_type expected = 0;
  1892. if (__pyx_atomic_int_cmp_exchange(&cfunc->initialized, &expected, 1)) {
  1893. return 0;
  1894. }
  1895. return expected;
  1896. #endif
  1897. }
  1898. static CYTHON_INLINE void __Pyx_CachedCFunction_SetFinishedInitializing(__Pyx_CachedCFunction *cfunc) {
  1899. #if CYTHON_ATOMICS
  1900. __pyx_atomic_store(&cfunc->initialized, 2);
  1901. #endif
  1902. }
  1903. #else
  1904. #define __Pyx_CachedCFunction_GetAndSetInitializing(cfunc) 2
  1905. #define __Pyx_CachedCFunction_SetFinishedInitializing(cfunc)
  1906. #endif
  1907. /* CallUnboundCMethod0.proto */
  1908. CYTHON_UNUSED
  1909. static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
  1910. #if CYTHON_COMPILING_IN_CPYTHON
  1911. static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
  1912. #else
  1913. #define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self)
  1914. #endif
  1915. /* py_dict_values.proto (used by OwnedDictNext) */
  1916. static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d);
  1917. /* OwnedDictNext.proto (used by ParseKeywordsImpl) */
  1918. #if CYTHON_AVOID_BORROWED_REFS
  1919. static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue);
  1920. #else
  1921. CYTHON_INLINE
  1922. static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue);
  1923. #endif
  1924. /* RaiseDoubleKeywords.proto (used by ParseKeywordsImpl) */
  1925. static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
  1926. /* ParseKeywordsImpl.export */
  1927. static int __Pyx_ParseKeywordsTuple(
  1928. PyObject *kwds,
  1929. PyObject * const *kwvalues,
  1930. PyObject ** const argnames[],
  1931. PyObject *kwds2,
  1932. PyObject *values[],
  1933. Py_ssize_t num_pos_args,
  1934. Py_ssize_t num_kwargs,
  1935. const char* function_name,
  1936. int ignore_unknown_kwargs
  1937. );
  1938. static int __Pyx_ParseKeywordDictToDict(
  1939. PyObject *kwds,
  1940. PyObject ** const argnames[],
  1941. PyObject *kwds2,
  1942. PyObject *values[],
  1943. Py_ssize_t num_pos_args,
  1944. const char* function_name
  1945. );
  1946. static int __Pyx_ParseKeywordDict(
  1947. PyObject *kwds,
  1948. PyObject ** const argnames[],
  1949. PyObject *values[],
  1950. Py_ssize_t num_pos_args,
  1951. Py_ssize_t num_kwargs,
  1952. const char* function_name,
  1953. int ignore_unknown_kwargs
  1954. );
  1955. /* CallUnboundCMethod2.proto */
  1956. CYTHON_UNUSED
  1957. static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
  1958. #if CYTHON_COMPILING_IN_CPYTHON
  1959. static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2);
  1960. #else
  1961. #define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
  1962. #endif
  1963. /* ParseKeywords.proto */
  1964. static CYTHON_INLINE int __Pyx_ParseKeywords(
  1965. PyObject *kwds, PyObject *const *kwvalues, PyObject ** const argnames[],
  1966. PyObject *kwds2, PyObject *values[],
  1967. Py_ssize_t num_pos_args, Py_ssize_t num_kwargs,
  1968. const char* function_name,
  1969. int ignore_unknown_kwargs
  1970. );
  1971. /* RaiseArgTupleInvalid.proto */
  1972. static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
  1973. Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
  1974. /* PyDictVersioning.proto (used by GetModuleGlobalName) */
  1975. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
  1976. #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
  1977. #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
  1978. #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
  1979. (version_var) = __PYX_GET_DICT_VERSION(dict);\
  1980. (cache_var) = (value);
  1981. #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
  1982. static PY_UINT64_T __pyx_dict_version = 0;\
  1983. static PyObject *__pyx_dict_cached_value = NULL;\
  1984. if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
  1985. (VAR) = __Pyx_XNewRef(__pyx_dict_cached_value);\
  1986. } else {\
  1987. (VAR) = __pyx_dict_cached_value = (LOOKUP);\
  1988. __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
  1989. }\
  1990. }
  1991. static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
  1992. static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
  1993. static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
  1994. #else
  1995. #define __PYX_GET_DICT_VERSION(dict) (0)
  1996. #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
  1997. #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
  1998. #endif
  1999. /* GetModuleGlobalName.proto */
  2000. #if CYTHON_USE_DICT_VERSIONS
  2001. #define __Pyx_GetModuleGlobalName(var, name) do {\
  2002. static PY_UINT64_T __pyx_dict_version = 0;\
  2003. static PyObject *__pyx_dict_cached_value = NULL;\
  2004. (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_mstate_global->__pyx_d))) ?\
  2005. (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
  2006. __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
  2007. } while(0)
  2008. #define __Pyx_GetModuleGlobalNameUncached(var, name) do {\
  2009. PY_UINT64_T __pyx_dict_version;\
  2010. PyObject *__pyx_dict_cached_value;\
  2011. (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
  2012. } while(0)
  2013. static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
  2014. #else
  2015. #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
  2016. #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
  2017. static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
  2018. #endif
  2019. /* PyLongBinop.proto */
  2020. #if !CYTHON_COMPILING_IN_PYPY
  2021. static CYTHON_INLINE PyObject* __Pyx_PyLong_MultiplyCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
  2022. #else
  2023. #define __Pyx_PyLong_MultiplyCObj(op1, op2, intval, inplace, zerodivision_check)\
  2024. (inplace ? PyNumber_InPlaceMultiply(op1, op2) : PyNumber_Multiply(op1, op2))
  2025. #endif
  2026. /* RaiseTooManyValuesToUnpack.proto */
  2027. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
  2028. /* RaiseNeedMoreValuesToUnpack.proto */
  2029. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
  2030. /* IterFinish.proto */
  2031. static CYTHON_INLINE int __Pyx_IterFinish(void);
  2032. /* UnpackItemEndCheck.proto */
  2033. static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
  2034. /* PyLongBinop.proto */
  2035. #if !CYTHON_COMPILING_IN_PYPY
  2036. static CYTHON_INLINE PyObject* __Pyx_PyLong_TrueDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
  2037. #else
  2038. #define __Pyx_PyLong_TrueDivideObjC(op1, op2, intval, inplace, zerodivision_check)\
  2039. (inplace ? PyNumber_InPlaceTrueDivide(op1, op2) : PyNumber_TrueDivide(op1, op2))
  2040. #endif
  2041. /* IncludeStdlibH.proto */
  2042. #include <stdlib.h>
  2043. /* PyLongCompare.proto */
  2044. static CYTHON_INLINE int __Pyx_PyLong_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
  2045. /* ListAppend.proto */
  2046. #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
  2047. static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
  2048. PyListObject* L = (PyListObject*) list;
  2049. Py_ssize_t len = Py_SIZE(list);
  2050. if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
  2051. Py_INCREF(x);
  2052. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
  2053. L->ob_item[len] = x;
  2054. #else
  2055. PyList_SET_ITEM(list, len, x);
  2056. #endif
  2057. __Pyx_SET_SIZE(list, len + 1);
  2058. return 0;
  2059. }
  2060. return PyList_Append(list, x);
  2061. }
  2062. #else
  2063. #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
  2064. #endif
  2065. /* ListCompAppend.proto */
  2066. #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
  2067. static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
  2068. PyListObject* L = (PyListObject*) list;
  2069. Py_ssize_t len = Py_SIZE(list);
  2070. if (likely(L->allocated > len)) {
  2071. Py_INCREF(x);
  2072. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
  2073. L->ob_item[len] = x;
  2074. #else
  2075. PyList_SET_ITEM(list, len, x);
  2076. #endif
  2077. __Pyx_SET_SIZE(list, len + 1);
  2078. return 0;
  2079. }
  2080. return PyList_Append(list, x);
  2081. }
  2082. #else
  2083. #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
  2084. #endif
  2085. /* GetItemInt.proto */
  2086. #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
  2087. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  2088. __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck, unsafe_shared) :\
  2089. (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
  2090. __Pyx_GetItemInt_Generic(o, to_py_func(i))))
  2091. #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
  2092. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  2093. __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\
  2094. (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
  2095. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  2096. int wraparound, int boundscheck, int unsafe_shared);
  2097. #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
  2098. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  2099. __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck, unsafe_shared) :\
  2100. (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
  2101. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  2102. int wraparound, int boundscheck, int unsafe_shared);
  2103. static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
  2104. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
  2105. int is_list, int wraparound, int boundscheck, int unsafe_shared);
  2106. /* ObjectGetItem.proto */
  2107. #if CYTHON_USE_TYPE_SLOTS
  2108. static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key);
  2109. #else
  2110. #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
  2111. #endif
  2112. /* PyLongCompare.proto */
  2113. static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
  2114. /* RaiseUnboundLocalError.proto */
  2115. static void __Pyx_RaiseUnboundLocalError(const char *varname);
  2116. /* GetException.proto (used by pep479) */
  2117. #if CYTHON_FAST_THREAD_STATE
  2118. #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
  2119. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  2120. #else
  2121. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
  2122. #endif
  2123. /* pep479.proto */
  2124. static void __Pyx_Generator_Replace_StopIteration(int in_async_gen);
  2125. /* SliceObject.proto */
  2126. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
  2127. PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
  2128. PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
  2129. int has_cstart, int has_cstop, int wraparound);
  2130. /* ListExtend.proto */
  2131. static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
  2132. #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00a2
  2133. return PyList_Extend(L, v);
  2134. #elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
  2135. PyObject* none = _PyList_Extend((PyListObject*)L, v);
  2136. if (unlikely(!none))
  2137. return -1;
  2138. Py_DECREF(none);
  2139. return 0;
  2140. #else
  2141. return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
  2142. #endif
  2143. }
  2144. /* SetItemInt.proto */
  2145. #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck, has_gil, unsafe_shared)\
  2146. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  2147. __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck, unsafe_shared) :\
  2148. (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
  2149. __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
  2150. static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
  2151. static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
  2152. int is_list, int wraparound, int boundscheck, int unsafe_shared);
  2153. /* dict_setdefault.proto (used by FetchCommonType) */
  2154. static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value);
  2155. /* LimitedApiGetTypeDict.proto (used by SetItemOnTypeDict) */
  2156. #if CYTHON_COMPILING_IN_LIMITED_API
  2157. static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp);
  2158. #endif
  2159. /* SetItemOnTypeDict.proto (used by FixUpExtensionType) */
  2160. static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v);
  2161. #define __Pyx_SetItemOnTypeDict(tp, k, v) __Pyx__SetItemOnTypeDict((PyTypeObject*)tp, k, v)
  2162. /* FixUpExtensionType.proto (used by FetchCommonType) */
  2163. static CYTHON_INLINE int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type);
  2164. /* AddModuleRef.proto (used by FetchSharedCythonModule) */
  2165. #if ((CYTHON_COMPILING_IN_CPYTHON_FREETHREADING ) ||\
  2166. __PYX_LIMITED_VERSION_HEX < 0x030d0000)
  2167. static PyObject *__Pyx_PyImport_AddModuleRef(const char *name);
  2168. #else
  2169. #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
  2170. #endif
  2171. /* FetchSharedCythonModule.proto (used by FetchCommonType) */
  2172. static PyObject *__Pyx_FetchSharedCythonABIModule(void);
  2173. /* FetchCommonType.proto (used by CommonTypesMetaclass) */
  2174. static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases);
  2175. /* CommonTypesMetaclass.proto (used by CoroutineBase) */
  2176. static int __pyx_CommonTypesMetaclass_init(PyObject *module);
  2177. #define __Pyx_CommonTypesMetaclass_USED
  2178. /* RaiseException.export */
  2179. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
  2180. /* GetTopmostException.proto (used by SaveResetException) */
  2181. #if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
  2182. static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
  2183. #endif
  2184. /* SaveResetException.proto (used by CoroutineBase) */
  2185. #if CYTHON_FAST_THREAD_STATE
  2186. #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
  2187. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  2188. #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
  2189. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  2190. #else
  2191. #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
  2192. #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
  2193. #endif
  2194. /* SwapException.proto (used by CoroutineBase) */
  2195. #if CYTHON_FAST_THREAD_STATE
  2196. #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
  2197. static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  2198. #else
  2199. static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
  2200. #endif
  2201. /* CallTypeTraverse.proto (used by CoroutineBase) */
  2202. #if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000)
  2203. #define __Pyx_call_type_traverse(o, always_call, visit, arg) 0
  2204. #else
  2205. static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg);
  2206. #endif
  2207. /* IterNextPlain.proto (used by CoroutineBase) */
  2208. static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator);
  2209. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  2210. static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void);
  2211. #endif
  2212. /* PyObjectCall2Args.proto (used by PyObjectCallMethod1) */
  2213. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
  2214. /* PyObjectGetMethod.proto (used by PyObjectCallMethod1) */
  2215. #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
  2216. static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
  2217. #endif
  2218. /* PyObjectCallMethod1.proto (used by CoroutineBase) */
  2219. static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
  2220. /* PyObjectCallNoArg.proto (used by CoroutineBase) */
  2221. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
  2222. /* ReturnWithStopIteration.proto (used by CoroutineBase) */
  2223. static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext);
  2224. /* CoroutineBase.proto (used by Generator) */
  2225. struct __pyx_CoroutineObject;
  2226. typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *);
  2227. #if CYTHON_USE_EXC_INFO_STACK
  2228. #define __Pyx_ExcInfoStruct _PyErr_StackItem
  2229. #else
  2230. typedef struct {
  2231. PyObject *exc_type;
  2232. PyObject *exc_value;
  2233. PyObject *exc_traceback;
  2234. } __Pyx_ExcInfoStruct;
  2235. #endif
  2236. typedef struct __pyx_CoroutineObject {
  2237. PyObject_HEAD
  2238. __pyx_coroutine_body_t body;
  2239. PyObject *closure;
  2240. __Pyx_ExcInfoStruct gi_exc_state;
  2241. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  2242. PyObject *gi_weakreflist;
  2243. #endif
  2244. PyObject *classobj;
  2245. PyObject *yieldfrom;
  2246. __Pyx_pyiter_sendfunc yieldfrom_am_send;
  2247. PyObject *gi_name;
  2248. PyObject *gi_qualname;
  2249. PyObject *gi_modulename;
  2250. PyObject *gi_code;
  2251. PyObject *gi_frame;
  2252. #if CYTHON_USE_SYS_MONITORING && (CYTHON_PROFILE || CYTHON_TRACE)
  2253. PyMonitoringState __pyx_pymonitoring_state[__Pyx_MonitoringEventTypes_CyGen_count];
  2254. uint64_t __pyx_pymonitoring_version;
  2255. #endif
  2256. int resume_label;
  2257. char is_running;
  2258. } __pyx_CoroutineObject;
  2259. static __pyx_CoroutineObject *__Pyx__Coroutine_New(
  2260. PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  2261. PyObject *name, PyObject *qualname, PyObject *module_name);
  2262. static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
  2263. __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  2264. PyObject *name, PyObject *qualname, PyObject *module_name);
  2265. static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
  2266. static int __Pyx_Coroutine_clear(PyObject *self);
  2267. static __Pyx_PySendResult __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval);
  2268. static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
  2269. static __Pyx_PySendResult __Pyx_Coroutine_Close(PyObject *self, PyObject **retval);
  2270. static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
  2271. #if CYTHON_USE_EXC_INFO_STACK
  2272. #define __Pyx_Coroutine_SwapException(self)
  2273. #define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
  2274. #else
  2275. #define __Pyx_Coroutine_SwapException(self) {\
  2276. __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
  2277. __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
  2278. }
  2279. #define __Pyx_Coroutine_ResetAndClearException(self) {\
  2280. __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
  2281. (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
  2282. }
  2283. #endif
  2284. #if CYTHON_FAST_THREAD_STATE
  2285. #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
  2286. __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
  2287. #else
  2288. #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
  2289. __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
  2290. #endif
  2291. static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
  2292. static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);
  2293. static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen);
  2294. static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen);
  2295. static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen);
  2296. static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure);
  2297. #if __PYX_HAS_PY_AM_SEND == 2
  2298. static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send);
  2299. #endif
  2300. static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg);
  2301. /* Generator.proto (used by GeneratorYieldFrom) */
  2302. #define __Pyx_Generator_USED
  2303. #define __Pyx_Generator_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_GeneratorType)
  2304. #define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
  2305. __Pyx__Coroutine_New(__pyx_mstate_global->__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
  2306. static PyObject *__Pyx_Generator_Next(PyObject *self);
  2307. static int __pyx_Generator_init(PyObject *module);
  2308. static CYTHON_INLINE PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self);
  2309. /* GeneratorYieldFrom.proto */
  2310. static CYTHON_INLINE __Pyx_PySendResult __Pyx_Generator_Yield_From(__pyx_CoroutineObject *gen, PyObject *source, PyObject **retval);
  2311. /* append.proto */
  2312. static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);
  2313. /* PyRange_Check.proto */
  2314. #if CYTHON_COMPILING_IN_PYPY && !defined(PyRange_Check)
  2315. #define PyRange_Check(obj) __Pyx_TypeCheck((obj), &PyRange_Type)
  2316. #endif
  2317. /* PyLongBinop.proto */
  2318. #if !CYTHON_COMPILING_IN_PYPY
  2319. static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
  2320. #else
  2321. #define __Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
  2322. (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
  2323. #endif
  2324. /* py_abs.proto */
  2325. #if CYTHON_USE_PYLONG_INTERNALS
  2326. static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);
  2327. #define __Pyx_PyNumber_Absolute(x)\
  2328. ((likely(PyLong_CheckExact(x))) ?\
  2329. (likely(__Pyx_PyLong_IsNonNeg(x)) ? __Pyx_NewRef(x) : __Pyx_PyLong_AbsNeg(x)) :\
  2330. PyNumber_Absolute(x))
  2331. #else
  2332. #define __Pyx_PyNumber_Absolute(x) PyNumber_Absolute(x)
  2333. #endif
  2334. /* PyFloatBinop.proto */
  2335. #if !CYTHON_COMPILING_IN_PYPY
  2336. static PyObject* __Pyx_PyFloat_TrueDivideObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
  2337. #else
  2338. #define __Pyx_PyFloat_TrueDivideObjC(op1, op2, floatval, inplace, zerodivision_check)\
  2339. (inplace ? PyNumber_InPlaceTrueDivide(op1, op2) : PyNumber_TrueDivide(op1, op2))
  2340. #endif
  2341. /* pybytes_as_double.proto (used by pynumber_float) */
  2342. static double __Pyx_SlowPyString_AsDouble(PyObject *obj);
  2343. static double __Pyx__PyBytes_AsDouble(PyObject *obj, const char* start, Py_ssize_t length);
  2344. static CYTHON_INLINE double __Pyx_PyBytes_AsDouble(PyObject *obj) {
  2345. char* as_c_string;
  2346. Py_ssize_t size;
  2347. #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
  2348. as_c_string = PyBytes_AS_STRING(obj);
  2349. size = PyBytes_GET_SIZE(obj);
  2350. #else
  2351. if (PyBytes_AsStringAndSize(obj, &as_c_string, &size) < 0) {
  2352. return (double)-1;
  2353. }
  2354. #endif
  2355. return __Pyx__PyBytes_AsDouble(obj, as_c_string, size);
  2356. }
  2357. static CYTHON_INLINE double __Pyx_PyByteArray_AsDouble(PyObject *obj) {
  2358. char* as_c_string;
  2359. Py_ssize_t size;
  2360. #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
  2361. as_c_string = PyByteArray_AS_STRING(obj);
  2362. size = PyByteArray_GET_SIZE(obj);
  2363. #else
  2364. as_c_string = PyByteArray_AsString(obj);
  2365. if (as_c_string == NULL) {
  2366. return (double)-1;
  2367. }
  2368. size = PyByteArray_Size(obj);
  2369. #endif
  2370. return __Pyx__PyBytes_AsDouble(obj, as_c_string, size);
  2371. }
  2372. /* pyunicode_as_double.proto (used by pynumber_float) */
  2373. #if !CYTHON_COMPILING_IN_PYPY && CYTHON_ASSUME_SAFE_MACROS
  2374. static const char* __Pyx__PyUnicode_AsDouble_Copy(const void* data, const int kind, char* buffer, Py_ssize_t start, Py_ssize_t end) {
  2375. int last_was_punctuation;
  2376. Py_ssize_t i;
  2377. last_was_punctuation = 1;
  2378. for (i=start; i <= end; i++) {
  2379. Py_UCS4 chr = PyUnicode_READ(kind, data, i);
  2380. int is_punctuation = (chr == '_') | (chr == '.');
  2381. *buffer = (char)chr;
  2382. buffer += (chr != '_');
  2383. if (unlikely(chr > 127)) goto parse_failure;
  2384. if (unlikely(last_was_punctuation & is_punctuation)) goto parse_failure;
  2385. last_was_punctuation = is_punctuation;
  2386. }
  2387. if (unlikely(last_was_punctuation)) goto parse_failure;
  2388. *buffer = '\0';
  2389. return buffer;
  2390. parse_failure:
  2391. return NULL;
  2392. }
  2393. static double __Pyx__PyUnicode_AsDouble_inf_nan(const void* data, int kind, Py_ssize_t start, Py_ssize_t length) {
  2394. int matches = 1;
  2395. Py_UCS4 chr;
  2396. Py_UCS4 sign = PyUnicode_READ(kind, data, start);
  2397. int is_signed = (sign == '-') | (sign == '+');
  2398. start += is_signed;
  2399. length -= is_signed;
  2400. switch (PyUnicode_READ(kind, data, start)) {
  2401. #ifdef Py_NAN
  2402. case 'n':
  2403. case 'N':
  2404. if (unlikely(length != 3)) goto parse_failure;
  2405. chr = PyUnicode_READ(kind, data, start+1);
  2406. matches &= (chr == 'a') | (chr == 'A');
  2407. chr = PyUnicode_READ(kind, data, start+2);
  2408. matches &= (chr == 'n') | (chr == 'N');
  2409. if (unlikely(!matches)) goto parse_failure;
  2410. return (sign == '-') ? -Py_NAN : Py_NAN;
  2411. #endif
  2412. case 'i':
  2413. case 'I':
  2414. if (unlikely(length < 3)) goto parse_failure;
  2415. chr = PyUnicode_READ(kind, data, start+1);
  2416. matches &= (chr == 'n') | (chr == 'N');
  2417. chr = PyUnicode_READ(kind, data, start+2);
  2418. matches &= (chr == 'f') | (chr == 'F');
  2419. if (likely(length == 3 && matches))
  2420. return (sign == '-') ? -Py_HUGE_VAL : Py_HUGE_VAL;
  2421. if (unlikely(length != 8)) goto parse_failure;
  2422. chr = PyUnicode_READ(kind, data, start+3);
  2423. matches &= (chr == 'i') | (chr == 'I');
  2424. chr = PyUnicode_READ(kind, data, start+4);
  2425. matches &= (chr == 'n') | (chr == 'N');
  2426. chr = PyUnicode_READ(kind, data, start+5);
  2427. matches &= (chr == 'i') | (chr == 'I');
  2428. chr = PyUnicode_READ(kind, data, start+6);
  2429. matches &= (chr == 't') | (chr == 'T');
  2430. chr = PyUnicode_READ(kind, data, start+7);
  2431. matches &= (chr == 'y') | (chr == 'Y');
  2432. if (unlikely(!matches)) goto parse_failure;
  2433. return (sign == '-') ? -Py_HUGE_VAL : Py_HUGE_VAL;
  2434. case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9':
  2435. break;
  2436. default:
  2437. goto parse_failure;
  2438. }
  2439. return 0.0;
  2440. parse_failure:
  2441. return -1.0;
  2442. }
  2443. static double __Pyx_PyUnicode_AsDouble_WithSpaces(PyObject *obj) {
  2444. double value;
  2445. const char *last;
  2446. char *end;
  2447. Py_ssize_t start, length = PyUnicode_GET_LENGTH(obj);
  2448. const int kind = PyUnicode_KIND(obj);
  2449. const void* data = PyUnicode_DATA(obj);
  2450. start = 0;
  2451. while (Py_UNICODE_ISSPACE(PyUnicode_READ(kind, data, start)))
  2452. start++;
  2453. while (start < length - 1 && Py_UNICODE_ISSPACE(PyUnicode_READ(kind, data, length - 1)))
  2454. length--;
  2455. length -= start;
  2456. if (unlikely(length <= 0)) goto fallback;
  2457. value = __Pyx__PyUnicode_AsDouble_inf_nan(data, kind, start, length);
  2458. if (unlikely(value == -1.0)) goto fallback;
  2459. if (value != 0.0) return value;
  2460. if (length < 40) {
  2461. char number[40];
  2462. last = __Pyx__PyUnicode_AsDouble_Copy(data, kind, number, start, start + length);
  2463. if (unlikely(!last)) goto fallback;
  2464. value = PyOS_string_to_double(number, &end, NULL);
  2465. } else {
  2466. char *number = (char*) PyMem_Malloc((length + 1) * sizeof(char));
  2467. if (unlikely(!number)) goto fallback;
  2468. last = __Pyx__PyUnicode_AsDouble_Copy(data, kind, number, start, start + length);
  2469. if (unlikely(!last)) {
  2470. PyMem_Free(number);
  2471. goto fallback;
  2472. }
  2473. value = PyOS_string_to_double(number, &end, NULL);
  2474. PyMem_Free(number);
  2475. }
  2476. if (likely(end == last) || (value == (double)-1 && PyErr_Occurred())) {
  2477. return value;
  2478. }
  2479. fallback:
  2480. return __Pyx_SlowPyString_AsDouble(obj);
  2481. }
  2482. #endif
  2483. static CYTHON_INLINE double __Pyx_PyUnicode_AsDouble(PyObject *obj) {
  2484. #if !CYTHON_COMPILING_IN_PYPY && CYTHON_ASSUME_SAFE_MACROS
  2485. if (unlikely(__Pyx_PyUnicode_READY(obj) == -1))
  2486. return (double)-1;
  2487. if (likely(PyUnicode_IS_ASCII(obj))) {
  2488. const char *s;
  2489. Py_ssize_t length;
  2490. s = PyUnicode_AsUTF8AndSize(obj, &length);
  2491. return __Pyx__PyBytes_AsDouble(obj, s, length);
  2492. }
  2493. return __Pyx_PyUnicode_AsDouble_WithSpaces(obj);
  2494. #else
  2495. return __Pyx_SlowPyString_AsDouble(obj);
  2496. #endif
  2497. }
  2498. /* pynumber_float.proto */
  2499. static CYTHON_INLINE PyObject* __Pyx__PyNumber_Float(PyObject* obj);
  2500. #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : __Pyx__PyNumber_Float(x))
  2501. /* PyFloatBinop.proto */
  2502. #if !CYTHON_COMPILING_IN_PYPY
  2503. static int __Pyx_PyFloat_BoolEqObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check);
  2504. #else
  2505. #define __Pyx_PyFloat_BoolEqObjC(op1, op2, floatval, inplace, zerodivision_check)\
  2506. __Pyx_PyObject_IsTrueAndDecref(PyObject_RichCompare(op1, op2, Py_EQ))
  2507. #endif
  2508. /* pow2.proto */
  2509. #define __Pyx_PyNumber_Power2(a, b) PyNumber_Power(a, b, Py_None)
  2510. /* PyLongBinop.proto */
  2511. #if !CYTHON_COMPILING_IN_PYPY
  2512. static CYTHON_INLINE PyObject* __Pyx_PyLong_SubtractCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
  2513. #else
  2514. #define __Pyx_PyLong_SubtractCObj(op1, op2, intval, inplace, zerodivision_check)\
  2515. (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
  2516. #endif
  2517. /* PyValueError_Check.proto */
  2518. #define __Pyx_PyExc_ValueError_Check(obj) __Pyx_TypeCheck(obj, PyExc_ValueError)
  2519. /* PyObjectVectorCallKwBuilder.proto */
  2520. CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
  2521. #if CYTHON_VECTORCALL
  2522. #if PY_VERSION_HEX >= 0x03090000
  2523. #define __Pyx_Object_Vectorcall_CallFromBuilder PyObject_Vectorcall
  2524. #else
  2525. #define __Pyx_Object_Vectorcall_CallFromBuilder _PyObject_Vectorcall
  2526. #endif
  2527. #define __Pyx_MakeVectorcallBuilderKwds(n) PyTuple_New(n)
  2528. static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n);
  2529. static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n);
  2530. #else
  2531. #define __Pyx_Object_Vectorcall_CallFromBuilder __Pyx_PyObject_FastCallDict
  2532. #define __Pyx_MakeVectorcallBuilderKwds(n) __Pyx_PyDict_NewPresized(n)
  2533. #define __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n) PyDict_SetItem(builder, key, value)
  2534. #define __Pyx_VectorcallBuilder_AddArgStr(key, value, builder, args, n) PyDict_SetItemString(builder, key, value)
  2535. #endif
  2536. /* PyObjectFastCallMethod.proto */
  2537. #if CYTHON_VECTORCALL && PY_VERSION_HEX >= 0x03090000
  2538. #define __Pyx_PyObject_FastCallMethod(name, args, nargsf) PyObject_VectorcallMethod(name, args, nargsf, NULL)
  2539. #else
  2540. static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf);
  2541. #endif
  2542. /* RaiseClosureNameError.proto */
  2543. static void __Pyx_RaiseClosureNameError(const char *varname);
  2544. /* PyMethodNew.proto (used by CythonFunctionShared) */
  2545. static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ);
  2546. /* PyVectorcallFastCallDict.proto (used by CythonFunctionShared) */
  2547. #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
  2548. static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw);
  2549. #endif
  2550. /* CythonFunctionShared.proto (used by CythonFunction) */
  2551. #define __Pyx_CyFunction_USED
  2552. #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
  2553. #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
  2554. #define __Pyx_CYFUNCTION_CCLASS 0x04
  2555. #define __Pyx_CYFUNCTION_COROUTINE 0x08
  2556. #define __Pyx_CyFunction_GetClosure(f)\
  2557. (((__pyx_CyFunctionObject *) (f))->func_closure)
  2558. #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  2559. #define __Pyx_CyFunction_GetClassObj(f)\
  2560. (((__pyx_CyFunctionObject *) (f))->func_classobj)
  2561. #else
  2562. #define __Pyx_CyFunction_GetClassObj(f)\
  2563. ((PyObject*) ((PyCMethodObject *) (f))->mm_class)
  2564. #endif
  2565. #define __Pyx_CyFunction_SetClassObj(f, classobj)\
  2566. __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj))
  2567. #define __Pyx_CyFunction_Defaults(type, f)\
  2568. ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
  2569. #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
  2570. ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
  2571. typedef struct {
  2572. #if CYTHON_COMPILING_IN_LIMITED_API
  2573. PyObject_HEAD
  2574. PyObject *func;
  2575. #elif PY_VERSION_HEX < 0x030900B1
  2576. PyCFunctionObject func;
  2577. #else
  2578. PyCMethodObject func;
  2579. #endif
  2580. #if CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL
  2581. __pyx_vectorcallfunc func_vectorcall;
  2582. #endif
  2583. #if CYTHON_COMPILING_IN_LIMITED_API
  2584. PyObject *func_weakreflist;
  2585. #endif
  2586. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  2587. PyObject *func_dict;
  2588. #endif
  2589. PyObject *func_name;
  2590. PyObject *func_qualname;
  2591. PyObject *func_doc;
  2592. PyObject *func_globals;
  2593. PyObject *func_code;
  2594. PyObject *func_closure;
  2595. #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  2596. PyObject *func_classobj;
  2597. #endif
  2598. PyObject *defaults;
  2599. int flags;
  2600. PyObject *defaults_tuple;
  2601. PyObject *defaults_kwdict;
  2602. PyObject *(*defaults_getter)(PyObject *);
  2603. PyObject *func_annotations;
  2604. PyObject *func_is_coroutine;
  2605. } __pyx_CyFunctionObject;
  2606. #undef __Pyx_CyOrPyCFunction_Check
  2607. #define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_mstate_global->__pyx_CyFunctionType)
  2608. #define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_mstate_global->__pyx_CyFunctionType, &PyCFunction_Type)
  2609. #define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_mstate_global->__pyx_CyFunctionType)
  2610. static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void));
  2611. #undef __Pyx_IsSameCFunction
  2612. #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc)
  2613. static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
  2614. int flags, PyObject* qualname,
  2615. PyObject *closure,
  2616. PyObject *module, PyObject *globals,
  2617. PyObject* code);
  2618. static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj);
  2619. static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func,
  2620. PyTypeObject *defaults_type);
  2621. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
  2622. PyObject *tuple);
  2623. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
  2624. PyObject *dict);
  2625. static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
  2626. PyObject *dict);
  2627. static int __pyx_CyFunction_init(PyObject *module);
  2628. #if CYTHON_METH_FASTCALL
  2629. static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
  2630. static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
  2631. static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
  2632. static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
  2633. #if CYTHON_COMPILING_IN_LIMITED_API
  2634. #define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall)
  2635. #else
  2636. #define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall)
  2637. #endif
  2638. #endif
  2639. /* CythonFunction.proto */
  2640. static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
  2641. int flags, PyObject* qualname,
  2642. PyObject *closure,
  2643. PyObject *module, PyObject *globals,
  2644. PyObject* code);
  2645. /* pyfrozenset_new.proto (used by PySetContains) */
  2646. static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it);
  2647. /* PySetContains.proto */
  2648. static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq);
  2649. /* PyTypeError_Check.proto */
  2650. #define __Pyx_PyExc_TypeError_Check(obj) __Pyx_TypeCheck(obj, PyExc_TypeError)
  2651. /* AllocateExtensionType.proto */
  2652. static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final);
  2653. /* CheckTypeForFreelists.proto */
  2654. #if CYTHON_USE_FREELISTS
  2655. #if CYTHON_USE_TYPE_SPECS
  2656. #define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t) == (expected_tp)))
  2657. #define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS Py_TPFLAGS_IS_ABSTRACT
  2658. #else
  2659. #define __PYX_CHECK_FINAL_TYPE_FOR_FREELISTS(t, expected_tp, expected_size) ((int) ((t)->tp_basicsize == (expected_size)))
  2660. #define __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)
  2661. #endif
  2662. #define __PYX_CHECK_TYPE_FOR_FREELISTS(t, expected_tp, expected_size)\
  2663. (__PYX_CHECK_FINAL_TYPE_FOR_FREELISTS((t), (expected_tp), (expected_size)) &\
  2664. (int) (!__Pyx_PyType_HasFeature((t), __PYX_CHECK_TYPE_FOR_FREELIST_FLAGS)))
  2665. #endif
  2666. /* PyObjectCallMethod0.proto (used by PyType_Ready) */
  2667. static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
  2668. /* ValidateBasesTuple.proto (used by PyType_Ready) */
  2669. #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
  2670. static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases);
  2671. #endif
  2672. /* PyType_Ready.proto */
  2673. CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t);
  2674. /* HasAttr.proto (used by ImportImpl) */
  2675. #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  2676. #define __Pyx_HasAttr(o, n) PyObject_HasAttrWithError(o, n)
  2677. #else
  2678. static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
  2679. #endif
  2680. /* ImportImpl.export */
  2681. static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level);
  2682. /* Import.proto */
  2683. static CYTHON_INLINE PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level);
  2684. /* ImportFrom.proto */
  2685. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
  2686. /* ListPack.proto */
  2687. static PyObject *__Pyx_PyList_Pack(Py_ssize_t n, ...);
  2688. /* CLineInTraceback.proto (used by AddTraceback) */
  2689. #if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
  2690. static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
  2691. #else
  2692. #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
  2693. #endif
  2694. /* CodeObjectCache.proto (used by AddTraceback) */
  2695. #if CYTHON_COMPILING_IN_LIMITED_API
  2696. typedef PyObject __Pyx_CachedCodeObjectType;
  2697. #else
  2698. typedef PyCodeObject __Pyx_CachedCodeObjectType;
  2699. #endif
  2700. typedef struct {
  2701. __Pyx_CachedCodeObjectType* code_object;
  2702. int code_line;
  2703. } __Pyx_CodeObjectCacheEntry;
  2704. struct __Pyx_CodeObjectCache {
  2705. int count;
  2706. int max_count;
  2707. __Pyx_CodeObjectCacheEntry* entries;
  2708. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  2709. __pyx_atomic_int_type accessor_count;
  2710. #endif
  2711. };
  2712. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
  2713. static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line);
  2714. static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object);
  2715. /* AddTraceback.proto */
  2716. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  2717. int py_line, const char *filename);
  2718. /* RealImag.proto */
  2719. #if CYTHON_CCOMPLEX
  2720. #ifdef __cplusplus
  2721. #define __Pyx_CREAL(z) ((z).real())
  2722. #define __Pyx_CIMAG(z) ((z).imag())
  2723. #else
  2724. #define __Pyx_CREAL(z) (__real__(z))
  2725. #define __Pyx_CIMAG(z) (__imag__(z))
  2726. #endif
  2727. #else
  2728. #define __Pyx_CREAL(z) ((z).real)
  2729. #define __Pyx_CIMAG(z) ((z).imag)
  2730. #endif
  2731. #if defined(__cplusplus) && CYTHON_CCOMPLEX\
  2732. && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
  2733. #define __Pyx_SET_CREAL(z,x) ((z).real(x))
  2734. #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
  2735. #else
  2736. #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
  2737. #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
  2738. #endif
  2739. /* Arithmetic.proto */
  2740. #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
  2741. #define __Pyx_c_eq_double(a, b) ((a)==(b))
  2742. #define __Pyx_c_sum_double(a, b) ((a)+(b))
  2743. #define __Pyx_c_diff_double(a, b) ((a)-(b))
  2744. #define __Pyx_c_prod_double(a, b) ((a)*(b))
  2745. #define __Pyx_c_quot_double(a, b) ((a)/(b))
  2746. #define __Pyx_c_neg_double(a) (-(a))
  2747. #ifdef __cplusplus
  2748. #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
  2749. #define __Pyx_c_conj_double(z) (::std::conj(z))
  2750. #if 1
  2751. #define __Pyx_c_abs_double(z) (::std::abs(z))
  2752. #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
  2753. #endif
  2754. #else
  2755. #define __Pyx_c_is_zero_double(z) ((z)==0)
  2756. #define __Pyx_c_conj_double(z) (conj(z))
  2757. #if 1
  2758. #define __Pyx_c_abs_double(z) (cabs(z))
  2759. #define __Pyx_c_pow_double(a, b) (cpow(a, b))
  2760. #endif
  2761. #endif
  2762. #else
  2763. static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
  2764. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
  2765. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
  2766. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
  2767. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
  2768. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
  2769. static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
  2770. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
  2771. #if 1
  2772. static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
  2773. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
  2774. #endif
  2775. #endif
  2776. /* FromPy.proto */
  2777. static __pyx_t_double_complex __Pyx_PyComplex_As___pyx_t_double_complex(PyObject*);
  2778. /* ToPy.proto */
  2779. #define __pyx_PyComplex_FromComplex(z)\
  2780. PyComplex_FromDoubles((double)__Pyx_CREAL(z),\
  2781. (double)__Pyx_CIMAG(z))
  2782. /* GCCDiagnostics.proto */
  2783. #if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
  2784. #define __Pyx_HAS_GCC_DIAGNOSTIC
  2785. #endif
  2786. /* CIntToPy.proto */
  2787. static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value);
  2788. /* FormatTypeName.proto */
  2789. #if CYTHON_COMPILING_IN_LIMITED_API
  2790. typedef PyObject *__Pyx_TypeName;
  2791. #define __Pyx_FMT_TYPENAME "%U"
  2792. #define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
  2793. #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  2794. #define __Pyx_PyType_GetFullyQualifiedName PyType_GetFullyQualifiedName
  2795. #else
  2796. static __Pyx_TypeName __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp);
  2797. #endif
  2798. #else // !LIMITED_API
  2799. typedef const char *__Pyx_TypeName;
  2800. #define __Pyx_FMT_TYPENAME "%.200s"
  2801. #define __Pyx_PyType_GetFullyQualifiedName(tp) ((tp)->tp_name)
  2802. #define __Pyx_DECREF_TypeName(obj)
  2803. #endif
  2804. /* CIntFromPy.proto */
  2805. static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *);
  2806. /* CIntFromPy.proto */
  2807. static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *);
  2808. /* FastTypeChecks.proto */
  2809. #if CYTHON_COMPILING_IN_CPYTHON
  2810. #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
  2811. #define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
  2812. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
  2813. static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b);
  2814. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
  2815. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
  2816. #else
  2817. #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
  2818. #define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
  2819. #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
  2820. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2) {
  2821. return PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2);
  2822. }
  2823. #endif
  2824. #define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2)
  2825. #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
  2826. #ifdef PyExceptionInstance_Check
  2827. #define __Pyx_PyBaseException_Check(obj) PyExceptionInstance_Check(obj)
  2828. #else
  2829. #define __Pyx_PyBaseException_Check(obj) __Pyx_TypeCheck(obj, PyExc_BaseException)
  2830. #endif
  2831. /* GetRuntimeVersion.proto */
  2832. #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
  2833. static unsigned long __Pyx_cached_runtime_version = 0;
  2834. static void __Pyx_init_runtime_version(void);
  2835. #else
  2836. #define __Pyx_init_runtime_version()
  2837. #endif
  2838. static unsigned long __Pyx_get_runtime_version(void);
  2839. /* CheckBinaryVersion.proto */
  2840. static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer);
  2841. /* DecompressString.proto */
  2842. static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo);
  2843. /* MultiPhaseInitModuleState.proto */
  2844. #if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
  2845. static PyObject *__Pyx_State_FindModule(void*);
  2846. static int __Pyx_State_AddModule(PyObject* module, void*);
  2847. static int __Pyx_State_RemoveModule(void*);
  2848. #elif CYTHON_USE_MODULE_STATE
  2849. #define __Pyx_State_FindModule PyState_FindModule
  2850. #define __Pyx_State_AddModule PyState_AddModule
  2851. #define __Pyx_State_RemoveModule PyState_RemoveModule
  2852. #endif
  2853. /* #### Code section: module_declarations ### */
  2854. /* CythonABIVersion.proto */
  2855. #if CYTHON_COMPILING_IN_LIMITED_API
  2856. #if CYTHON_METH_FASTCALL
  2857. #define __PYX_FASTCALL_ABI_SUFFIX "_fastcall"
  2858. #else
  2859. #define __PYX_FASTCALL_ABI_SUFFIX
  2860. #endif
  2861. #define __PYX_LIMITED_ABI_SUFFIX "limited" __PYX_FASTCALL_ABI_SUFFIX __PYX_AM_SEND_ABI_SUFFIX
  2862. #else
  2863. #define __PYX_LIMITED_ABI_SUFFIX
  2864. #endif
  2865. #if __PYX_HAS_PY_AM_SEND == 1
  2866. #define __PYX_AM_SEND_ABI_SUFFIX
  2867. #elif __PYX_HAS_PY_AM_SEND == 2
  2868. #define __PYX_AM_SEND_ABI_SUFFIX "amsendbackport"
  2869. #else
  2870. #define __PYX_AM_SEND_ABI_SUFFIX "noamsend"
  2871. #endif
  2872. #ifndef __PYX_MONITORING_ABI_SUFFIX
  2873. #define __PYX_MONITORING_ABI_SUFFIX
  2874. #endif
  2875. #if CYTHON_USE_TP_FINALIZE
  2876. #define __PYX_TP_FINALIZE_ABI_SUFFIX
  2877. #else
  2878. #define __PYX_TP_FINALIZE_ABI_SUFFIX "nofinalize"
  2879. #endif
  2880. #if CYTHON_USE_FREELISTS || !defined(__Pyx_AsyncGen_USED)
  2881. #define __PYX_FREELISTS_ABI_SUFFIX
  2882. #else
  2883. #define __PYX_FREELISTS_ABI_SUFFIX "nofreelists"
  2884. #endif
  2885. #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
  2886. #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
  2887. #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."
  2888. /* Module declarations from "cython" */
  2889. /* Module declarations from "fontTools.misc.bezierTools" */
  2890. static CYTHON_INLINE double __pyx_f_9fontTools_4misc_11bezierTools__dot(__pyx_t_double_complex, __pyx_t_double_complex); /*proto*/
  2891. static CYTHON_INLINE double __pyx_f_9fontTools_4misc_11bezierTools__intSecAtan(double); /*proto*/
  2892. 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*/
  2893. 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*/
  2894. /* #### Code section: typeinfo ### */
  2895. /* #### Code section: before_global_var ### */
  2896. #define __Pyx_MODULE_NAME "fontTools.misc.bezierTools"
  2897. extern int __pyx_module_is_main_fontTools__misc__bezierTools;
  2898. int __pyx_module_is_main_fontTools__misc__bezierTools = 0;
  2899. /* Implementation of "fontTools.misc.bezierTools" */
  2900. /* #### Code section: global_var ### */
  2901. static PyObject *__pyx_builtin_round;
  2902. static PyObject *__pyx_builtin_print;
  2903. /* #### Code section: string_decls ### */
  2904. static const char __pyx_k_fontTools_misc_bezierTools_py_to[] = "fontTools.misc.bezierTools.py -- tools for working with Bezier path segments.\n";
  2905. /* #### Code section: decls ### */
  2906. 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 */
  2907. 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 */
  2908. 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 */
  2909. 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 */
  2910. 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 */
  2911. 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 */
  2912. 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 */
  2913. 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 */
  2914. 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 */
  2915. 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 */
  2916. 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 */
  2917. 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 */
  2918. 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 */
  2919. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_14splitQuadratic_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
  2920. 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 */
  2921. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_10splitCubic_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
  2922. 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 */
  2923. 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 */
  2924. 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 */
  2925. 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 */
  2926. 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 */
  2927. 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 */
  2928. 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 */
  2929. 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 */
  2930. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_96__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
  2931. 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 */
  2932. 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 */
  2933. 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 */
  2934. 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 */
  2935. 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 */
  2936. 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 */
  2937. 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 */
  2938. 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 */
  2939. 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 */
  2940. 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 */
  2941. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_66segmentPointAtT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_seg, PyObject *__pyx_v_t); /* proto */
  2942. 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 */
  2943. 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 */
  2944. 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 */
  2945. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_74_alignment_transformation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_segment); /* proto */
  2946. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_27_curve_line_intersections_t_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
  2947. 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 */
  2948. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_78curveLineIntersections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_curve, PyObject *__pyx_v_line); /* proto */
  2949. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_80_curve_bounds(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_c); /* proto */
  2950. 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 */
  2951. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_midpoint(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_r); /* proto */
  2952. static PyObject *__pyx_lambda_funcdef_lambda3(PyObject *__pyx_self, PyObject *__pyx_v_ts); /* proto */
  2953. 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 */
  2954. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_12_is_linelike_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
  2955. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_86_is_linelike(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_segment); /* proto */
  2956. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_88curveCurveIntersections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_curve1, PyObject *__pyx_v_curve2); /* proto */
  2957. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_90segmentSegmentIntersections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_seg1, PyObject *__pyx_v_seg2); /* proto */
  2958. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_12_segmentrepr_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
  2959. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_92_segmentrepr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj); /* proto */
  2960. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_94printSegments(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_segments); /* proto */
  2961. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_defaults(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2962. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2963. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2964. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2965. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2966. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2967. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2968. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2969. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2970. /* #### Code section: late_includes ### */
  2971. /* #### Code section: module_state ### */
  2972. /* SmallCodeConfig */
  2973. #ifndef CYTHON_SMALL_CODE
  2974. #if defined(__clang__)
  2975. #define CYTHON_SMALL_CODE
  2976. #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
  2977. #define CYTHON_SMALL_CODE __attribute__((cold))
  2978. #else
  2979. #define CYTHON_SMALL_CODE
  2980. #endif
  2981. #endif
  2982. typedef struct {
  2983. PyObject *__pyx_d;
  2984. PyObject *__pyx_b;
  2985. PyObject *__pyx_cython_runtime;
  2986. PyObject *__pyx_empty_tuple;
  2987. PyObject *__pyx_empty_bytes;
  2988. PyObject *__pyx_empty_unicode;
  2989. PyObject *__pyx_type_9fontTools_4misc_11bezierTools___pyx_defaults;
  2990. PyObject *__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr;
  2991. PyObject *__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr;
  2992. PyObject *__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC;
  2993. PyObject *__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC;
  2994. PyObject *__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr;
  2995. PyObject *__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t;
  2996. PyObject *__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr;
  2997. PyObject *__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr;
  2998. PyTypeObject *__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_defaults;
  2999. PyTypeObject *__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr;
  3000. PyTypeObject *__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr;
  3001. PyTypeObject *__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC;
  3002. PyTypeObject *__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC;
  3003. PyTypeObject *__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr;
  3004. PyTypeObject *__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t;
  3005. PyTypeObject *__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr;
  3006. PyTypeObject *__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr;
  3007. __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items;
  3008. __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop;
  3009. __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_values;
  3010. PyObject *__pyx_slice[2];
  3011. PyObject *__pyx_tuple[4];
  3012. PyObject *__pyx_codeobj_tab[54];
  3013. PyObject *__pyx_string_tab[387];
  3014. PyObject *__pyx_number_tab[21];
  3015. /* #### Code section: module_state_contents ### */
  3016. /* CommonTypesMetaclass.module_state_decls */
  3017. PyTypeObject *__pyx_CommonTypesMetaclassType;
  3018. /* IterNextPlain.module_state_decls */
  3019. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  3020. PyObject *__Pyx_GetBuiltinNext_LimitedAPI_cache;
  3021. #endif
  3022. /* Generator.module_state_decls */
  3023. PyTypeObject *__pyx_GeneratorType;
  3024. /* CachedMethodType.module_state_decls */
  3025. #if CYTHON_COMPILING_IN_LIMITED_API
  3026. PyObject *__Pyx_CachedMethodType;
  3027. #endif
  3028. /* CythonFunctionShared.module_state_decls */
  3029. PyTypeObject *__pyx_CyFunctionType;
  3030. #if CYTHON_USE_FREELISTS
  3031. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr *__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr[8];
  3032. int __pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr;
  3033. #endif
  3034. #if CYTHON_USE_FREELISTS
  3035. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr *__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr[8];
  3036. int __pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr;
  3037. #endif
  3038. #if CYTHON_USE_FREELISTS
  3039. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC *__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC[8];
  3040. int __pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC;
  3041. #endif
  3042. #if CYTHON_USE_FREELISTS
  3043. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC *__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC[8];
  3044. int __pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC;
  3045. #endif
  3046. #if CYTHON_USE_FREELISTS
  3047. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr *__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr[8];
  3048. int __pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr;
  3049. #endif
  3050. #if CYTHON_USE_FREELISTS
  3051. 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];
  3052. int __pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t;
  3053. #endif
  3054. #if CYTHON_USE_FREELISTS
  3055. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr *__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr[8];
  3056. int __pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr;
  3057. #endif
  3058. #if CYTHON_USE_FREELISTS
  3059. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr *__pyx_freelist_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr[8];
  3060. int __pyx_freecount_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr;
  3061. #endif
  3062. /* CodeObjectCache.module_state_decls */
  3063. struct __Pyx_CodeObjectCache __pyx_code_cache;
  3064. /* #### Code section: module_state_end ### */
  3065. } __pyx_mstatetype;
  3066. #if CYTHON_USE_MODULE_STATE
  3067. #ifdef __cplusplus
  3068. namespace {
  3069. extern struct PyModuleDef __pyx_moduledef;
  3070. } /* anonymous namespace */
  3071. #else
  3072. static struct PyModuleDef __pyx_moduledef;
  3073. #endif
  3074. #define __pyx_mstate_global (__Pyx_PyModule_GetState(__Pyx_State_FindModule(&__pyx_moduledef)))
  3075. #define __pyx_m (__Pyx_State_FindModule(&__pyx_moduledef))
  3076. #else
  3077. static __pyx_mstatetype __pyx_mstate_global_static =
  3078. #ifdef __cplusplus
  3079. {};
  3080. #else
  3081. {0};
  3082. #endif
  3083. static __pyx_mstatetype * const __pyx_mstate_global = &__pyx_mstate_global_static;
  3084. #endif
  3085. /* #### Code section: constant_name_defines ### */
  3086. #define __pyx_kp_u_ __pyx_string_tab[0]
  3087. #define __pyx_kp_u_Approximates_the_arc_length_for __pyx_string_tab[1]
  3088. #define __pyx_kp_u_Calculates_the_arc_length_for_a __pyx_string_tab[2]
  3089. #define __pyx_kp_u_Calculates_the_bounding_rectangl __pyx_string_tab[3]
  3090. #define __pyx_kp_u_Calculates_the_bounding_rectangl_2 __pyx_string_tab[4]
  3091. #define __pyx_kp_u_Couldn_t_work_out_which_intersec __pyx_string_tab[5]
  3092. #define __pyx_kp_u_Finds_intersections_between_a_cu __pyx_string_tab[6]
  3093. #define __pyx_kp_u_Finds_intersections_between_a_cu_2 __pyx_string_tab[7]
  3094. #define __pyx_kp_u_Finds_intersections_between_two __pyx_string_tab[8]
  3095. #define __pyx_kp_u_Finds_intersections_between_two_2 __pyx_string_tab[9]
  3096. #define __pyx_kp_u_Lib_fontTools_misc_bezierTools_p __pyx_string_tab[10]
  3097. #define __pyx_kp_u_Solve_a_cubic_equation_Solves_a __pyx_string_tab[11]
  3098. #define __pyx_kp_u_Split_a_cubic_Bezier_curve_at_a __pyx_string_tab[12]
  3099. #define __pyx_kp_u_Split_a_cubic_Bezier_curve_at_on __pyx_string_tab[13]
  3100. #define __pyx_kp_u_Split_a_line_at_a_given_coordina __pyx_string_tab[14]
  3101. #define __pyx_kp_u_Split_a_quadratic_Bezier_curve_a __pyx_string_tab[15]
  3102. #define __pyx_kp_u_Split_a_quadratic_Bezier_curve_a_2 __pyx_string_tab[16]
  3103. #define __pyx_kp_u_Unknown_curve_degree __pyx_string_tab[17]
  3104. #define __pyx_kp_u__2 __pyx_string_tab[18]
  3105. #define __pyx_kp_u__3 __pyx_string_tab[19]
  3106. #define __pyx_kp_u_approximateCubicArcLength_line_3 __pyx_string_tab[20]
  3107. #define __pyx_kp_u_calcCubicBounds_line_412 __pyx_string_tab[21]
  3108. #define __pyx_kp_u_calcQuadraticArcLength_line_151 __pyx_string_tab[22]
  3109. #define __pyx_kp_u_calcQuadraticBounds_line_298 __pyx_string_tab[23]
  3110. #define __pyx_kp_u_curveCurveIntersections_line_138 __pyx_string_tab[24]
  3111. #define __pyx_kp_u_curveLineIntersections_line_1255 __pyx_string_tab[25]
  3112. #define __pyx_kp_u_disable __pyx_string_tab[26]
  3113. #define __pyx_kp_u_enable __pyx_string_tab[27]
  3114. #define __pyx_kp_u_g __pyx_string_tab[28]
  3115. #define __pyx_kp_u_gc __pyx_string_tab[29]
  3116. #define __pyx_kp_u_isenabled __pyx_string_tab[30]
  3117. #define __pyx_kp_u_lineLineIntersections_line_1154 __pyx_string_tab[31]
  3118. #define __pyx_kp_u_s_2 __pyx_string_tab[32]
  3119. #define __pyx_kp_u_segmentSegmentIntersections_line __pyx_string_tab[33]
  3120. #define __pyx_kp_u_segmentrepr_1_2_3_2_3_4_0_1_2 __pyx_string_tab[34]
  3121. #define __pyx_kp_u_segmentrepr_line_1475 __pyx_string_tab[35]
  3122. #define __pyx_kp_u_solveCubic_line_848 __pyx_string_tab[36]
  3123. #define __pyx_kp_u_splitCubicAtT_line_613 __pyx_string_tab[37]
  3124. #define __pyx_kp_u_splitCubic_line_552 __pyx_string_tab[38]
  3125. #define __pyx_kp_u_splitLine_line_450 __pyx_string_tab[39]
  3126. #define __pyx_kp_u_splitQuadraticAtT_line_589 __pyx_string_tab[40]
  3127. #define __pyx_kp_u_splitQuadratic_line_507 __pyx_string_tab[41]
  3128. #define __pyx_n_u_1_t __pyx_string_tab[42]
  3129. #define __pyx_n_u_1_t_2 __pyx_string_tab[43]
  3130. #define __pyx_n_u_2_t_1_t __pyx_string_tab[44]
  3131. #define __pyx_n_u_COMPILED __pyx_string_tab[45]
  3132. #define __pyx_n_u_DD __pyx_string_tab[46]
  3133. #define __pyx_n_u_EPSILON __pyx_string_tab[47]
  3134. #define __pyx_n_u_Identity __pyx_string_tab[48]
  3135. #define __pyx_n_u_Intersection __pyx_string_tab[49]
  3136. #define __pyx_n_u_Len __pyx_string_tab[50]
  3137. #define __pyx_n_u_Pyx_PyDict_NextRef __pyx_string_tab[51]
  3138. #define __pyx_n_u_Q __pyx_string_tab[52]
  3139. #define __pyx_n_u_Q3 __pyx_string_tab[53]
  3140. #define __pyx_n_u_R __pyx_string_tab[54]
  3141. #define __pyx_n_u_R2 __pyx_string_tab[55]
  3142. #define __pyx_n_u_R2_Q3 __pyx_string_tab[56]
  3143. #define __pyx_n_u__6 __pyx_string_tab[57]
  3144. #define __pyx_n_u_a __pyx_string_tab[58]
  3145. #define __pyx_n_u_a1 __pyx_string_tab[59]
  3146. #define __pyx_n_u_a1_3 __pyx_string_tab[60]
  3147. #define __pyx_n_u_a1x __pyx_string_tab[61]
  3148. #define __pyx_n_u_a1y __pyx_string_tab[62]
  3149. #define __pyx_n_u_a2 __pyx_string_tab[63]
  3150. #define __pyx_n_u_a3 __pyx_string_tab[64]
  3151. #define __pyx_n_u_acos __pyx_string_tab[65]
  3152. #define __pyx_n_u_aligned_curve __pyx_string_tab[66]
  3153. #define __pyx_n_u_alignment_transformation __pyx_string_tab[67]
  3154. #define __pyx_n_u_all __pyx_string_tab[68]
  3155. #define __pyx_n_u_angle __pyx_string_tab[69]
  3156. #define __pyx_n_u_append __pyx_string_tab[70]
  3157. #define __pyx_n_u_approximateCubicArcLength __pyx_string_tab[71]
  3158. #define __pyx_n_u_approximateCubicArcLengthC __pyx_string_tab[72]
  3159. #define __pyx_n_u_approximateQuadraticArcLength __pyx_string_tab[73]
  3160. #define __pyx_n_u_approximateQuadraticArcLengthC __pyx_string_tab[74]
  3161. #define __pyx_n_u_arch __pyx_string_tab[75]
  3162. #define __pyx_n_u_asinh __pyx_string_tab[76]
  3163. #define __pyx_n_u_asyncio_coroutines __pyx_string_tab[77]
  3164. #define __pyx_n_u_atan2 __pyx_string_tab[78]
  3165. #define __pyx_n_u_ax __pyx_string_tab[79]
  3166. #define __pyx_n_u_ax2 __pyx_string_tab[80]
  3167. #define __pyx_n_u_ax3 __pyx_string_tab[81]
  3168. #define __pyx_n_u_ay __pyx_string_tab[82]
  3169. #define __pyx_n_u_ay2 __pyx_string_tab[83]
  3170. #define __pyx_n_u_ay3 __pyx_string_tab[84]
  3171. #define __pyx_n_u_b __pyx_string_tab[85]
  3172. #define __pyx_n_u_b1 __pyx_string_tab[86]
  3173. #define __pyx_n_u_b1x __pyx_string_tab[87]
  3174. #define __pyx_n_u_b1y __pyx_string_tab[88]
  3175. #define __pyx_n_u_both_points_are_on_same_side_of __pyx_string_tab[89]
  3176. #define __pyx_n_u_bounds1 __pyx_string_tab[90]
  3177. #define __pyx_n_u_bounds2 __pyx_string_tab[91]
  3178. #define __pyx_n_u_box __pyx_string_tab[92]
  3179. #define __pyx_n_u_bx __pyx_string_tab[93]
  3180. #define __pyx_n_u_bx2 __pyx_string_tab[94]
  3181. #define __pyx_n_u_by __pyx_string_tab[95]
  3182. #define __pyx_n_u_by2 __pyx_string_tab[96]
  3183. #define __pyx_n_u_c __pyx_string_tab[97]
  3184. #define __pyx_n_u_c1 __pyx_string_tab[98]
  3185. #define __pyx_n_u_c11 __pyx_string_tab[99]
  3186. #define __pyx_n_u_c11_range __pyx_string_tab[100]
  3187. #define __pyx_n_u_c12 __pyx_string_tab[101]
  3188. #define __pyx_n_u_c12_range __pyx_string_tab[102]
  3189. #define __pyx_n_u_c1x __pyx_string_tab[103]
  3190. #define __pyx_n_u_c1y __pyx_string_tab[104]
  3191. #define __pyx_n_u_c21 __pyx_string_tab[105]
  3192. #define __pyx_n_u_c21_range __pyx_string_tab[106]
  3193. #define __pyx_n_u_c22 __pyx_string_tab[107]
  3194. #define __pyx_n_u_c22_range __pyx_string_tab[108]
  3195. #define __pyx_n_u_calcBounds __pyx_string_tab[109]
  3196. #define __pyx_n_u_calcCubicArcLength __pyx_string_tab[110]
  3197. #define __pyx_n_u_calcCubicArcLengthC __pyx_string_tab[111]
  3198. #define __pyx_n_u_calcCubicArcLengthCRecurse __pyx_string_tab[112]
  3199. #define __pyx_n_u_calcCubicBounds __pyx_string_tab[113]
  3200. #define __pyx_n_u_calcCubicParameters __pyx_string_tab[114]
  3201. #define __pyx_n_u_calcCubicPoints __pyx_string_tab[115]
  3202. #define __pyx_n_u_calcQuadraticArcLength __pyx_string_tab[116]
  3203. #define __pyx_n_u_calcQuadraticArcLengthC __pyx_string_tab[117]
  3204. #define __pyx_n_u_calcQuadraticBounds __pyx_string_tab[118]
  3205. #define __pyx_n_u_calcQuadraticParameters __pyx_string_tab[119]
  3206. #define __pyx_n_u_calcQuadraticPoints __pyx_string_tab[120]
  3207. #define __pyx_n_u_class_getitem __pyx_string_tab[121]
  3208. #define __pyx_n_u_cline_in_traceback __pyx_string_tab[122]
  3209. #define __pyx_n_u_close __pyx_string_tab[123]
  3210. #define __pyx_n_u_collections __pyx_string_tab[124]
  3211. #define __pyx_n_u_cos __pyx_string_tab[125]
  3212. #define __pyx_n_u_cubicPointAtT __pyx_string_tab[126]
  3213. #define __pyx_n_u_cubicPointAtTC __pyx_string_tab[127]
  3214. #define __pyx_n_u_curve __pyx_string_tab[128]
  3215. #define __pyx_n_u_curve1 __pyx_string_tab[129]
  3216. #define __pyx_n_u_curve2 __pyx_string_tab[130]
  3217. #define __pyx_n_u_curveCurveIntersections __pyx_string_tab[131]
  3218. #define __pyx_n_u_curveLineIntersections __pyx_string_tab[132]
  3219. #define __pyx_n_u_curve_bounds __pyx_string_tab[133]
  3220. #define __pyx_n_u_curve_curve_intersections_t __pyx_string_tab[134]
  3221. #define __pyx_n_u_curve_curve_intersections_t_loc __pyx_string_tab[135]
  3222. #define __pyx_n_u_curve_curve_intersections_t_loc_2 __pyx_string_tab[136]
  3223. #define __pyx_n_u_curve_line_intersections_t __pyx_string_tab[137]
  3224. #define __pyx_n_u_curve_line_intersections_t_loca __pyx_string_tab[138]
  3225. #define __pyx_n_u_cx __pyx_string_tab[139]
  3226. #define __pyx_n_u_cy __pyx_string_tab[140]
  3227. #define __pyx_n_u_d __pyx_string_tab[141]
  3228. #define __pyx_n_u_d0 __pyx_string_tab[142]
  3229. #define __pyx_n_u_d1 __pyx_string_tab[143]
  3230. #define __pyx_n_u_d1x __pyx_string_tab[144]
  3231. #define __pyx_n_u_d1y __pyx_string_tab[145]
  3232. #define __pyx_n_u_delta __pyx_string_tab[146]
  3233. #define __pyx_n_u_delta_2 __pyx_string_tab[147]
  3234. #define __pyx_n_u_delta_3 __pyx_string_tab[148]
  3235. #define __pyx_n_u_deriv3 __pyx_string_tab[149]
  3236. #define __pyx_n_u_doctest __pyx_string_tab[150]
  3237. #define __pyx_n_u_dx __pyx_string_tab[151]
  3238. #define __pyx_n_u_dy __pyx_string_tab[152]
  3239. #define __pyx_n_u_e __pyx_string_tab[153]
  3240. #define __pyx_n_u_e1 __pyx_string_tab[154]
  3241. #define __pyx_n_u_e1x __pyx_string_tab[155]
  3242. #define __pyx_n_u_e1y __pyx_string_tab[156]
  3243. #define __pyx_n_u_e2 __pyx_string_tab[157]
  3244. #define __pyx_n_u_e2x __pyx_string_tab[158]
  3245. #define __pyx_n_u_e2y __pyx_string_tab[159]
  3246. #define __pyx_n_u_end __pyx_string_tab[160]
  3247. #define __pyx_n_u_epsilon __pyx_string_tab[161]
  3248. #define __pyx_n_u_epsilonDigits __pyx_string_tab[162]
  3249. #define __pyx_n_u_ex __pyx_string_tab[163]
  3250. #define __pyx_n_u_exit __pyx_string_tab[164]
  3251. #define __pyx_n_u_ey __pyx_string_tab[165]
  3252. #define __pyx_n_u_failed __pyx_string_tab[166]
  3253. #define __pyx_n_u_fontTools_misc_arrayTools __pyx_string_tab[167]
  3254. #define __pyx_n_u_fontTools_misc_bezierTools __pyx_string_tab[168]
  3255. #define __pyx_n_u_fontTools_misc_transform __pyx_string_tab[169]
  3256. #define __pyx_n_u_found __pyx_string_tab[170]
  3257. #define __pyx_n_u_func __pyx_string_tab[171]
  3258. #define __pyx_n_u_genexpr __pyx_string_tab[172]
  3259. #define __pyx_n_u_hits __pyx_string_tab[173]
  3260. #define __pyx_n_u_i __pyx_string_tab[174]
  3261. #define __pyx_n_u_insert __pyx_string_tab[175]
  3262. #define __pyx_n_u_intersection_ts __pyx_string_tab[176]
  3263. #define __pyx_n_u_intersections __pyx_string_tab[177]
  3264. #define __pyx_n_u_intersects __pyx_string_tab[178]
  3265. #define __pyx_n_u_isHorizontal __pyx_string_tab[179]
  3266. #define __pyx_n_u_is_coroutine __pyx_string_tab[180]
  3267. #define __pyx_n_u_is_linelike __pyx_string_tab[181]
  3268. #define __pyx_n_u_is_linelike_locals_genexpr __pyx_string_tab[182]
  3269. #define __pyx_n_u_isclose __pyx_string_tab[183]
  3270. #define __pyx_n_u_it __pyx_string_tab[184]
  3271. #define __pyx_n_u_items __pyx_string_tab[185]
  3272. #define __pyx_n_u_key __pyx_string_tab[186]
  3273. #define __pyx_n_u_lambda __pyx_string_tab[187]
  3274. #define __pyx_n_u_line __pyx_string_tab[188]
  3275. #define __pyx_n_u_line1 __pyx_string_tab[189]
  3276. #define __pyx_n_u_line2 __pyx_string_tab[190]
  3277. #define __pyx_n_u_lineLineIntersections __pyx_string_tab[191]
  3278. #define __pyx_n_u_linePointAtT __pyx_string_tab[192]
  3279. #define __pyx_n_u_line_t __pyx_string_tab[193]
  3280. #define __pyx_n_u_line_t_of_pt __pyx_string_tab[194]
  3281. #define __pyx_n_u_main __pyx_string_tab[195]
  3282. #define __pyx_n_u_math __pyx_string_tab[196]
  3283. #define __pyx_n_u_maybeline __pyx_string_tab[197]
  3284. #define __pyx_n_u_mid __pyx_string_tab[198]
  3285. #define __pyx_n_u_midPt __pyx_string_tab[199]
  3286. #define __pyx_n_u_midpoint __pyx_string_tab[200]
  3287. #define __pyx_n_u_module __pyx_string_tab[201]
  3288. #define __pyx_n_u_mult __pyx_string_tab[202]
  3289. #define __pyx_n_u_n __pyx_string_tab[203]
  3290. #define __pyx_n_u_name __pyx_string_tab[204]
  3291. #define __pyx_n_u_namedtuple __pyx_string_tab[205]
  3292. #define __pyx_n_u_next __pyx_string_tab[206]
  3293. #define __pyx_n_u_obj __pyx_string_tab[207]
  3294. #define __pyx_n_u_off1 __pyx_string_tab[208]
  3295. #define __pyx_n_u_off2 __pyx_string_tab[209]
  3296. #define __pyx_n_u_one __pyx_string_tab[210]
  3297. #define __pyx_n_u_origDist __pyx_string_tab[211]
  3298. #define __pyx_n_u_origin __pyx_string_tab[212]
  3299. #define __pyx_n_u_p __pyx_string_tab[213]
  3300. #define __pyx_n_u_p0 __pyx_string_tab[214]
  3301. #define __pyx_n_u_p1 __pyx_string_tab[215]
  3302. #define __pyx_n_u_p2 __pyx_string_tab[216]
  3303. #define __pyx_n_u_p3 __pyx_string_tab[217]
  3304. #define __pyx_n_u_pi __pyx_string_tab[218]
  3305. #define __pyx_n_u_pointAtT __pyx_string_tab[219]
  3306. #define __pyx_n_u_pointFinder __pyx_string_tab[220]
  3307. #define __pyx_n_u_points __pyx_string_tab[221]
  3308. #define __pyx_n_u_pop __pyx_string_tab[222]
  3309. #define __pyx_n_u_precision __pyx_string_tab[223]
  3310. #define __pyx_n_u_print __pyx_string_tab[224]
  3311. #define __pyx_n_u_printSegments __pyx_string_tab[225]
  3312. #define __pyx_n_u_pt __pyx_string_tab[226]
  3313. #define __pyx_n_u_pt1 __pyx_string_tab[227]
  3314. #define __pyx_n_u_pt1x __pyx_string_tab[228]
  3315. #define __pyx_n_u_pt1y __pyx_string_tab[229]
  3316. #define __pyx_n_u_pt2 __pyx_string_tab[230]
  3317. #define __pyx_n_u_pt2x __pyx_string_tab[231]
  3318. #define __pyx_n_u_pt2y __pyx_string_tab[232]
  3319. #define __pyx_n_u_pt3 __pyx_string_tab[233]
  3320. #define __pyx_n_u_pt4 __pyx_string_tab[234]
  3321. #define __pyx_n_u_px __pyx_string_tab[235]
  3322. #define __pyx_n_u_py __pyx_string_tab[236]
  3323. #define __pyx_n_u_quadraticPointAtT __pyx_string_tab[237]
  3324. #define __pyx_n_u_qualname __pyx_string_tab[238]
  3325. #define __pyx_n_u_r __pyx_string_tab[239]
  3326. #define __pyx_n_u_rDD __pyx_string_tab[240]
  3327. #define __pyx_n_u_rQ2 __pyx_string_tab[241]
  3328. #define __pyx_n_u_range1 __pyx_string_tab[242]
  3329. #define __pyx_n_u_range2 __pyx_string_tab[243]
  3330. #define __pyx_n_u_rectArea __pyx_string_tab[244]
  3331. #define __pyx_n_u_roots __pyx_string_tab[245]
  3332. #define __pyx_n_u_rotate __pyx_string_tab[246]
  3333. #define __pyx_n_u_round __pyx_string_tab[247]
  3334. #define __pyx_n_u_s __pyx_string_tab[248]
  3335. #define __pyx_n_u_s1 __pyx_string_tab[249]
  3336. #define __pyx_n_u_s1x __pyx_string_tab[250]
  3337. #define __pyx_n_u_s1y __pyx_string_tab[251]
  3338. #define __pyx_n_u_s2 __pyx_string_tab[252]
  3339. #define __pyx_n_u_s2x __pyx_string_tab[253]
  3340. #define __pyx_n_u_s2y __pyx_string_tab[254]
  3341. #define __pyx_n_u_scale __pyx_string_tab[255]
  3342. #define __pyx_n_u_sectRect __pyx_string_tab[256]
  3343. #define __pyx_n_u_seen __pyx_string_tab[257]
  3344. #define __pyx_n_u_seg __pyx_string_tab[258]
  3345. #define __pyx_n_u_seg1 __pyx_string_tab[259]
  3346. #define __pyx_n_u_seg2 __pyx_string_tab[260]
  3347. #define __pyx_n_u_segment __pyx_string_tab[261]
  3348. #define __pyx_n_u_segmentPointAtT __pyx_string_tab[262]
  3349. #define __pyx_n_u_segmentSegmentIntersections __pyx_string_tab[263]
  3350. #define __pyx_n_u_segmentrepr __pyx_string_tab[264]
  3351. #define __pyx_n_u_segmentrepr_locals_genexpr __pyx_string_tab[265]
  3352. #define __pyx_n_u_segments __pyx_string_tab[266]
  3353. #define __pyx_n_u_send __pyx_string_tab[267]
  3354. #define __pyx_n_u_set_name __pyx_string_tab[268]
  3355. #define __pyx_n_u_setdefault __pyx_string_tab[269]
  3356. #define __pyx_n_u_slope12 __pyx_string_tab[270]
  3357. #define __pyx_n_u_slope34 __pyx_string_tab[271]
  3358. #define __pyx_n_u_solutions __pyx_string_tab[272]
  3359. #define __pyx_n_u_solveCubic __pyx_string_tab[273]
  3360. #define __pyx_n_u_solveQuadratic __pyx_string_tab[274]
  3361. #define __pyx_n_u_split __pyx_string_tab[275]
  3362. #define __pyx_n_u_splitCubic __pyx_string_tab[276]
  3363. #define __pyx_n_u_splitCubicAtT __pyx_string_tab[277]
  3364. #define __pyx_n_u_splitCubicAtTC __pyx_string_tab[278]
  3365. #define __pyx_n_u_splitCubicAtTC_2 __pyx_string_tab[279]
  3366. #define __pyx_n_u_splitCubicAtT_2 __pyx_string_tab[280]
  3367. #define __pyx_n_u_splitCubicIntoTwoAtTC __pyx_string_tab[281]
  3368. #define __pyx_n_u_splitCubic_locals_genexpr __pyx_string_tab[282]
  3369. #define __pyx_n_u_splitLine __pyx_string_tab[283]
  3370. #define __pyx_n_u_splitQuadratic __pyx_string_tab[284]
  3371. #define __pyx_n_u_splitQuadraticAtT __pyx_string_tab[285]
  3372. #define __pyx_n_u_splitQuadraticAtT_2 __pyx_string_tab[286]
  3373. #define __pyx_n_u_splitQuadratic_locals_genexpr __pyx_string_tab[287]
  3374. #define __pyx_n_u_split_cubic_into_two __pyx_string_tab[288]
  3375. #define __pyx_n_u_split_segment_at_t __pyx_string_tab[289]
  3376. #define __pyx_n_u_sqrt __pyx_string_tab[290]
  3377. #define __pyx_n_u_start __pyx_string_tab[291]
  3378. #define __pyx_n_u_swapped __pyx_string_tab[292]
  3379. #define __pyx_n_u_sx __pyx_string_tab[293]
  3380. #define __pyx_n_u_sy __pyx_string_tab[294]
  3381. #define __pyx_n_u_sys __pyx_string_tab[295]
  3382. #define __pyx_n_u_t __pyx_string_tab[296]
  3383. #define __pyx_n_u_t1 __pyx_string_tab[297]
  3384. #define __pyx_n_u_t1_2 __pyx_string_tab[298]
  3385. #define __pyx_n_u_t1_3 __pyx_string_tab[299]
  3386. #define __pyx_n_u_t2 __pyx_string_tab[300]
  3387. #define __pyx_n_u_test __pyx_string_tab[301]
  3388. #define __pyx_n_u_testmod __pyx_string_tab[302]
  3389. #define __pyx_n_u_theta __pyx_string_tab[303]
  3390. #define __pyx_n_u_throw __pyx_string_tab[304]
  3391. #define __pyx_n_u_tolerance __pyx_string_tab[305]
  3392. #define __pyx_n_u_transformPoints __pyx_string_tab[306]
  3393. #define __pyx_n_u_translate __pyx_string_tab[307]
  3394. #define __pyx_n_u_ts __pyx_string_tab[308]
  3395. #define __pyx_n_u_two __pyx_string_tab[309]
  3396. #define __pyx_n_u_unique_key __pyx_string_tab[310]
  3397. #define __pyx_n_u_unique_values __pyx_string_tab[311]
  3398. #define __pyx_n_u_v0 __pyx_string_tab[312]
  3399. #define __pyx_n_u_v1 __pyx_string_tab[313]
  3400. #define __pyx_n_u_v2 __pyx_string_tab[314]
  3401. #define __pyx_n_u_v3 __pyx_string_tab[315]
  3402. #define __pyx_n_u_v4 __pyx_string_tab[316]
  3403. #define __pyx_n_u_value __pyx_string_tab[317]
  3404. #define __pyx_n_u_values __pyx_string_tab[318]
  3405. #define __pyx_n_u_where __pyx_string_tab[319]
  3406. #define __pyx_n_u_x __pyx_string_tab[320]
  3407. #define __pyx_n_u_x0 __pyx_string_tab[321]
  3408. #define __pyx_n_u_x1 __pyx_string_tab[322]
  3409. #define __pyx_n_u_x2 __pyx_string_tab[323]
  3410. #define __pyx_n_u_x3 __pyx_string_tab[324]
  3411. #define __pyx_n_u_x4 __pyx_string_tab[325]
  3412. #define __pyx_n_u_xDiff __pyx_string_tab[326]
  3413. #define __pyx_n_u_xRoots __pyx_string_tab[327]
  3414. #define __pyx_n_u_y __pyx_string_tab[328]
  3415. #define __pyx_n_u_y1 __pyx_string_tab[329]
  3416. #define __pyx_n_u_y2 __pyx_string_tab[330]
  3417. #define __pyx_n_u_y3 __pyx_string_tab[331]
  3418. #define __pyx_n_u_y4 __pyx_string_tab[332]
  3419. #define __pyx_n_u_yDiff __pyx_string_tab[333]
  3420. #define __pyx_n_u_yRoots __pyx_string_tab[334]
  3421. #define __pyx_kp_b_iso88591_0_2Q_2Rq_U_A_r_2Rq_r_b_Bb_7_Bb __pyx_string_tab[335]
  3422. #define __pyx_kp_b_iso88591_1 __pyx_string_tab[336]
  3423. #define __pyx_kp_b_iso88591_1A_at6_1_q_F_4vRq_1L_AU_Qe3auD __pyx_string_tab[337]
  3424. #define __pyx_kp_b_iso88591_1_Ql_1 __pyx_string_tab[338]
  3425. #define __pyx_kp_b_iso88591_1_a_r_wb_gRvWBfA __pyx_string_tab[339]
  3426. #define __pyx_kp_b_iso88591_2B_1_1 __pyx_string_tab[340]
  3427. #define __pyx_kp_b_iso88591_2Q_2Rq_U_A_7_E_4r_3gRr_4r_b_2U __pyx_string_tab[341]
  3428. #define __pyx_kp_b_iso88591_2Q_2Rq_U_A_r_b_1A_Cwb_Cq_2U_Cr __pyx_string_tab[342]
  3429. #define __pyx_kp_b_iso88591_2S_2Rs_Cq_2Rs_Bc_2Rs_3b_Bb_1A_2 __pyx_string_tab[343]
  3430. #define __pyx_kp_b_iso88591_2_Q_r_wb_gRvWBa __pyx_string_tab[344]
  3431. #define __pyx_kp_b_iso88591_3as_A_Qc_4r_AS_b_1Cr_uBe2XS_RuB __pyx_string_tab[345]
  3432. #define __pyx_kp_b_iso88591_3b_S_b_Ba_c_3b_2T_1_c_4r_d_HA_d __pyx_string_tab[346]
  3433. #define __pyx_kp_b_iso88591_4r_Rq_avU_uA __pyx_string_tab[347]
  3434. #define __pyx_kp_b_iso88591_6_rQR __pyx_string_tab[348]
  3435. #define __pyx_kp_b_iso88591_6_s_T_AU_uA_1O1A_2Q_aq_t1_r_e5 __pyx_string_tab[349]
  3436. #define __pyx_kp_b_iso88591_7_F_6 __pyx_string_tab[350]
  3437. #define __pyx_kp_b_iso88591_AS_Cr_3b_1Cr_c_S_Cr_AS __pyx_string_tab[351]
  3438. #define __pyx_kp_b_iso88591_AT_5_A_2Q_Ba_Ba_Ba_AT_4r_RuBa_A __pyx_string_tab[352]
  3439. #define __pyx_kp_b_iso88591_A_t3aq_2Qaq __pyx_string_tab[353]
  3440. #define __pyx_kp_b_iso88591_B_A_2T_5Rt2_PPRRS_AT_5_A_Bd_6b __pyx_string_tab[354]
  3441. #define __pyx_kp_b_iso88591_F_s_Qe5_a_1N_A_aq_t1_r_e1_Qc_D __pyx_string_tab[355]
  3442. #define __pyx_kp_b_iso88591_G1A_1_D_as_3b_Qd_Qc_5_87_1F_AQe __pyx_string_tab[356]
  3443. #define __pyx_kp_b_iso88591_H_b_b_S_r_A_r_a_s_c_1_r_D_2Rr_S __pyx_string_tab[357]
  3444. #define __pyx_kp_b_iso88591_L_s_3b_Qc_A_Qa_2Q_2Q_2Q_Bc_4r_R __pyx_string_tab[358]
  3445. #define __pyx_kp_b_iso88591_M_m1A_m1A_t1_q_t1_q_HAYa_t1_q_x __pyx_string_tab[359]
  3446. #define __pyx_kp_b_iso88591_Q_Q_Q_Q_Rt2Q_Rt2Q_Rt2T_1_Rt2T_1 __pyx_string_tab[360]
  3447. #define __pyx_kp_b_iso88591_Q_Q_Q_Q_RuBa_RuBa_Rt2T_1_Rt2T_1 __pyx_string_tab[361]
  3448. #define __pyx_kp_b_iso88591_Q_Q_Q_Rt2Q_Rt2Q_Bc_1_Bc_1_1D_d __pyx_string_tab[362]
  3449. #define __pyx_kp_b_iso88591_Q_Q_Q_RuBa_RuBa_Bc_1_Bc_1_1D_d __pyx_string_tab[363]
  3450. #define __pyx_kp_b_iso88591_Q_Q_Q_s_3b_Bhd_Qc_4r_s_3b_Bc_Rq __pyx_string_tab[364]
  3451. #define __pyx_kp_b_iso88591_Qa_gQc_gQa_q_Q_Q_Q_Q_U_3at2Q_Rq __pyx_string_tab[365]
  3452. #define __pyx_kp_b_iso88591_Qa_q_gQc_gQa_Q_Q_Q_U_3at2Q_Rq_R __pyx_string_tab[366]
  3453. #define __pyx_kp_b_iso88591_Qas_F_4s_1Cr_q_Qas_F_4s_1Cr_q_5 __pyx_string_tab[367]
  3454. #define __pyx_kp_b_iso88591_Qe3C1A_s_7_Q_3d_1_aq_Qat1AQ_AWC __pyx_string_tab[368]
  3455. #define __pyx_kp_b_iso88591_Rq_Rq_2Q_A_Cq_vS_s_4r_t1Cq_s_Rq __pyx_string_tab[369]
  3456. #define __pyx_kp_b_iso88591_S_1Cr_S_1Cr __pyx_string_tab[370]
  3457. #define __pyx_kp_b_iso88591_T_t6_V4v_e5PQ_Rq_Rq_Rq_Rq_Qb_E __pyx_string_tab[371]
  3458. #define __pyx_kp_b_iso88591_T_t6_V_5_Q_Rq_Rq_A_t3a_WAQc_1_t __pyx_string_tab[372]
  3459. #define __pyx_kp_b_iso88591_T_uBa_wb_E_a __pyx_string_tab[373]
  3460. #define __pyx_kp_b_iso88591__4 __pyx_string_tab[374]
  3461. #define __pyx_kp_b_iso88591__5 __pyx_string_tab[375]
  3462. #define __pyx_kp_b_iso88591_a_2 __pyx_string_tab[376]
  3463. #define __pyx_kp_b_iso88591_a_s_6_3aq_gV1_s_6_1_3avRq_31F_2 __pyx_string_tab[377]
  3464. #define __pyx_kp_b_iso88591_q __pyx_string_tab[378]
  3465. #define __pyx_kp_b_iso88591_q_q_q_q_HAU_t4xq_U_d_hauTU_q_HA __pyx_string_tab[379]
  3466. #define __pyx_kp_b_iso88591_s_3b_3as_A_A_AQb_Rr_2T_2Rq_3c_a __pyx_string_tab[380]
  3467. #define __pyx_kp_b_iso88591_s_3c_4q_q_3a_r_L_s_3c_Q_AS_1_Bc __pyx_string_tab[381]
  3468. #define __pyx_kp_b_iso88591_s_3c_A_AS_1_b_AQ __pyx_string_tab[382]
  3469. #define __pyx_kp_b_iso88591_s_5_1_2U_AU_Q_q_AU_Q_Be1_AQ __pyx_string_tab[383]
  3470. #define __pyx_kp_b_iso88591_s_7_Q_a_AWCq_a_j_A_b_a_6_WA_T_C __pyx_string_tab[384]
  3471. #define __pyx_kp_b_iso88591_s_Qe5_Qc_D __pyx_string_tab[385]
  3472. #define __pyx_kp_b_iso88591_s_T_AU_uA_N_3c_D_e1Baq_6_r_3d_1 __pyx_string_tab[386]
  3473. #define __pyx_float_0_0 __pyx_number_tab[0]
  3474. #define __pyx_float_0_5 __pyx_number_tab[1]
  3475. #define __pyx_float_1_0 __pyx_number_tab[2]
  3476. #define __pyx_float_neg_2_0 __pyx_number_tab[3]
  3477. #define __pyx_float_2_0 __pyx_number_tab[4]
  3478. #define __pyx_float_3_0 __pyx_number_tab[5]
  3479. #define __pyx_float_4_0 __pyx_number_tab[6]
  3480. #define __pyx_float_9_0 __pyx_number_tab[7]
  3481. #define __pyx_float_1eneg_3 __pyx_number_tab[8]
  3482. #define __pyx_float_1eneg_9 __pyx_number_tab[9]
  3483. #define __pyx_float_27_0 __pyx_number_tab[10]
  3484. #define __pyx_float_54_0 __pyx_number_tab[11]
  3485. #define __pyx_float_0_005 __pyx_number_tab[12]
  3486. #define __pyx_float_0_125 __pyx_number_tab[13]
  3487. #define __pyx_float_1eneg_10 __pyx_number_tab[14]
  3488. #define __pyx_int_0 __pyx_number_tab[15]
  3489. #define __pyx_int_neg_1 __pyx_number_tab[16]
  3490. #define __pyx_int_1 __pyx_number_tab[17]
  3491. #define __pyx_int_2 __pyx_number_tab[18]
  3492. #define __pyx_int_3 __pyx_number_tab[19]
  3493. #define __pyx_int_6 __pyx_number_tab[20]
  3494. /* #### Code section: module_state_clear ### */
  3495. #if CYTHON_USE_MODULE_STATE
  3496. static CYTHON_SMALL_CODE int __pyx_m_clear(PyObject *m) {
  3497. __pyx_mstatetype *clear_module_state = __Pyx_PyModule_GetState(m);
  3498. if (!clear_module_state) return 0;
  3499. Py_CLEAR(clear_module_state->__pyx_d);
  3500. Py_CLEAR(clear_module_state->__pyx_b);
  3501. Py_CLEAR(clear_module_state->__pyx_cython_runtime);
  3502. Py_CLEAR(clear_module_state->__pyx_empty_tuple);
  3503. Py_CLEAR(clear_module_state->__pyx_empty_bytes);
  3504. Py_CLEAR(clear_module_state->__pyx_empty_unicode);
  3505. #if CYTHON_PEP489_MULTI_PHASE_INIT
  3506. __Pyx_State_RemoveModule(NULL);
  3507. #endif
  3508. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_defaults);
  3509. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_defaults);
  3510. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr);
  3511. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr);
  3512. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr);
  3513. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr);
  3514. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC);
  3515. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC);
  3516. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC);
  3517. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC);
  3518. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr);
  3519. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr);
  3520. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t);
  3521. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t);
  3522. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr);
  3523. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr);
  3524. Py_CLEAR(clear_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr);
  3525. Py_CLEAR(clear_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr);
  3526. for (int i=0; i<2; ++i) { Py_CLEAR(clear_module_state->__pyx_slice[i]); }
  3527. for (int i=0; i<4; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); }
  3528. for (int i=0; i<54; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); }
  3529. for (int i=0; i<387; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); }
  3530. for (int i=0; i<21; ++i) { Py_CLEAR(clear_module_state->__pyx_number_tab[i]); }
  3531. /* #### Code section: module_state_clear_contents ### */
  3532. /* CommonTypesMetaclass.module_state_clear */
  3533. Py_CLEAR(clear_module_state->__pyx_CommonTypesMetaclassType);
  3534. /* Generator.module_state_clear */
  3535. Py_CLEAR(clear_module_state->__pyx_GeneratorType);
  3536. /* CythonFunctionShared.module_state_clear */
  3537. Py_CLEAR(clear_module_state->__pyx_CyFunctionType);
  3538. /* #### Code section: module_state_clear_end ### */
  3539. return 0;
  3540. }
  3541. #endif
  3542. /* #### Code section: module_state_traverse ### */
  3543. #if CYTHON_USE_MODULE_STATE
  3544. static CYTHON_SMALL_CODE int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
  3545. __pyx_mstatetype *traverse_module_state = __Pyx_PyModule_GetState(m);
  3546. if (!traverse_module_state) return 0;
  3547. Py_VISIT(traverse_module_state->__pyx_d);
  3548. Py_VISIT(traverse_module_state->__pyx_b);
  3549. Py_VISIT(traverse_module_state->__pyx_cython_runtime);
  3550. __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_tuple);
  3551. __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_bytes);
  3552. __Pyx_VISIT_CONST(traverse_module_state->__pyx_empty_unicode);
  3553. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_defaults);
  3554. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_defaults);
  3555. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr);
  3556. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr);
  3557. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr);
  3558. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr);
  3559. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC);
  3560. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC);
  3561. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC);
  3562. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC);
  3563. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr);
  3564. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr);
  3565. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t);
  3566. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t);
  3567. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr);
  3568. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr);
  3569. Py_VISIT(traverse_module_state->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr);
  3570. Py_VISIT(traverse_module_state->__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr);
  3571. for (int i=0; i<2; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_slice[i]); }
  3572. for (int i=0; i<4; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); }
  3573. for (int i=0; i<54; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); }
  3574. for (int i=0; i<387; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); }
  3575. for (int i=0; i<21; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_number_tab[i]); }
  3576. /* #### Code section: module_state_traverse_contents ### */
  3577. /* CommonTypesMetaclass.module_state_traverse */
  3578. Py_VISIT(traverse_module_state->__pyx_CommonTypesMetaclassType);
  3579. /* Generator.module_state_traverse */
  3580. Py_VISIT(traverse_module_state->__pyx_GeneratorType);
  3581. /* CythonFunctionShared.module_state_traverse */
  3582. Py_VISIT(traverse_module_state->__pyx_CyFunctionType);
  3583. /* #### Code section: module_state_traverse_end ### */
  3584. return 0;
  3585. }
  3586. #endif
  3587. /* #### Code section: module_code ### */
  3588. /* "fontTools/misc/bezierTools.py":56
  3589. *
  3590. *
  3591. * def calcCubicArcLength(pt1, pt2, pt3, pt4, tolerance=0.005): # <<<<<<<<<<<<<<
  3592. * """Calculates the arc length for a cubic Bezier segment.
  3593. *
  3594. */
  3595. /* Python wrapper */
  3596. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_1calcCubicArcLength(PyObject *__pyx_self,
  3597. #if CYTHON_METH_FASTCALL
  3598. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  3599. #else
  3600. PyObject *__pyx_args, PyObject *__pyx_kwds
  3601. #endif
  3602. ); /*proto*/
  3603. 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.");
  3604. 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};
  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. ) {
  3612. PyObject *__pyx_v_pt1 = 0;
  3613. PyObject *__pyx_v_pt2 = 0;
  3614. PyObject *__pyx_v_pt3 = 0;
  3615. PyObject *__pyx_v_pt4 = 0;
  3616. PyObject *__pyx_v_tolerance = 0;
  3617. #if !CYTHON_METH_FASTCALL
  3618. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  3619. #endif
  3620. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  3621. PyObject* values[5] = {0,0,0,0,0};
  3622. int __pyx_lineno = 0;
  3623. const char *__pyx_filename = NULL;
  3624. int __pyx_clineno = 0;
  3625. PyObject *__pyx_r = 0;
  3626. __Pyx_RefNannyDeclarations
  3627. __Pyx_RefNannySetupContext("calcCubicArcLength (wrapper)", 0);
  3628. #if !CYTHON_METH_FASTCALL
  3629. #if CYTHON_ASSUME_SAFE_SIZE
  3630. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  3631. #else
  3632. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  3633. #endif
  3634. #endif
  3635. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  3636. {
  3637. 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};
  3638. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  3639. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 56, __pyx_L3_error)
  3640. if (__pyx_kwds_len > 0) {
  3641. switch (__pyx_nargs) {
  3642. case 5:
  3643. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  3644. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 56, __pyx_L3_error)
  3645. CYTHON_FALLTHROUGH;
  3646. case 4:
  3647. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  3648. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 56, __pyx_L3_error)
  3649. CYTHON_FALLTHROUGH;
  3650. case 3:
  3651. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  3652. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 56, __pyx_L3_error)
  3653. CYTHON_FALLTHROUGH;
  3654. case 2:
  3655. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  3656. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 56, __pyx_L3_error)
  3657. CYTHON_FALLTHROUGH;
  3658. case 1:
  3659. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  3660. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 56, __pyx_L3_error)
  3661. CYTHON_FALLTHROUGH;
  3662. case 0: break;
  3663. default: goto __pyx_L5_argtuple_error;
  3664. }
  3665. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  3666. 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)
  3667. if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_float_0_005)));
  3668. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  3669. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("calcCubicArcLength", 0, 4, 5, i); __PYX_ERR(0, 56, __pyx_L3_error) }
  3670. }
  3671. } else {
  3672. switch (__pyx_nargs) {
  3673. case 5:
  3674. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  3675. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 56, __pyx_L3_error)
  3676. CYTHON_FALLTHROUGH;
  3677. case 4:
  3678. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  3679. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 56, __pyx_L3_error)
  3680. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  3681. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 56, __pyx_L3_error)
  3682. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  3683. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 56, __pyx_L3_error)
  3684. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  3685. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 56, __pyx_L3_error)
  3686. break;
  3687. default: goto __pyx_L5_argtuple_error;
  3688. }
  3689. if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_float_0_005)));
  3690. }
  3691. __pyx_v_pt1 = values[0];
  3692. __pyx_v_pt2 = values[1];
  3693. __pyx_v_pt3 = values[2];
  3694. __pyx_v_pt4 = values[3];
  3695. __pyx_v_tolerance = values[4];
  3696. }
  3697. goto __pyx_L6_skip;
  3698. __pyx_L5_argtuple_error:;
  3699. __Pyx_RaiseArgtupleInvalid("calcCubicArcLength", 0, 4, 5, __pyx_nargs); __PYX_ERR(0, 56, __pyx_L3_error)
  3700. __pyx_L6_skip:;
  3701. goto __pyx_L4_argument_unpacking_done;
  3702. __pyx_L3_error:;
  3703. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  3704. Py_XDECREF(values[__pyx_temp]);
  3705. }
  3706. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcCubicArcLength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3707. __Pyx_RefNannyFinishContext();
  3708. return NULL;
  3709. __pyx_L4_argument_unpacking_done:;
  3710. __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);
  3711. /* function exit code */
  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_RefNannyFinishContext();
  3716. return __pyx_r;
  3717. }
  3718. 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) {
  3719. PyObject *__pyx_r = NULL;
  3720. __Pyx_RefNannyDeclarations
  3721. PyObject *__pyx_t_1 = NULL;
  3722. PyObject *__pyx_t_2 = NULL;
  3723. PyObject *__pyx_t_3 = NULL;
  3724. PyObject *__pyx_t_4 = NULL;
  3725. PyObject *__pyx_t_5 = NULL;
  3726. PyObject *__pyx_t_6 = NULL;
  3727. PyObject *__pyx_t_7 = NULL;
  3728. PyObject *__pyx_t_8 = NULL;
  3729. size_t __pyx_t_9;
  3730. int __pyx_lineno = 0;
  3731. const char *__pyx_filename = NULL;
  3732. int __pyx_clineno = 0;
  3733. __Pyx_RefNannySetupContext("calcCubicArcLength", 0);
  3734. /* "fontTools/misc/bezierTools.py":70
  3735. * Arc length value.
  3736. * """
  3737. * return calcCubicArcLengthC( # <<<<<<<<<<<<<<
  3738. * complex(*pt1), complex(*pt2), complex(*pt3), complex(*pt4), tolerance
  3739. * )
  3740. */
  3741. __Pyx_XDECREF(__pyx_r);
  3742. __pyx_t_2 = NULL;
  3743. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_calcCubicArcLengthC); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error)
  3744. __Pyx_GOTREF(__pyx_t_3);
  3745. /* "fontTools/misc/bezierTools.py":71
  3746. * """
  3747. * return calcCubicArcLengthC(
  3748. * complex(*pt1), complex(*pt2), complex(*pt3), complex(*pt4), tolerance # <<<<<<<<<<<<<<
  3749. * )
  3750. *
  3751. */
  3752. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error)
  3753. __Pyx_GOTREF(__pyx_t_4);
  3754. __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)
  3755. __Pyx_GOTREF(__pyx_t_5);
  3756. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3757. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error)
  3758. __Pyx_GOTREF(__pyx_t_4);
  3759. __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)
  3760. __Pyx_GOTREF(__pyx_t_6);
  3761. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3762. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error)
  3763. __Pyx_GOTREF(__pyx_t_4);
  3764. __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)
  3765. __Pyx_GOTREF(__pyx_t_7);
  3766. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3767. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error)
  3768. __Pyx_GOTREF(__pyx_t_4);
  3769. __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)
  3770. __Pyx_GOTREF(__pyx_t_8);
  3771. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  3772. __pyx_t_9 = 1;
  3773. #if CYTHON_UNPACK_METHODS
  3774. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  3775. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  3776. assert(__pyx_t_2);
  3777. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  3778. __Pyx_INCREF(__pyx_t_2);
  3779. __Pyx_INCREF(__pyx__function);
  3780. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  3781. __pyx_t_9 = 0;
  3782. }
  3783. #endif
  3784. {
  3785. PyObject *__pyx_callargs[6] = {__pyx_t_2, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_v_tolerance};
  3786. __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));
  3787. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  3788. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3789. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3790. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3791. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  3792. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3793. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error)
  3794. __Pyx_GOTREF(__pyx_t_1);
  3795. }
  3796. __pyx_r = __pyx_t_1;
  3797. __pyx_t_1 = 0;
  3798. goto __pyx_L0;
  3799. /* "fontTools/misc/bezierTools.py":56
  3800. *
  3801. *
  3802. * def calcCubicArcLength(pt1, pt2, pt3, pt4, tolerance=0.005): # <<<<<<<<<<<<<<
  3803. * """Calculates the arc length for a cubic Bezier segment.
  3804. *
  3805. */
  3806. /* function exit code */
  3807. __pyx_L1_error:;
  3808. __Pyx_XDECREF(__pyx_t_1);
  3809. __Pyx_XDECREF(__pyx_t_2);
  3810. __Pyx_XDECREF(__pyx_t_3);
  3811. __Pyx_XDECREF(__pyx_t_4);
  3812. __Pyx_XDECREF(__pyx_t_5);
  3813. __Pyx_XDECREF(__pyx_t_6);
  3814. __Pyx_XDECREF(__pyx_t_7);
  3815. __Pyx_XDECREF(__pyx_t_8);
  3816. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcCubicArcLength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3817. __pyx_r = NULL;
  3818. __pyx_L0:;
  3819. __Pyx_XGIVEREF(__pyx_r);
  3820. __Pyx_RefNannyFinishContext();
  3821. return __pyx_r;
  3822. }
  3823. /* "fontTools/misc/bezierTools.py":75
  3824. *
  3825. *
  3826. * def _split_cubic_into_two(p0, p1, p2, p3): # <<<<<<<<<<<<<<
  3827. * mid = (p0 + 3 * (p1 + p2) + p3) * 0.125
  3828. * deriv3 = (p3 + p2 - p1 - p0) * 0.125
  3829. */
  3830. /* Python wrapper */
  3831. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_3_split_cubic_into_two(PyObject *__pyx_self,
  3832. #if CYTHON_METH_FASTCALL
  3833. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  3834. #else
  3835. PyObject *__pyx_args, PyObject *__pyx_kwds
  3836. #endif
  3837. ); /*proto*/
  3838. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_2_split_cubic_into_two, "_split_cubic_into_two(p0, p1, p2, p3)");
  3839. 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};
  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. ) {
  3847. PyObject *__pyx_v_p0 = 0;
  3848. PyObject *__pyx_v_p1 = 0;
  3849. PyObject *__pyx_v_p2 = 0;
  3850. PyObject *__pyx_v_p3 = 0;
  3851. #if !CYTHON_METH_FASTCALL
  3852. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  3853. #endif
  3854. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  3855. PyObject* values[4] = {0,0,0,0};
  3856. int __pyx_lineno = 0;
  3857. const char *__pyx_filename = NULL;
  3858. int __pyx_clineno = 0;
  3859. PyObject *__pyx_r = 0;
  3860. __Pyx_RefNannyDeclarations
  3861. __Pyx_RefNannySetupContext("_split_cubic_into_two (wrapper)", 0);
  3862. #if !CYTHON_METH_FASTCALL
  3863. #if CYTHON_ASSUME_SAFE_SIZE
  3864. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  3865. #else
  3866. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  3867. #endif
  3868. #endif
  3869. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  3870. {
  3871. 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};
  3872. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  3873. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 75, __pyx_L3_error)
  3874. if (__pyx_kwds_len > 0) {
  3875. switch (__pyx_nargs) {
  3876. case 4:
  3877. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  3878. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 75, __pyx_L3_error)
  3879. CYTHON_FALLTHROUGH;
  3880. case 3:
  3881. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  3882. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 75, __pyx_L3_error)
  3883. CYTHON_FALLTHROUGH;
  3884. case 2:
  3885. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  3886. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 75, __pyx_L3_error)
  3887. CYTHON_FALLTHROUGH;
  3888. case 1:
  3889. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  3890. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 75, __pyx_L3_error)
  3891. CYTHON_FALLTHROUGH;
  3892. case 0: break;
  3893. default: goto __pyx_L5_argtuple_error;
  3894. }
  3895. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  3896. 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)
  3897. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  3898. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_split_cubic_into_two", 1, 4, 4, i); __PYX_ERR(0, 75, __pyx_L3_error) }
  3899. }
  3900. } else if (unlikely(__pyx_nargs != 4)) {
  3901. goto __pyx_L5_argtuple_error;
  3902. } else {
  3903. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  3904. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 75, __pyx_L3_error)
  3905. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  3906. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 75, __pyx_L3_error)
  3907. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  3908. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 75, __pyx_L3_error)
  3909. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  3910. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 75, __pyx_L3_error)
  3911. }
  3912. __pyx_v_p0 = values[0];
  3913. __pyx_v_p1 = values[1];
  3914. __pyx_v_p2 = values[2];
  3915. __pyx_v_p3 = values[3];
  3916. }
  3917. goto __pyx_L6_skip;
  3918. __pyx_L5_argtuple_error:;
  3919. __Pyx_RaiseArgtupleInvalid("_split_cubic_into_two", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 75, __pyx_L3_error)
  3920. __pyx_L6_skip:;
  3921. goto __pyx_L4_argument_unpacking_done;
  3922. __pyx_L3_error:;
  3923. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  3924. Py_XDECREF(values[__pyx_temp]);
  3925. }
  3926. __Pyx_AddTraceback("fontTools.misc.bezierTools._split_cubic_into_two", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3927. __Pyx_RefNannyFinishContext();
  3928. return NULL;
  3929. __pyx_L4_argument_unpacking_done:;
  3930. __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);
  3931. /* function exit code */
  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_RefNannyFinishContext();
  3936. return __pyx_r;
  3937. }
  3938. 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) {
  3939. PyObject *__pyx_v_mid = NULL;
  3940. PyObject *__pyx_v_deriv3 = NULL;
  3941. PyObject *__pyx_r = NULL;
  3942. __Pyx_RefNannyDeclarations
  3943. PyObject *__pyx_t_1 = NULL;
  3944. PyObject *__pyx_t_2 = NULL;
  3945. PyObject *__pyx_t_3 = NULL;
  3946. PyObject *__pyx_t_4 = NULL;
  3947. int __pyx_lineno = 0;
  3948. const char *__pyx_filename = NULL;
  3949. int __pyx_clineno = 0;
  3950. __Pyx_RefNannySetupContext("_split_cubic_into_two", 0);
  3951. /* "fontTools/misc/bezierTools.py":76
  3952. *
  3953. * def _split_cubic_into_two(p0, p1, p2, p3):
  3954. * mid = (p0 + 3 * (p1 + p2) + p3) * 0.125 # <<<<<<<<<<<<<<
  3955. * deriv3 = (p3 + p2 - p1 - p0) * 0.125
  3956. * return (
  3957. */
  3958. __pyx_t_1 = PyNumber_Add(__pyx_v_p1, __pyx_v_p2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error)
  3959. __Pyx_GOTREF(__pyx_t_1);
  3960. __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)
  3961. __Pyx_GOTREF(__pyx_t_2);
  3962. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3963. __pyx_t_1 = PyNumber_Add(__pyx_v_p0, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error)
  3964. __Pyx_GOTREF(__pyx_t_1);
  3965. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3966. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_p3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error)
  3967. __Pyx_GOTREF(__pyx_t_2);
  3968. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3969. __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)
  3970. __Pyx_GOTREF(__pyx_t_1);
  3971. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3972. __pyx_v_mid = __pyx_t_1;
  3973. __pyx_t_1 = 0;
  3974. /* "fontTools/misc/bezierTools.py":77
  3975. * def _split_cubic_into_two(p0, p1, p2, p3):
  3976. * mid = (p0 + 3 * (p1 + p2) + p3) * 0.125
  3977. * deriv3 = (p3 + p2 - p1 - p0) * 0.125 # <<<<<<<<<<<<<<
  3978. * return (
  3979. * (p0, (p0 + p1) * 0.5, mid - deriv3, mid),
  3980. */
  3981. __pyx_t_1 = PyNumber_Add(__pyx_v_p3, __pyx_v_p2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error)
  3982. __Pyx_GOTREF(__pyx_t_1);
  3983. __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_p1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error)
  3984. __Pyx_GOTREF(__pyx_t_2);
  3985. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3986. __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_v_p0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error)
  3987. __Pyx_GOTREF(__pyx_t_1);
  3988. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3989. __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)
  3990. __Pyx_GOTREF(__pyx_t_2);
  3991. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  3992. __pyx_v_deriv3 = __pyx_t_2;
  3993. __pyx_t_2 = 0;
  3994. /* "fontTools/misc/bezierTools.py":78
  3995. * mid = (p0 + 3 * (p1 + p2) + p3) * 0.125
  3996. * deriv3 = (p3 + p2 - p1 - p0) * 0.125
  3997. * return ( # <<<<<<<<<<<<<<
  3998. * (p0, (p0 + p1) * 0.5, mid - deriv3, mid),
  3999. * (mid, mid + deriv3, (p2 + p3) * 0.5, p3),
  4000. */
  4001. __Pyx_XDECREF(__pyx_r);
  4002. /* "fontTools/misc/bezierTools.py":79
  4003. * deriv3 = (p3 + p2 - p1 - p0) * 0.125
  4004. * return (
  4005. * (p0, (p0 + p1) * 0.5, mid - deriv3, mid), # <<<<<<<<<<<<<<
  4006. * (mid, mid + deriv3, (p2 + p3) * 0.5, p3),
  4007. * )
  4008. */
  4009. __pyx_t_2 = PyNumber_Add(__pyx_v_p0, __pyx_v_p1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error)
  4010. __Pyx_GOTREF(__pyx_t_2);
  4011. __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)
  4012. __Pyx_GOTREF(__pyx_t_1);
  4013. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4014. __pyx_t_2 = PyNumber_Subtract(__pyx_v_mid, __pyx_v_deriv3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error)
  4015. __Pyx_GOTREF(__pyx_t_2);
  4016. __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error)
  4017. __Pyx_GOTREF(__pyx_t_3);
  4018. __Pyx_INCREF(__pyx_v_p0);
  4019. __Pyx_GIVEREF(__pyx_v_p0);
  4020. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_p0) != (0)) __PYX_ERR(0, 79, __pyx_L1_error);
  4021. __Pyx_GIVEREF(__pyx_t_1);
  4022. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 79, __pyx_L1_error);
  4023. __Pyx_GIVEREF(__pyx_t_2);
  4024. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2) != (0)) __PYX_ERR(0, 79, __pyx_L1_error);
  4025. __Pyx_INCREF(__pyx_v_mid);
  4026. __Pyx_GIVEREF(__pyx_v_mid);
  4027. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_mid) != (0)) __PYX_ERR(0, 79, __pyx_L1_error);
  4028. __pyx_t_1 = 0;
  4029. __pyx_t_2 = 0;
  4030. /* "fontTools/misc/bezierTools.py":80
  4031. * return (
  4032. * (p0, (p0 + p1) * 0.5, mid - deriv3, mid),
  4033. * (mid, mid + deriv3, (p2 + p3) * 0.5, p3), # <<<<<<<<<<<<<<
  4034. * )
  4035. *
  4036. */
  4037. __pyx_t_2 = PyNumber_Add(__pyx_v_mid, __pyx_v_deriv3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error)
  4038. __Pyx_GOTREF(__pyx_t_2);
  4039. __pyx_t_1 = PyNumber_Add(__pyx_v_p2, __pyx_v_p3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error)
  4040. __Pyx_GOTREF(__pyx_t_1);
  4041. __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)
  4042. __Pyx_GOTREF(__pyx_t_4);
  4043. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4044. __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error)
  4045. __Pyx_GOTREF(__pyx_t_1);
  4046. __Pyx_INCREF(__pyx_v_mid);
  4047. __Pyx_GIVEREF(__pyx_v_mid);
  4048. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_mid) != (0)) __PYX_ERR(0, 80, __pyx_L1_error);
  4049. __Pyx_GIVEREF(__pyx_t_2);
  4050. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 80, __pyx_L1_error);
  4051. __Pyx_GIVEREF(__pyx_t_4);
  4052. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4) != (0)) __PYX_ERR(0, 80, __pyx_L1_error);
  4053. __Pyx_INCREF(__pyx_v_p3);
  4054. __Pyx_GIVEREF(__pyx_v_p3);
  4055. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_p3) != (0)) __PYX_ERR(0, 80, __pyx_L1_error);
  4056. __pyx_t_2 = 0;
  4057. __pyx_t_4 = 0;
  4058. /* "fontTools/misc/bezierTools.py":79
  4059. * deriv3 = (p3 + p2 - p1 - p0) * 0.125
  4060. * return (
  4061. * (p0, (p0 + p1) * 0.5, mid - deriv3, mid), # <<<<<<<<<<<<<<
  4062. * (mid, mid + deriv3, (p2 + p3) * 0.5, p3),
  4063. * )
  4064. */
  4065. __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error)
  4066. __Pyx_GOTREF(__pyx_t_4);
  4067. __Pyx_GIVEREF(__pyx_t_3);
  4068. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 79, __pyx_L1_error);
  4069. __Pyx_GIVEREF(__pyx_t_1);
  4070. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 79, __pyx_L1_error);
  4071. __pyx_t_3 = 0;
  4072. __pyx_t_1 = 0;
  4073. __pyx_r = __pyx_t_4;
  4074. __pyx_t_4 = 0;
  4075. goto __pyx_L0;
  4076. /* "fontTools/misc/bezierTools.py":75
  4077. *
  4078. *
  4079. * def _split_cubic_into_two(p0, p1, p2, p3): # <<<<<<<<<<<<<<
  4080. * mid = (p0 + 3 * (p1 + p2) + p3) * 0.125
  4081. * deriv3 = (p3 + p2 - p1 - p0) * 0.125
  4082. */
  4083. /* function exit code */
  4084. __pyx_L1_error:;
  4085. __Pyx_XDECREF(__pyx_t_1);
  4086. __Pyx_XDECREF(__pyx_t_2);
  4087. __Pyx_XDECREF(__pyx_t_3);
  4088. __Pyx_XDECREF(__pyx_t_4);
  4089. __Pyx_AddTraceback("fontTools.misc.bezierTools._split_cubic_into_two", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4090. __pyx_r = NULL;
  4091. __pyx_L0:;
  4092. __Pyx_XDECREF(__pyx_v_mid);
  4093. __Pyx_XDECREF(__pyx_v_deriv3);
  4094. __Pyx_XGIVEREF(__pyx_r);
  4095. __Pyx_RefNannyFinishContext();
  4096. return __pyx_r;
  4097. }
  4098. /* "fontTools/misc/bezierTools.py":84
  4099. *
  4100. *
  4101. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  4102. * @cython.locals(
  4103. * p0=cython.complex,
  4104. */
  4105. /* Python wrapper */
  4106. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_5_calcCubicArcLengthCRecurse(PyObject *__pyx_self,
  4107. #if CYTHON_METH_FASTCALL
  4108. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  4109. #else
  4110. PyObject *__pyx_args, PyObject *__pyx_kwds
  4111. #endif
  4112. ); /*proto*/
  4113. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_4_calcCubicArcLengthCRecurse, "_calcCubicArcLengthCRecurse(double mult, double complex p0, double complex p1, double complex p2, double complex p3)");
  4114. 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};
  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. ) {
  4122. double __pyx_v_mult;
  4123. __pyx_t_double_complex __pyx_v_p0;
  4124. __pyx_t_double_complex __pyx_v_p1;
  4125. __pyx_t_double_complex __pyx_v_p2;
  4126. __pyx_t_double_complex __pyx_v_p3;
  4127. #if !CYTHON_METH_FASTCALL
  4128. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  4129. #endif
  4130. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  4131. PyObject* values[5] = {0,0,0,0,0};
  4132. int __pyx_lineno = 0;
  4133. const char *__pyx_filename = NULL;
  4134. int __pyx_clineno = 0;
  4135. PyObject *__pyx_r = 0;
  4136. __Pyx_RefNannyDeclarations
  4137. __Pyx_RefNannySetupContext("_calcCubicArcLengthCRecurse (wrapper)", 0);
  4138. #if !CYTHON_METH_FASTCALL
  4139. #if CYTHON_ASSUME_SAFE_SIZE
  4140. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  4141. #else
  4142. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  4143. #endif
  4144. #endif
  4145. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  4146. {
  4147. 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};
  4148. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  4149. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 84, __pyx_L3_error)
  4150. if (__pyx_kwds_len > 0) {
  4151. switch (__pyx_nargs) {
  4152. case 5:
  4153. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  4154. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 84, __pyx_L3_error)
  4155. CYTHON_FALLTHROUGH;
  4156. case 4:
  4157. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  4158. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 84, __pyx_L3_error)
  4159. CYTHON_FALLTHROUGH;
  4160. case 3:
  4161. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  4162. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 84, __pyx_L3_error)
  4163. CYTHON_FALLTHROUGH;
  4164. case 2:
  4165. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  4166. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 84, __pyx_L3_error)
  4167. CYTHON_FALLTHROUGH;
  4168. case 1:
  4169. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  4170. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 84, __pyx_L3_error)
  4171. CYTHON_FALLTHROUGH;
  4172. case 0: break;
  4173. default: goto __pyx_L5_argtuple_error;
  4174. }
  4175. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  4176. 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)
  4177. for (Py_ssize_t i = __pyx_nargs; i < 5; i++) {
  4178. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_calcCubicArcLengthCRecurse", 1, 5, 5, i); __PYX_ERR(0, 84, __pyx_L3_error) }
  4179. }
  4180. } else if (unlikely(__pyx_nargs != 5)) {
  4181. goto __pyx_L5_argtuple_error;
  4182. } else {
  4183. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  4184. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 84, __pyx_L3_error)
  4185. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  4186. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 84, __pyx_L3_error)
  4187. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  4188. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 84, __pyx_L3_error)
  4189. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  4190. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 84, __pyx_L3_error)
  4191. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  4192. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 84, __pyx_L3_error)
  4193. }
  4194. __pyx_v_mult = __Pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_mult == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 92, __pyx_L3_error)
  4195. __pyx_v_p0 = __Pyx_PyComplex_As___pyx_t_double_complex(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 92, __pyx_L3_error)
  4196. __pyx_v_p1 = __Pyx_PyComplex_As___pyx_t_double_complex(values[2]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 92, __pyx_L3_error)
  4197. __pyx_v_p2 = __Pyx_PyComplex_As___pyx_t_double_complex(values[3]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 92, __pyx_L3_error)
  4198. __pyx_v_p3 = __Pyx_PyComplex_As___pyx_t_double_complex(values[4]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 92, __pyx_L3_error)
  4199. }
  4200. goto __pyx_L6_skip;
  4201. __pyx_L5_argtuple_error:;
  4202. __Pyx_RaiseArgtupleInvalid("_calcCubicArcLengthCRecurse", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 84, __pyx_L3_error)
  4203. __pyx_L6_skip:;
  4204. goto __pyx_L4_argument_unpacking_done;
  4205. __pyx_L3_error:;
  4206. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  4207. Py_XDECREF(values[__pyx_temp]);
  4208. }
  4209. __Pyx_AddTraceback("fontTools.misc.bezierTools._calcCubicArcLengthCRecurse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4210. __Pyx_RefNannyFinishContext();
  4211. return NULL;
  4212. __pyx_L4_argument_unpacking_done:;
  4213. __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);
  4214. /* function exit code */
  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_RefNannyFinishContext();
  4219. return __pyx_r;
  4220. }
  4221. 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) {
  4222. double __pyx_v_arch;
  4223. double __pyx_v_box;
  4224. PyObject *__pyx_v_one = NULL;
  4225. PyObject *__pyx_v_two = NULL;
  4226. PyObject *__pyx_r = NULL;
  4227. __Pyx_RefNannyDeclarations
  4228. PyObject *__pyx_t_1 = NULL;
  4229. PyObject *__pyx_t_2 = NULL;
  4230. PyObject *__pyx_t_3 = NULL;
  4231. int __pyx_t_4;
  4232. PyObject *__pyx_t_5 = NULL;
  4233. PyObject *__pyx_t_6 = NULL;
  4234. PyObject *__pyx_t_7 = NULL;
  4235. PyObject *__pyx_t_8 = NULL;
  4236. size_t __pyx_t_9;
  4237. PyObject *(*__pyx_t_10)(PyObject *);
  4238. int __pyx_lineno = 0;
  4239. const char *__pyx_filename = NULL;
  4240. int __pyx_clineno = 0;
  4241. __Pyx_RefNannySetupContext("_calcCubicArcLengthCRecurse", 0);
  4242. /* "fontTools/misc/bezierTools.py":93
  4243. * @cython.locals(mult=cython.double, arch=cython.double, box=cython.double)
  4244. * def _calcCubicArcLengthCRecurse(mult, p0, p1, p2, p3):
  4245. * arch = abs(p0 - p3) # <<<<<<<<<<<<<<
  4246. * box = abs(p0 - p1) + abs(p1 - p2) + abs(p2 - p3)
  4247. * if arch * mult + EPSILON >= box:
  4248. */
  4249. __pyx_v_arch = __Pyx_c_abs_double(__Pyx_c_diff_double(__pyx_v_p0, __pyx_v_p3));
  4250. /* "fontTools/misc/bezierTools.py":94
  4251. * def _calcCubicArcLengthCRecurse(mult, p0, p1, p2, p3):
  4252. * arch = abs(p0 - p3)
  4253. * box = abs(p0 - p1) + abs(p1 - p2) + abs(p2 - p3) # <<<<<<<<<<<<<<
  4254. * if arch * mult + EPSILON >= box:
  4255. * return (arch + box) * 0.5
  4256. */
  4257. __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)));
  4258. /* "fontTools/misc/bezierTools.py":95
  4259. * arch = abs(p0 - p3)
  4260. * box = abs(p0 - p1) + abs(p1 - p2) + abs(p2 - p3)
  4261. * if arch * mult + EPSILON >= box: # <<<<<<<<<<<<<<
  4262. * return (arch + box) * 0.5
  4263. * else:
  4264. */
  4265. __pyx_t_1 = PyFloat_FromDouble((__pyx_v_arch * __pyx_v_mult)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L1_error)
  4266. __Pyx_GOTREF(__pyx_t_1);
  4267. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_EPSILON); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error)
  4268. __Pyx_GOTREF(__pyx_t_2);
  4269. __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error)
  4270. __Pyx_GOTREF(__pyx_t_3);
  4271. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4272. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4273. __pyx_t_2 = PyFloat_FromDouble(__pyx_v_box); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error)
  4274. __Pyx_GOTREF(__pyx_t_2);
  4275. __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)
  4276. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4277. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4278. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 95, __pyx_L1_error)
  4279. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4280. if (__pyx_t_4) {
  4281. /* "fontTools/misc/bezierTools.py":96
  4282. * box = abs(p0 - p1) + abs(p1 - p2) + abs(p2 - p3)
  4283. * if arch * mult + EPSILON >= box:
  4284. * return (arch + box) * 0.5 # <<<<<<<<<<<<<<
  4285. * else:
  4286. * one, two = _split_cubic_into_two(p0, p1, p2, p3)
  4287. */
  4288. __Pyx_XDECREF(__pyx_r);
  4289. __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)
  4290. __Pyx_GOTREF(__pyx_t_1);
  4291. __pyx_r = __pyx_t_1;
  4292. __pyx_t_1 = 0;
  4293. goto __pyx_L0;
  4294. /* "fontTools/misc/bezierTools.py":95
  4295. * arch = abs(p0 - p3)
  4296. * box = abs(p0 - p1) + abs(p1 - p2) + abs(p2 - p3)
  4297. * if arch * mult + EPSILON >= box: # <<<<<<<<<<<<<<
  4298. * return (arch + box) * 0.5
  4299. * else:
  4300. */
  4301. }
  4302. /* "fontTools/misc/bezierTools.py":98
  4303. * return (arch + box) * 0.5
  4304. * else:
  4305. * one, two = _split_cubic_into_two(p0, p1, p2, p3) # <<<<<<<<<<<<<<
  4306. * return _calcCubicArcLengthCRecurse(mult, *one) + _calcCubicArcLengthCRecurse(
  4307. * mult, *two
  4308. */
  4309. /*else*/ {
  4310. __pyx_t_2 = NULL;
  4311. __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)
  4312. __Pyx_GOTREF(__pyx_t_3);
  4313. __pyx_t_5 = __pyx_PyComplex_FromComplex(__pyx_v_p0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 98, __pyx_L1_error)
  4314. __Pyx_GOTREF(__pyx_t_5);
  4315. __pyx_t_6 = __pyx_PyComplex_FromComplex(__pyx_v_p1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 98, __pyx_L1_error)
  4316. __Pyx_GOTREF(__pyx_t_6);
  4317. __pyx_t_7 = __pyx_PyComplex_FromComplex(__pyx_v_p2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 98, __pyx_L1_error)
  4318. __Pyx_GOTREF(__pyx_t_7);
  4319. __pyx_t_8 = __pyx_PyComplex_FromComplex(__pyx_v_p3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 98, __pyx_L1_error)
  4320. __Pyx_GOTREF(__pyx_t_8);
  4321. __pyx_t_9 = 1;
  4322. #if CYTHON_UNPACK_METHODS
  4323. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  4324. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  4325. assert(__pyx_t_2);
  4326. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  4327. __Pyx_INCREF(__pyx_t_2);
  4328. __Pyx_INCREF(__pyx__function);
  4329. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  4330. __pyx_t_9 = 0;
  4331. }
  4332. #endif
  4333. {
  4334. PyObject *__pyx_callargs[5] = {__pyx_t_2, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8};
  4335. __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));
  4336. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  4337. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4338. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4339. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4340. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4341. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4342. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error)
  4343. __Pyx_GOTREF(__pyx_t_1);
  4344. }
  4345. if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
  4346. PyObject* sequence = __pyx_t_1;
  4347. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  4348. if (unlikely(size != 2)) {
  4349. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  4350. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  4351. __PYX_ERR(0, 98, __pyx_L1_error)
  4352. }
  4353. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  4354. if (likely(PyTuple_CheckExact(sequence))) {
  4355. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  4356. __Pyx_INCREF(__pyx_t_3);
  4357. __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
  4358. __Pyx_INCREF(__pyx_t_8);
  4359. } else {
  4360. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  4361. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error)
  4362. __Pyx_XGOTREF(__pyx_t_3);
  4363. __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  4364. if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 98, __pyx_L1_error)
  4365. __Pyx_XGOTREF(__pyx_t_8);
  4366. }
  4367. #else
  4368. __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error)
  4369. __Pyx_GOTREF(__pyx_t_3);
  4370. __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 98, __pyx_L1_error)
  4371. __Pyx_GOTREF(__pyx_t_8);
  4372. #endif
  4373. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4374. } else {
  4375. Py_ssize_t index = -1;
  4376. __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 98, __pyx_L1_error)
  4377. __Pyx_GOTREF(__pyx_t_7);
  4378. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4379. __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
  4380. index = 0; __pyx_t_3 = __pyx_t_10(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
  4381. __Pyx_GOTREF(__pyx_t_3);
  4382. index = 1; __pyx_t_8 = __pyx_t_10(__pyx_t_7); if (unlikely(!__pyx_t_8)) goto __pyx_L4_unpacking_failed;
  4383. __Pyx_GOTREF(__pyx_t_8);
  4384. if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 98, __pyx_L1_error)
  4385. __pyx_t_10 = NULL;
  4386. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4387. goto __pyx_L5_unpacking_done;
  4388. __pyx_L4_unpacking_failed:;
  4389. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4390. __pyx_t_10 = NULL;
  4391. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  4392. __PYX_ERR(0, 98, __pyx_L1_error)
  4393. __pyx_L5_unpacking_done:;
  4394. }
  4395. __pyx_v_one = __pyx_t_3;
  4396. __pyx_t_3 = 0;
  4397. __pyx_v_two = __pyx_t_8;
  4398. __pyx_t_8 = 0;
  4399. /* "fontTools/misc/bezierTools.py":99
  4400. * else:
  4401. * one, two = _split_cubic_into_two(p0, p1, p2, p3)
  4402. * return _calcCubicArcLengthCRecurse(mult, *one) + _calcCubicArcLengthCRecurse( # <<<<<<<<<<<<<<
  4403. * mult, *two
  4404. * )
  4405. */
  4406. __Pyx_XDECREF(__pyx_r);
  4407. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_calcCubicArcLengthCRecurse); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
  4408. __Pyx_GOTREF(__pyx_t_1);
  4409. __pyx_t_8 = PyFloat_FromDouble(__pyx_v_mult); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 99, __pyx_L1_error)
  4410. __Pyx_GOTREF(__pyx_t_8);
  4411. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 99, __pyx_L1_error)
  4412. __Pyx_GOTREF(__pyx_t_3);
  4413. __Pyx_GIVEREF(__pyx_t_8);
  4414. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8) != (0)) __PYX_ERR(0, 99, __pyx_L1_error);
  4415. __pyx_t_8 = 0;
  4416. __pyx_t_8 = __Pyx_PySequence_Tuple(__pyx_v_one); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 99, __pyx_L1_error)
  4417. __Pyx_GOTREF(__pyx_t_8);
  4418. __pyx_t_7 = PyNumber_Add(__pyx_t_3, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 99, __pyx_L1_error)
  4419. __Pyx_GOTREF(__pyx_t_7);
  4420. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4421. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4422. __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)
  4423. __Pyx_GOTREF(__pyx_t_8);
  4424. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4425. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4426. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_calcCubicArcLengthCRecurse); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 99, __pyx_L1_error)
  4427. __Pyx_GOTREF(__pyx_t_7);
  4428. /* "fontTools/misc/bezierTools.py":100
  4429. * one, two = _split_cubic_into_two(p0, p1, p2, p3)
  4430. * return _calcCubicArcLengthCRecurse(mult, *one) + _calcCubicArcLengthCRecurse(
  4431. * mult, *two # <<<<<<<<<<<<<<
  4432. * )
  4433. *
  4434. */
  4435. __pyx_t_1 = PyFloat_FromDouble(__pyx_v_mult); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error)
  4436. __Pyx_GOTREF(__pyx_t_1);
  4437. /* "fontTools/misc/bezierTools.py":99
  4438. * else:
  4439. * one, two = _split_cubic_into_two(p0, p1, p2, p3)
  4440. * return _calcCubicArcLengthCRecurse(mult, *one) + _calcCubicArcLengthCRecurse( # <<<<<<<<<<<<<<
  4441. * mult, *two
  4442. * )
  4443. */
  4444. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 99, __pyx_L1_error)
  4445. __Pyx_GOTREF(__pyx_t_3);
  4446. __Pyx_GIVEREF(__pyx_t_1);
  4447. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 99, __pyx_L1_error);
  4448. __pyx_t_1 = 0;
  4449. /* "fontTools/misc/bezierTools.py":100
  4450. * one, two = _split_cubic_into_two(p0, p1, p2, p3)
  4451. * return _calcCubicArcLengthCRecurse(mult, *one) + _calcCubicArcLengthCRecurse(
  4452. * mult, *two # <<<<<<<<<<<<<<
  4453. * )
  4454. *
  4455. */
  4456. __pyx_t_1 = __Pyx_PySequence_Tuple(__pyx_v_two); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
  4457. __Pyx_GOTREF(__pyx_t_1);
  4458. /* "fontTools/misc/bezierTools.py":99
  4459. * else:
  4460. * one, two = _split_cubic_into_two(p0, p1, p2, p3)
  4461. * return _calcCubicArcLengthCRecurse(mult, *one) + _calcCubicArcLengthCRecurse( # <<<<<<<<<<<<<<
  4462. * mult, *two
  4463. * )
  4464. */
  4465. __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 99, __pyx_L1_error)
  4466. __Pyx_GOTREF(__pyx_t_6);
  4467. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4468. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4469. __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)
  4470. __Pyx_GOTREF(__pyx_t_1);
  4471. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4472. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4473. __pyx_t_6 = PyNumber_Add(__pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 99, __pyx_L1_error)
  4474. __Pyx_GOTREF(__pyx_t_6);
  4475. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4476. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4477. __pyx_r = __pyx_t_6;
  4478. __pyx_t_6 = 0;
  4479. goto __pyx_L0;
  4480. }
  4481. /* "fontTools/misc/bezierTools.py":84
  4482. *
  4483. *
  4484. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  4485. * @cython.locals(
  4486. * p0=cython.complex,
  4487. */
  4488. /* function exit code */
  4489. __pyx_L1_error:;
  4490. __Pyx_XDECREF(__pyx_t_1);
  4491. __Pyx_XDECREF(__pyx_t_2);
  4492. __Pyx_XDECREF(__pyx_t_3);
  4493. __Pyx_XDECREF(__pyx_t_5);
  4494. __Pyx_XDECREF(__pyx_t_6);
  4495. __Pyx_XDECREF(__pyx_t_7);
  4496. __Pyx_XDECREF(__pyx_t_8);
  4497. __Pyx_AddTraceback("fontTools.misc.bezierTools._calcCubicArcLengthCRecurse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4498. __pyx_r = NULL;
  4499. __pyx_L0:;
  4500. __Pyx_XDECREF(__pyx_v_one);
  4501. __Pyx_XDECREF(__pyx_v_two);
  4502. __Pyx_XGIVEREF(__pyx_r);
  4503. __Pyx_RefNannyFinishContext();
  4504. return __pyx_r;
  4505. }
  4506. /* "fontTools/misc/bezierTools.py":104
  4507. *
  4508. *
  4509. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  4510. * @cython.locals(
  4511. * pt1=cython.complex,
  4512. */
  4513. /* Python wrapper */
  4514. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_7calcCubicArcLengthC(PyObject *__pyx_self,
  4515. #if CYTHON_METH_FASTCALL
  4516. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  4517. #else
  4518. PyObject *__pyx_args, PyObject *__pyx_kwds
  4519. #endif
  4520. ); /*proto*/
  4521. 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.");
  4522. 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};
  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. ) {
  4530. __pyx_t_double_complex __pyx_v_pt1;
  4531. __pyx_t_double_complex __pyx_v_pt2;
  4532. __pyx_t_double_complex __pyx_v_pt3;
  4533. __pyx_t_double_complex __pyx_v_pt4;
  4534. double __pyx_v_tolerance;
  4535. #if !CYTHON_METH_FASTCALL
  4536. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  4537. #endif
  4538. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  4539. PyObject* values[5] = {0,0,0,0,0};
  4540. int __pyx_lineno = 0;
  4541. const char *__pyx_filename = NULL;
  4542. int __pyx_clineno = 0;
  4543. PyObject *__pyx_r = 0;
  4544. __Pyx_RefNannyDeclarations
  4545. __Pyx_RefNannySetupContext("calcCubicArcLengthC (wrapper)", 0);
  4546. #if !CYTHON_METH_FASTCALL
  4547. #if CYTHON_ASSUME_SAFE_SIZE
  4548. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  4549. #else
  4550. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  4551. #endif
  4552. #endif
  4553. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  4554. {
  4555. 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};
  4556. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  4557. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 104, __pyx_L3_error)
  4558. if (__pyx_kwds_len > 0) {
  4559. switch (__pyx_nargs) {
  4560. case 5:
  4561. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  4562. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 104, __pyx_L3_error)
  4563. CYTHON_FALLTHROUGH;
  4564. case 4:
  4565. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  4566. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 104, __pyx_L3_error)
  4567. CYTHON_FALLTHROUGH;
  4568. case 3:
  4569. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  4570. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 104, __pyx_L3_error)
  4571. CYTHON_FALLTHROUGH;
  4572. case 2:
  4573. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  4574. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 104, __pyx_L3_error)
  4575. CYTHON_FALLTHROUGH;
  4576. case 1:
  4577. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  4578. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 104, __pyx_L3_error)
  4579. CYTHON_FALLTHROUGH;
  4580. case 0: break;
  4581. default: goto __pyx_L5_argtuple_error;
  4582. }
  4583. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  4584. 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)
  4585. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  4586. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("calcCubicArcLengthC", 0, 4, 5, i); __PYX_ERR(0, 104, __pyx_L3_error) }
  4587. }
  4588. } else {
  4589. switch (__pyx_nargs) {
  4590. case 5:
  4591. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  4592. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 104, __pyx_L3_error)
  4593. CYTHON_FALLTHROUGH;
  4594. case 4:
  4595. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  4596. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 104, __pyx_L3_error)
  4597. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  4598. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 104, __pyx_L3_error)
  4599. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  4600. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 104, __pyx_L3_error)
  4601. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  4602. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 104, __pyx_L3_error)
  4603. break;
  4604. default: goto __pyx_L5_argtuple_error;
  4605. }
  4606. }
  4607. __pyx_v_pt1 = __Pyx_PyComplex_As___pyx_t_double_complex(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L3_error)
  4608. __pyx_v_pt2 = __Pyx_PyComplex_As___pyx_t_double_complex(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L3_error)
  4609. __pyx_v_pt3 = __Pyx_PyComplex_As___pyx_t_double_complex(values[2]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L3_error)
  4610. __pyx_v_pt4 = __Pyx_PyComplex_As___pyx_t_double_complex(values[3]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L3_error)
  4611. if (values[4]) {
  4612. __pyx_v_tolerance = __Pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_tolerance == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L3_error)
  4613. } else {
  4614. __pyx_v_tolerance = ((double)((double)0.005));
  4615. }
  4616. }
  4617. goto __pyx_L6_skip;
  4618. __pyx_L5_argtuple_error:;
  4619. __Pyx_RaiseArgtupleInvalid("calcCubicArcLengthC", 0, 4, 5, __pyx_nargs); __PYX_ERR(0, 104, __pyx_L3_error)
  4620. __pyx_L6_skip:;
  4621. goto __pyx_L4_argument_unpacking_done;
  4622. __pyx_L3_error:;
  4623. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  4624. Py_XDECREF(values[__pyx_temp]);
  4625. }
  4626. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcCubicArcLengthC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4627. __Pyx_RefNannyFinishContext();
  4628. return NULL;
  4629. __pyx_L4_argument_unpacking_done:;
  4630. __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);
  4631. /* function exit code */
  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_RefNannyFinishContext();
  4636. return __pyx_r;
  4637. }
  4638. 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) {
  4639. double __pyx_v_mult;
  4640. PyObject *__pyx_r = NULL;
  4641. __Pyx_RefNannyDeclarations
  4642. PyObject *__pyx_t_1 = NULL;
  4643. PyObject *__pyx_t_2 = NULL;
  4644. PyObject *__pyx_t_3 = NULL;
  4645. PyObject *__pyx_t_4 = NULL;
  4646. PyObject *__pyx_t_5 = NULL;
  4647. PyObject *__pyx_t_6 = NULL;
  4648. PyObject *__pyx_t_7 = NULL;
  4649. PyObject *__pyx_t_8 = NULL;
  4650. size_t __pyx_t_9;
  4651. int __pyx_lineno = 0;
  4652. const char *__pyx_filename = NULL;
  4653. int __pyx_clineno = 0;
  4654. __Pyx_RefNannySetupContext("calcCubicArcLengthC", 0);
  4655. /* "fontTools/misc/bezierTools.py":125
  4656. * Arc length value.
  4657. * """
  4658. * mult = 1.0 + 1.5 * tolerance # The 1.5 is a empirical hack; no math # <<<<<<<<<<<<<<
  4659. * return _calcCubicArcLengthCRecurse(mult, pt1, pt2, pt3, pt4)
  4660. *
  4661. */
  4662. __pyx_v_mult = (1.0 + (1.5 * __pyx_v_tolerance));
  4663. /* "fontTools/misc/bezierTools.py":126
  4664. * """
  4665. * mult = 1.0 + 1.5 * tolerance # The 1.5 is a empirical hack; no math
  4666. * return _calcCubicArcLengthCRecurse(mult, pt1, pt2, pt3, pt4) # <<<<<<<<<<<<<<
  4667. *
  4668. *
  4669. */
  4670. __Pyx_XDECREF(__pyx_r);
  4671. __pyx_t_2 = NULL;
  4672. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_calcCubicArcLengthCRecurse); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 126, __pyx_L1_error)
  4673. __Pyx_GOTREF(__pyx_t_3);
  4674. __pyx_t_4 = PyFloat_FromDouble(__pyx_v_mult); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 126, __pyx_L1_error)
  4675. __Pyx_GOTREF(__pyx_t_4);
  4676. __pyx_t_5 = __pyx_PyComplex_FromComplex(__pyx_v_pt1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 126, __pyx_L1_error)
  4677. __Pyx_GOTREF(__pyx_t_5);
  4678. __pyx_t_6 = __pyx_PyComplex_FromComplex(__pyx_v_pt2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 126, __pyx_L1_error)
  4679. __Pyx_GOTREF(__pyx_t_6);
  4680. __pyx_t_7 = __pyx_PyComplex_FromComplex(__pyx_v_pt3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 126, __pyx_L1_error)
  4681. __Pyx_GOTREF(__pyx_t_7);
  4682. __pyx_t_8 = __pyx_PyComplex_FromComplex(__pyx_v_pt4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 126, __pyx_L1_error)
  4683. __Pyx_GOTREF(__pyx_t_8);
  4684. __pyx_t_9 = 1;
  4685. #if CYTHON_UNPACK_METHODS
  4686. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  4687. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  4688. assert(__pyx_t_2);
  4689. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  4690. __Pyx_INCREF(__pyx_t_2);
  4691. __Pyx_INCREF(__pyx__function);
  4692. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  4693. __pyx_t_9 = 0;
  4694. }
  4695. #endif
  4696. {
  4697. PyObject *__pyx_callargs[6] = {__pyx_t_2, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8};
  4698. __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));
  4699. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  4700. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4701. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4702. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  4703. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  4704. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4705. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4706. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error)
  4707. __Pyx_GOTREF(__pyx_t_1);
  4708. }
  4709. __pyx_r = __pyx_t_1;
  4710. __pyx_t_1 = 0;
  4711. goto __pyx_L0;
  4712. /* "fontTools/misc/bezierTools.py":104
  4713. *
  4714. *
  4715. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  4716. * @cython.locals(
  4717. * pt1=cython.complex,
  4718. */
  4719. /* function exit code */
  4720. __pyx_L1_error:;
  4721. __Pyx_XDECREF(__pyx_t_1);
  4722. __Pyx_XDECREF(__pyx_t_2);
  4723. __Pyx_XDECREF(__pyx_t_3);
  4724. __Pyx_XDECREF(__pyx_t_4);
  4725. __Pyx_XDECREF(__pyx_t_5);
  4726. __Pyx_XDECREF(__pyx_t_6);
  4727. __Pyx_XDECREF(__pyx_t_7);
  4728. __Pyx_XDECREF(__pyx_t_8);
  4729. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcCubicArcLengthC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4730. __pyx_r = NULL;
  4731. __pyx_L0:;
  4732. __Pyx_XGIVEREF(__pyx_r);
  4733. __Pyx_RefNannyFinishContext();
  4734. return __pyx_r;
  4735. }
  4736. /* "fontTools/misc/bezierTools.py":133
  4737. *
  4738. *
  4739. * @cython.cfunc # <<<<<<<<<<<<<<
  4740. * @cython.inline
  4741. * @cython.returns(cython.double)
  4742. */
  4743. static CYTHON_INLINE double __pyx_f_9fontTools_4misc_11bezierTools__dot(__pyx_t_double_complex __pyx_v_v1, __pyx_t_double_complex __pyx_v_v2) {
  4744. double __pyx_r;
  4745. /* "fontTools/misc/bezierTools.py":138
  4746. * @cython.locals(v1=cython.complex, v2=cython.complex)
  4747. * def _dot(v1, v2):
  4748. * return (v1 * v2.conjugate()).real # <<<<<<<<<<<<<<
  4749. *
  4750. *
  4751. */
  4752. __pyx_r = __Pyx_CREAL(__Pyx_c_prod_double(__pyx_v_v1, __Pyx_c_conj_double(__pyx_v_v2)));
  4753. goto __pyx_L0;
  4754. /* "fontTools/misc/bezierTools.py":133
  4755. *
  4756. *
  4757. * @cython.cfunc # <<<<<<<<<<<<<<
  4758. * @cython.inline
  4759. * @cython.returns(cython.double)
  4760. */
  4761. /* function exit code */
  4762. __pyx_L0:;
  4763. return __pyx_r;
  4764. }
  4765. /* "fontTools/misc/bezierTools.py":141
  4766. *
  4767. *
  4768. * @cython.cfunc # <<<<<<<<<<<<<<
  4769. * @cython.inline
  4770. * @cython.returns(cython.double)
  4771. */
  4772. static CYTHON_INLINE double __pyx_f_9fontTools_4misc_11bezierTools__intSecAtan(double __pyx_v_x) {
  4773. double __pyx_r;
  4774. __Pyx_RefNannyDeclarations
  4775. PyObject *__pyx_t_1 = NULL;
  4776. PyObject *__pyx_t_2 = NULL;
  4777. PyObject *__pyx_t_3 = NULL;
  4778. PyObject *__pyx_t_4 = NULL;
  4779. PyObject *__pyx_t_5 = NULL;
  4780. size_t __pyx_t_6;
  4781. double __pyx_t_7;
  4782. int __pyx_lineno = 0;
  4783. const char *__pyx_filename = NULL;
  4784. int __pyx_clineno = 0;
  4785. __Pyx_RefNannySetupContext("_intSecAtan", 0);
  4786. /* "fontTools/misc/bezierTools.py":148
  4787. * # In : sympy.integrate(sp.sec(sp.atan(x)))
  4788. * # Out: x*sqrt(x**2 + 1)/2 + asinh(x)/2
  4789. * return x * math.sqrt(x**2 + 1) / 2 + math.asinh(x) / 2 # <<<<<<<<<<<<<<
  4790. *
  4791. *
  4792. */
  4793. __pyx_t_1 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
  4794. __Pyx_GOTREF(__pyx_t_1);
  4795. __pyx_t_3 = NULL;
  4796. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error)
  4797. __Pyx_GOTREF(__pyx_t_4);
  4798. __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)
  4799. __Pyx_GOTREF(__pyx_t_5);
  4800. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4801. __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)
  4802. __Pyx_GOTREF(__pyx_t_4);
  4803. __pyx_t_6 = 1;
  4804. #if CYTHON_UNPACK_METHODS
  4805. if (unlikely(PyMethod_Check(__pyx_t_5))) {
  4806. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
  4807. assert(__pyx_t_3);
  4808. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
  4809. __Pyx_INCREF(__pyx_t_3);
  4810. __Pyx_INCREF(__pyx__function);
  4811. __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
  4812. __pyx_t_6 = 0;
  4813. }
  4814. #endif
  4815. {
  4816. PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
  4817. __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));
  4818. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  4819. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4820. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4821. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error)
  4822. __Pyx_GOTREF(__pyx_t_2);
  4823. }
  4824. __pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error)
  4825. __Pyx_GOTREF(__pyx_t_5);
  4826. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  4827. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4828. __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)
  4829. __Pyx_GOTREF(__pyx_t_2);
  4830. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4831. __pyx_t_1 = NULL;
  4832. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error)
  4833. __Pyx_GOTREF(__pyx_t_4);
  4834. __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)
  4835. __Pyx_GOTREF(__pyx_t_3);
  4836. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4837. __pyx_t_4 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error)
  4838. __Pyx_GOTREF(__pyx_t_4);
  4839. __pyx_t_6 = 1;
  4840. #if CYTHON_UNPACK_METHODS
  4841. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  4842. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
  4843. assert(__pyx_t_1);
  4844. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  4845. __Pyx_INCREF(__pyx_t_1);
  4846. __Pyx_INCREF(__pyx__function);
  4847. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  4848. __pyx_t_6 = 0;
  4849. }
  4850. #endif
  4851. {
  4852. PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_4};
  4853. __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));
  4854. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  4855. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  4856. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4857. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error)
  4858. __Pyx_GOTREF(__pyx_t_5);
  4859. }
  4860. __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)
  4861. __Pyx_GOTREF(__pyx_t_3);
  4862. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4863. __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error)
  4864. __Pyx_GOTREF(__pyx_t_5);
  4865. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  4866. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4867. __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)
  4868. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  4869. __pyx_r = __pyx_t_7;
  4870. goto __pyx_L0;
  4871. /* "fontTools/misc/bezierTools.py":141
  4872. *
  4873. *
  4874. * @cython.cfunc # <<<<<<<<<<<<<<
  4875. * @cython.inline
  4876. * @cython.returns(cython.double)
  4877. */
  4878. /* function exit code */
  4879. __pyx_L1_error:;
  4880. __Pyx_XDECREF(__pyx_t_1);
  4881. __Pyx_XDECREF(__pyx_t_2);
  4882. __Pyx_XDECREF(__pyx_t_3);
  4883. __Pyx_XDECREF(__pyx_t_4);
  4884. __Pyx_XDECREF(__pyx_t_5);
  4885. __Pyx_AddTraceback("fontTools.misc.bezierTools._intSecAtan", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4886. __pyx_r = -1;
  4887. __pyx_L0:;
  4888. __Pyx_RefNannyFinishContext();
  4889. return __pyx_r;
  4890. }
  4891. /* "fontTools/misc/bezierTools.py":151
  4892. *
  4893. *
  4894. * def calcQuadraticArcLength(pt1, pt2, pt3): # <<<<<<<<<<<<<<
  4895. * """Calculates the arc length for a quadratic Bezier segment.
  4896. *
  4897. */
  4898. /* Python wrapper */
  4899. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_9calcQuadraticArcLength(PyObject *__pyx_self,
  4900. #if CYTHON_METH_FASTCALL
  4901. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  4902. #else
  4903. PyObject *__pyx_args, PyObject *__pyx_kwds
  4904. #endif
  4905. ); /*proto*/
  4906. 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");
  4907. 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};
  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. ) {
  4915. PyObject *__pyx_v_pt1 = 0;
  4916. PyObject *__pyx_v_pt2 = 0;
  4917. PyObject *__pyx_v_pt3 = 0;
  4918. #if !CYTHON_METH_FASTCALL
  4919. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  4920. #endif
  4921. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  4922. PyObject* values[3] = {0,0,0};
  4923. int __pyx_lineno = 0;
  4924. const char *__pyx_filename = NULL;
  4925. int __pyx_clineno = 0;
  4926. PyObject *__pyx_r = 0;
  4927. __Pyx_RefNannyDeclarations
  4928. __Pyx_RefNannySetupContext("calcQuadraticArcLength (wrapper)", 0);
  4929. #if !CYTHON_METH_FASTCALL
  4930. #if CYTHON_ASSUME_SAFE_SIZE
  4931. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  4932. #else
  4933. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  4934. #endif
  4935. #endif
  4936. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  4937. {
  4938. 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};
  4939. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  4940. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 151, __pyx_L3_error)
  4941. if (__pyx_kwds_len > 0) {
  4942. switch (__pyx_nargs) {
  4943. case 3:
  4944. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  4945. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 151, __pyx_L3_error)
  4946. CYTHON_FALLTHROUGH;
  4947. case 2:
  4948. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  4949. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 151, __pyx_L3_error)
  4950. CYTHON_FALLTHROUGH;
  4951. case 1:
  4952. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  4953. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 151, __pyx_L3_error)
  4954. CYTHON_FALLTHROUGH;
  4955. case 0: break;
  4956. default: goto __pyx_L5_argtuple_error;
  4957. }
  4958. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  4959. 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)
  4960. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  4961. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("calcQuadraticArcLength", 1, 3, 3, i); __PYX_ERR(0, 151, __pyx_L3_error) }
  4962. }
  4963. } else if (unlikely(__pyx_nargs != 3)) {
  4964. goto __pyx_L5_argtuple_error;
  4965. } else {
  4966. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  4967. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 151, __pyx_L3_error)
  4968. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  4969. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 151, __pyx_L3_error)
  4970. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  4971. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 151, __pyx_L3_error)
  4972. }
  4973. __pyx_v_pt1 = values[0];
  4974. __pyx_v_pt2 = values[1];
  4975. __pyx_v_pt3 = values[2];
  4976. }
  4977. goto __pyx_L6_skip;
  4978. __pyx_L5_argtuple_error:;
  4979. __Pyx_RaiseArgtupleInvalid("calcQuadraticArcLength", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 151, __pyx_L3_error)
  4980. __pyx_L6_skip:;
  4981. goto __pyx_L4_argument_unpacking_done;
  4982. __pyx_L3_error:;
  4983. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  4984. Py_XDECREF(values[__pyx_temp]);
  4985. }
  4986. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcQuadraticArcLength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4987. __Pyx_RefNannyFinishContext();
  4988. return NULL;
  4989. __pyx_L4_argument_unpacking_done:;
  4990. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_8calcQuadraticArcLength(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3);
  4991. /* function exit code */
  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_RefNannyFinishContext();
  4996. return __pyx_r;
  4997. }
  4998. 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) {
  4999. PyObject *__pyx_r = NULL;
  5000. __Pyx_RefNannyDeclarations
  5001. PyObject *__pyx_t_1 = NULL;
  5002. PyObject *__pyx_t_2 = NULL;
  5003. PyObject *__pyx_t_3 = NULL;
  5004. PyObject *__pyx_t_4 = NULL;
  5005. PyObject *__pyx_t_5 = NULL;
  5006. PyObject *__pyx_t_6 = NULL;
  5007. PyObject *__pyx_t_7 = NULL;
  5008. size_t __pyx_t_8;
  5009. int __pyx_lineno = 0;
  5010. const char *__pyx_filename = NULL;
  5011. int __pyx_clineno = 0;
  5012. __Pyx_RefNannySetupContext("calcQuadraticArcLength", 0);
  5013. /* "fontTools/misc/bezierTools.py":183
  5014. * 40.0
  5015. * """
  5016. * return calcQuadraticArcLengthC(complex(*pt1), complex(*pt2), complex(*pt3)) # <<<<<<<<<<<<<<
  5017. *
  5018. *
  5019. */
  5020. __Pyx_XDECREF(__pyx_r);
  5021. __pyx_t_2 = NULL;
  5022. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_calcQuadraticArcLengthC); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 183, __pyx_L1_error)
  5023. __Pyx_GOTREF(__pyx_t_3);
  5024. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 183, __pyx_L1_error)
  5025. __Pyx_GOTREF(__pyx_t_4);
  5026. __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)
  5027. __Pyx_GOTREF(__pyx_t_5);
  5028. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5029. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 183, __pyx_L1_error)
  5030. __Pyx_GOTREF(__pyx_t_4);
  5031. __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)
  5032. __Pyx_GOTREF(__pyx_t_6);
  5033. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5034. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 183, __pyx_L1_error)
  5035. __Pyx_GOTREF(__pyx_t_4);
  5036. __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)
  5037. __Pyx_GOTREF(__pyx_t_7);
  5038. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5039. __pyx_t_8 = 1;
  5040. #if CYTHON_UNPACK_METHODS
  5041. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  5042. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  5043. assert(__pyx_t_2);
  5044. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  5045. __Pyx_INCREF(__pyx_t_2);
  5046. __Pyx_INCREF(__pyx__function);
  5047. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  5048. __pyx_t_8 = 0;
  5049. }
  5050. #endif
  5051. {
  5052. PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_t_5, __pyx_t_6, __pyx_t_7};
  5053. __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));
  5054. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  5055. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5056. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5057. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5058. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5059. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 183, __pyx_L1_error)
  5060. __Pyx_GOTREF(__pyx_t_1);
  5061. }
  5062. __pyx_r = __pyx_t_1;
  5063. __pyx_t_1 = 0;
  5064. goto __pyx_L0;
  5065. /* "fontTools/misc/bezierTools.py":151
  5066. *
  5067. *
  5068. * def calcQuadraticArcLength(pt1, pt2, pt3): # <<<<<<<<<<<<<<
  5069. * """Calculates the arc length for a quadratic Bezier segment.
  5070. *
  5071. */
  5072. /* function exit code */
  5073. __pyx_L1_error:;
  5074. __Pyx_XDECREF(__pyx_t_1);
  5075. __Pyx_XDECREF(__pyx_t_2);
  5076. __Pyx_XDECREF(__pyx_t_3);
  5077. __Pyx_XDECREF(__pyx_t_4);
  5078. __Pyx_XDECREF(__pyx_t_5);
  5079. __Pyx_XDECREF(__pyx_t_6);
  5080. __Pyx_XDECREF(__pyx_t_7);
  5081. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcQuadraticArcLength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5082. __pyx_r = NULL;
  5083. __pyx_L0:;
  5084. __Pyx_XGIVEREF(__pyx_r);
  5085. __Pyx_RefNannyFinishContext();
  5086. return __pyx_r;
  5087. }
  5088. /* "fontTools/misc/bezierTools.py":186
  5089. *
  5090. *
  5091. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  5092. * @cython.locals(
  5093. * pt1=cython.complex,
  5094. */
  5095. /* Python wrapper */
  5096. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_11calcQuadraticArcLengthC(PyObject *__pyx_self,
  5097. #if CYTHON_METH_FASTCALL
  5098. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  5099. #else
  5100. PyObject *__pyx_args, PyObject *__pyx_kwds
  5101. #endif
  5102. ); /*proto*/
  5103. 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.");
  5104. 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};
  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. ) {
  5112. __pyx_t_double_complex __pyx_v_pt1;
  5113. __pyx_t_double_complex __pyx_v_pt2;
  5114. __pyx_t_double_complex __pyx_v_pt3;
  5115. #if !CYTHON_METH_FASTCALL
  5116. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  5117. #endif
  5118. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  5119. PyObject* values[3] = {0,0,0};
  5120. int __pyx_lineno = 0;
  5121. const char *__pyx_filename = NULL;
  5122. int __pyx_clineno = 0;
  5123. PyObject *__pyx_r = 0;
  5124. __Pyx_RefNannyDeclarations
  5125. __Pyx_RefNannySetupContext("calcQuadraticArcLengthC (wrapper)", 0);
  5126. #if !CYTHON_METH_FASTCALL
  5127. #if CYTHON_ASSUME_SAFE_SIZE
  5128. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  5129. #else
  5130. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  5131. #endif
  5132. #endif
  5133. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  5134. {
  5135. 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};
  5136. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  5137. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 186, __pyx_L3_error)
  5138. if (__pyx_kwds_len > 0) {
  5139. switch (__pyx_nargs) {
  5140. case 3:
  5141. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  5142. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 186, __pyx_L3_error)
  5143. CYTHON_FALLTHROUGH;
  5144. case 2:
  5145. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  5146. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 186, __pyx_L3_error)
  5147. CYTHON_FALLTHROUGH;
  5148. case 1:
  5149. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  5150. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 186, __pyx_L3_error)
  5151. CYTHON_FALLTHROUGH;
  5152. case 0: break;
  5153. default: goto __pyx_L5_argtuple_error;
  5154. }
  5155. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  5156. 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)
  5157. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  5158. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("calcQuadraticArcLengthC", 1, 3, 3, i); __PYX_ERR(0, 186, __pyx_L3_error) }
  5159. }
  5160. } else if (unlikely(__pyx_nargs != 3)) {
  5161. goto __pyx_L5_argtuple_error;
  5162. } else {
  5163. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  5164. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 186, __pyx_L3_error)
  5165. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  5166. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 186, __pyx_L3_error)
  5167. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  5168. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 186, __pyx_L3_error)
  5169. }
  5170. __pyx_v_pt1 = __Pyx_PyComplex_As___pyx_t_double_complex(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 205, __pyx_L3_error)
  5171. __pyx_v_pt2 = __Pyx_PyComplex_As___pyx_t_double_complex(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 205, __pyx_L3_error)
  5172. __pyx_v_pt3 = __Pyx_PyComplex_As___pyx_t_double_complex(values[2]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 205, __pyx_L3_error)
  5173. }
  5174. goto __pyx_L6_skip;
  5175. __pyx_L5_argtuple_error:;
  5176. __Pyx_RaiseArgtupleInvalid("calcQuadraticArcLengthC", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 186, __pyx_L3_error)
  5177. __pyx_L6_skip:;
  5178. goto __pyx_L4_argument_unpacking_done;
  5179. __pyx_L3_error:;
  5180. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  5181. Py_XDECREF(values[__pyx_temp]);
  5182. }
  5183. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcQuadraticArcLengthC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5184. __Pyx_RefNannyFinishContext();
  5185. return NULL;
  5186. __pyx_L4_argument_unpacking_done:;
  5187. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_10calcQuadraticArcLengthC(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3);
  5188. /* function exit code */
  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_RefNannyFinishContext();
  5193. return __pyx_r;
  5194. }
  5195. 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) {
  5196. double __pyx_v_scale;
  5197. double __pyx_v_origDist;
  5198. double __pyx_v_a;
  5199. double __pyx_v_b;
  5200. double __pyx_v_x0;
  5201. double __pyx_v_x1;
  5202. double __pyx_v_Len;
  5203. __pyx_t_double_complex __pyx_v_d0;
  5204. __pyx_t_double_complex __pyx_v_d1;
  5205. __pyx_t_double_complex __pyx_v_d;
  5206. __pyx_t_double_complex __pyx_v_n;
  5207. PyObject *__pyx_r = NULL;
  5208. __Pyx_RefNannyDeclarations
  5209. int __pyx_t_1;
  5210. PyObject *__pyx_t_2 = NULL;
  5211. double __pyx_t_3;
  5212. PyObject *__pyx_t_4 = NULL;
  5213. PyObject *__pyx_t_5 = NULL;
  5214. double __pyx_t_6;
  5215. double __pyx_t_7;
  5216. int __pyx_lineno = 0;
  5217. const char *__pyx_filename = NULL;
  5218. int __pyx_clineno = 0;
  5219. __Pyx_RefNannySetupContext("calcQuadraticArcLengthC", 0);
  5220. /* "fontTools/misc/bezierTools.py":218
  5221. * # Analytical solution to the length of a quadratic bezier.
  5222. * # Documentation: https://github.com/fonttools/fonttools/issues/3055
  5223. * d0 = pt2 - pt1 # <<<<<<<<<<<<<<
  5224. * d1 = pt3 - pt2
  5225. * d = d1 - d0
  5226. */
  5227. __pyx_v_d0 = __Pyx_c_diff_double(__pyx_v_pt2, __pyx_v_pt1);
  5228. /* "fontTools/misc/bezierTools.py":219
  5229. * # Documentation: https://github.com/fonttools/fonttools/issues/3055
  5230. * d0 = pt2 - pt1
  5231. * d1 = pt3 - pt2 # <<<<<<<<<<<<<<
  5232. * d = d1 - d0
  5233. * n = d * 1j
  5234. */
  5235. __pyx_v_d1 = __Pyx_c_diff_double(__pyx_v_pt3, __pyx_v_pt2);
  5236. /* "fontTools/misc/bezierTools.py":220
  5237. * d0 = pt2 - pt1
  5238. * d1 = pt3 - pt2
  5239. * d = d1 - d0 # <<<<<<<<<<<<<<
  5240. * n = d * 1j
  5241. * scale = abs(n)
  5242. */
  5243. __pyx_v_d = __Pyx_c_diff_double(__pyx_v_d1, __pyx_v_d0);
  5244. /* "fontTools/misc/bezierTools.py":221
  5245. * d1 = pt3 - pt2
  5246. * d = d1 - d0
  5247. * n = d * 1j # <<<<<<<<<<<<<<
  5248. * scale = abs(n)
  5249. * if scale == 0.0:
  5250. */
  5251. __pyx_v_n = __Pyx_c_prod_double(__pyx_v_d, __pyx_t_double_complex_from_parts(0, 1.0));
  5252. /* "fontTools/misc/bezierTools.py":222
  5253. * d = d1 - d0
  5254. * n = d * 1j
  5255. * scale = abs(n) # <<<<<<<<<<<<<<
  5256. * if scale == 0.0:
  5257. * return abs(pt3 - pt1)
  5258. */
  5259. __pyx_v_scale = __Pyx_c_abs_double(__pyx_v_n);
  5260. /* "fontTools/misc/bezierTools.py":223
  5261. * n = d * 1j
  5262. * scale = abs(n)
  5263. * if scale == 0.0: # <<<<<<<<<<<<<<
  5264. * return abs(pt3 - pt1)
  5265. * origDist = _dot(n, d0)
  5266. */
  5267. __pyx_t_1 = (__pyx_v_scale == 0.0);
  5268. if (__pyx_t_1) {
  5269. /* "fontTools/misc/bezierTools.py":224
  5270. * scale = abs(n)
  5271. * if scale == 0.0:
  5272. * return abs(pt3 - pt1) # <<<<<<<<<<<<<<
  5273. * origDist = _dot(n, d0)
  5274. * if abs(origDist) < epsilon:
  5275. */
  5276. __Pyx_XDECREF(__pyx_r);
  5277. __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)
  5278. __Pyx_GOTREF(__pyx_t_2);
  5279. __pyx_r = __pyx_t_2;
  5280. __pyx_t_2 = 0;
  5281. goto __pyx_L0;
  5282. /* "fontTools/misc/bezierTools.py":223
  5283. * n = d * 1j
  5284. * scale = abs(n)
  5285. * if scale == 0.0: # <<<<<<<<<<<<<<
  5286. * return abs(pt3 - pt1)
  5287. * origDist = _dot(n, d0)
  5288. */
  5289. }
  5290. /* "fontTools/misc/bezierTools.py":225
  5291. * if scale == 0.0:
  5292. * return abs(pt3 - pt1)
  5293. * origDist = _dot(n, d0) # <<<<<<<<<<<<<<
  5294. * if abs(origDist) < epsilon:
  5295. * if _dot(d0, d1) >= 0:
  5296. */
  5297. __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)
  5298. __pyx_v_origDist = __pyx_t_3;
  5299. /* "fontTools/misc/bezierTools.py":226
  5300. * return abs(pt3 - pt1)
  5301. * origDist = _dot(n, d0)
  5302. * if abs(origDist) < epsilon: # <<<<<<<<<<<<<<
  5303. * if _dot(d0, d1) >= 0:
  5304. * return abs(pt3 - pt1)
  5305. */
  5306. __pyx_t_3 = fabs(__pyx_v_origDist);
  5307. __pyx_t_2 = PyFloat_FromDouble(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __pyx_L1_error)
  5308. __Pyx_GOTREF(__pyx_t_2);
  5309. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 226, __pyx_L1_error)
  5310. __Pyx_GOTREF(__pyx_t_4);
  5311. __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)
  5312. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  5313. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5314. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 226, __pyx_L1_error)
  5315. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5316. if (__pyx_t_1) {
  5317. /* "fontTools/misc/bezierTools.py":227
  5318. * origDist = _dot(n, d0)
  5319. * if abs(origDist) < epsilon:
  5320. * if _dot(d0, d1) >= 0: # <<<<<<<<<<<<<<
  5321. * return abs(pt3 - pt1)
  5322. * a, b = abs(d0), abs(d1)
  5323. */
  5324. __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)
  5325. __pyx_t_1 = (__pyx_t_3 >= 0.0);
  5326. if (__pyx_t_1) {
  5327. /* "fontTools/misc/bezierTools.py":228
  5328. * if abs(origDist) < epsilon:
  5329. * if _dot(d0, d1) >= 0:
  5330. * return abs(pt3 - pt1) # <<<<<<<<<<<<<<
  5331. * a, b = abs(d0), abs(d1)
  5332. * return (a * a + b * b) / (a + b)
  5333. */
  5334. __Pyx_XDECREF(__pyx_r);
  5335. __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)
  5336. __Pyx_GOTREF(__pyx_t_5);
  5337. __pyx_r = __pyx_t_5;
  5338. __pyx_t_5 = 0;
  5339. goto __pyx_L0;
  5340. /* "fontTools/misc/bezierTools.py":227
  5341. * origDist = _dot(n, d0)
  5342. * if abs(origDist) < epsilon:
  5343. * if _dot(d0, d1) >= 0: # <<<<<<<<<<<<<<
  5344. * return abs(pt3 - pt1)
  5345. * a, b = abs(d0), abs(d1)
  5346. */
  5347. }
  5348. /* "fontTools/misc/bezierTools.py":229
  5349. * if _dot(d0, d1) >= 0:
  5350. * return abs(pt3 - pt1)
  5351. * a, b = abs(d0), abs(d1) # <<<<<<<<<<<<<<
  5352. * return (a * a + b * b) / (a + b)
  5353. * x0 = _dot(d, d0) / origDist
  5354. */
  5355. __pyx_t_3 = __Pyx_c_abs_double(__pyx_v_d0);
  5356. __pyx_t_6 = __Pyx_c_abs_double(__pyx_v_d1);
  5357. __pyx_v_a = __pyx_t_3;
  5358. __pyx_v_b = __pyx_t_6;
  5359. /* "fontTools/misc/bezierTools.py":230
  5360. * return abs(pt3 - pt1)
  5361. * a, b = abs(d0), abs(d1)
  5362. * return (a * a + b * b) / (a + b) # <<<<<<<<<<<<<<
  5363. * x0 = _dot(d, d0) / origDist
  5364. * x1 = _dot(d, d1) / origDist
  5365. */
  5366. __Pyx_XDECREF(__pyx_r);
  5367. __pyx_t_6 = ((__pyx_v_a * __pyx_v_a) + (__pyx_v_b * __pyx_v_b));
  5368. __pyx_t_3 = (__pyx_v_a + __pyx_v_b);
  5369. if (unlikely(__pyx_t_3 == 0)) {
  5370. PyErr_SetString(PyExc_ZeroDivisionError, "float division");
  5371. __PYX_ERR(0, 230, __pyx_L1_error)
  5372. }
  5373. __pyx_t_5 = PyFloat_FromDouble((__pyx_t_6 / __pyx_t_3)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 230, __pyx_L1_error)
  5374. __Pyx_GOTREF(__pyx_t_5);
  5375. __pyx_r = __pyx_t_5;
  5376. __pyx_t_5 = 0;
  5377. goto __pyx_L0;
  5378. /* "fontTools/misc/bezierTools.py":226
  5379. * return abs(pt3 - pt1)
  5380. * origDist = _dot(n, d0)
  5381. * if abs(origDist) < epsilon: # <<<<<<<<<<<<<<
  5382. * if _dot(d0, d1) >= 0:
  5383. * return abs(pt3 - pt1)
  5384. */
  5385. }
  5386. /* "fontTools/misc/bezierTools.py":231
  5387. * a, b = abs(d0), abs(d1)
  5388. * return (a * a + b * b) / (a + b)
  5389. * x0 = _dot(d, d0) / origDist # <<<<<<<<<<<<<<
  5390. * x1 = _dot(d, d1) / origDist
  5391. * Len = abs(2 * (_intSecAtan(x1) - _intSecAtan(x0)) * origDist / (scale * (x1 - x0)))
  5392. */
  5393. __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)
  5394. if (unlikely(__pyx_v_origDist == 0)) {
  5395. PyErr_SetString(PyExc_ZeroDivisionError, "float division");
  5396. __PYX_ERR(0, 231, __pyx_L1_error)
  5397. }
  5398. __pyx_v_x0 = (__pyx_t_3 / __pyx_v_origDist);
  5399. /* "fontTools/misc/bezierTools.py":232
  5400. * return (a * a + b * b) / (a + b)
  5401. * x0 = _dot(d, d0) / origDist
  5402. * x1 = _dot(d, d1) / origDist # <<<<<<<<<<<<<<
  5403. * Len = abs(2 * (_intSecAtan(x1) - _intSecAtan(x0)) * origDist / (scale * (x1 - x0)))
  5404. * return Len
  5405. */
  5406. __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)
  5407. if (unlikely(__pyx_v_origDist == 0)) {
  5408. PyErr_SetString(PyExc_ZeroDivisionError, "float division");
  5409. __PYX_ERR(0, 232, __pyx_L1_error)
  5410. }
  5411. __pyx_v_x1 = (__pyx_t_3 / __pyx_v_origDist);
  5412. /* "fontTools/misc/bezierTools.py":233
  5413. * x0 = _dot(d, d0) / origDist
  5414. * x1 = _dot(d, d1) / origDist
  5415. * Len = abs(2 * (_intSecAtan(x1) - _intSecAtan(x0)) * origDist / (scale * (x1 - x0))) # <<<<<<<<<<<<<<
  5416. * return Len
  5417. *
  5418. */
  5419. __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)
  5420. __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)
  5421. __pyx_t_7 = ((2.0 * (__pyx_t_3 - __pyx_t_6)) * __pyx_v_origDist);
  5422. __pyx_t_6 = (__pyx_v_scale * (__pyx_v_x1 - __pyx_v_x0));
  5423. if (unlikely(__pyx_t_6 == 0)) {
  5424. PyErr_SetString(PyExc_ZeroDivisionError, "float division");
  5425. __PYX_ERR(0, 233, __pyx_L1_error)
  5426. }
  5427. __pyx_t_3 = fabs((__pyx_t_7 / __pyx_t_6));
  5428. __pyx_v_Len = __pyx_t_3;
  5429. /* "fontTools/misc/bezierTools.py":234
  5430. * x1 = _dot(d, d1) / origDist
  5431. * Len = abs(2 * (_intSecAtan(x1) - _intSecAtan(x0)) * origDist / (scale * (x1 - x0)))
  5432. * return Len # <<<<<<<<<<<<<<
  5433. *
  5434. *
  5435. */
  5436. __Pyx_XDECREF(__pyx_r);
  5437. __pyx_t_5 = PyFloat_FromDouble(__pyx_v_Len); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 234, __pyx_L1_error)
  5438. __Pyx_GOTREF(__pyx_t_5);
  5439. __pyx_r = __pyx_t_5;
  5440. __pyx_t_5 = 0;
  5441. goto __pyx_L0;
  5442. /* "fontTools/misc/bezierTools.py":186
  5443. *
  5444. *
  5445. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  5446. * @cython.locals(
  5447. * pt1=cython.complex,
  5448. */
  5449. /* function exit code */
  5450. __pyx_L1_error:;
  5451. __Pyx_XDECREF(__pyx_t_2);
  5452. __Pyx_XDECREF(__pyx_t_4);
  5453. __Pyx_XDECREF(__pyx_t_5);
  5454. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcQuadraticArcLengthC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5455. __pyx_r = NULL;
  5456. __pyx_L0:;
  5457. __Pyx_XGIVEREF(__pyx_r);
  5458. __Pyx_RefNannyFinishContext();
  5459. return __pyx_r;
  5460. }
  5461. /* "fontTools/misc/bezierTools.py":237
  5462. *
  5463. *
  5464. * def approximateQuadraticArcLength(pt1, pt2, pt3): # <<<<<<<<<<<<<<
  5465. * """Calculates the arc length for a quadratic Bezier segment.
  5466. *
  5467. */
  5468. /* Python wrapper */
  5469. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_13approximateQuadraticArcLength(PyObject *__pyx_self,
  5470. #if CYTHON_METH_FASTCALL
  5471. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  5472. #else
  5473. PyObject *__pyx_args, PyObject *__pyx_kwds
  5474. #endif
  5475. ); /*proto*/
  5476. 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.");
  5477. 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};
  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. ) {
  5485. PyObject *__pyx_v_pt1 = 0;
  5486. PyObject *__pyx_v_pt2 = 0;
  5487. PyObject *__pyx_v_pt3 = 0;
  5488. #if !CYTHON_METH_FASTCALL
  5489. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  5490. #endif
  5491. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  5492. PyObject* values[3] = {0,0,0};
  5493. int __pyx_lineno = 0;
  5494. const char *__pyx_filename = NULL;
  5495. int __pyx_clineno = 0;
  5496. PyObject *__pyx_r = 0;
  5497. __Pyx_RefNannyDeclarations
  5498. __Pyx_RefNannySetupContext("approximateQuadraticArcLength (wrapper)", 0);
  5499. #if !CYTHON_METH_FASTCALL
  5500. #if CYTHON_ASSUME_SAFE_SIZE
  5501. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  5502. #else
  5503. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  5504. #endif
  5505. #endif
  5506. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  5507. {
  5508. 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};
  5509. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  5510. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 237, __pyx_L3_error)
  5511. if (__pyx_kwds_len > 0) {
  5512. switch (__pyx_nargs) {
  5513. case 3:
  5514. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  5515. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 237, __pyx_L3_error)
  5516. CYTHON_FALLTHROUGH;
  5517. case 2:
  5518. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  5519. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 237, __pyx_L3_error)
  5520. CYTHON_FALLTHROUGH;
  5521. case 1:
  5522. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  5523. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 237, __pyx_L3_error)
  5524. CYTHON_FALLTHROUGH;
  5525. case 0: break;
  5526. default: goto __pyx_L5_argtuple_error;
  5527. }
  5528. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  5529. 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)
  5530. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  5531. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("approximateQuadraticArcLength", 1, 3, 3, i); __PYX_ERR(0, 237, __pyx_L3_error) }
  5532. }
  5533. } else if (unlikely(__pyx_nargs != 3)) {
  5534. goto __pyx_L5_argtuple_error;
  5535. } else {
  5536. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  5537. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 237, __pyx_L3_error)
  5538. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  5539. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 237, __pyx_L3_error)
  5540. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  5541. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 237, __pyx_L3_error)
  5542. }
  5543. __pyx_v_pt1 = values[0];
  5544. __pyx_v_pt2 = values[1];
  5545. __pyx_v_pt3 = values[2];
  5546. }
  5547. goto __pyx_L6_skip;
  5548. __pyx_L5_argtuple_error:;
  5549. __Pyx_RaiseArgtupleInvalid("approximateQuadraticArcLength", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 237, __pyx_L3_error)
  5550. __pyx_L6_skip:;
  5551. goto __pyx_L4_argument_unpacking_done;
  5552. __pyx_L3_error:;
  5553. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  5554. Py_XDECREF(values[__pyx_temp]);
  5555. }
  5556. __Pyx_AddTraceback("fontTools.misc.bezierTools.approximateQuadraticArcLength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5557. __Pyx_RefNannyFinishContext();
  5558. return NULL;
  5559. __pyx_L4_argument_unpacking_done:;
  5560. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_12approximateQuadraticArcLength(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3);
  5561. /* function exit code */
  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_RefNannyFinishContext();
  5566. return __pyx_r;
  5567. }
  5568. 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) {
  5569. PyObject *__pyx_r = NULL;
  5570. __Pyx_RefNannyDeclarations
  5571. PyObject *__pyx_t_1 = NULL;
  5572. PyObject *__pyx_t_2 = NULL;
  5573. PyObject *__pyx_t_3 = NULL;
  5574. PyObject *__pyx_t_4 = NULL;
  5575. PyObject *__pyx_t_5 = NULL;
  5576. PyObject *__pyx_t_6 = NULL;
  5577. PyObject *__pyx_t_7 = NULL;
  5578. size_t __pyx_t_8;
  5579. int __pyx_lineno = 0;
  5580. const char *__pyx_filename = NULL;
  5581. int __pyx_clineno = 0;
  5582. __Pyx_RefNannySetupContext("approximateQuadraticArcLength", 0);
  5583. /* "fontTools/misc/bezierTools.py":251
  5584. * Approximate arc length value.
  5585. * """
  5586. * return approximateQuadraticArcLengthC(complex(*pt1), complex(*pt2), complex(*pt3)) # <<<<<<<<<<<<<<
  5587. *
  5588. *
  5589. */
  5590. __Pyx_XDECREF(__pyx_r);
  5591. __pyx_t_2 = NULL;
  5592. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_approximateQuadraticArcLengthC); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 251, __pyx_L1_error)
  5593. __Pyx_GOTREF(__pyx_t_3);
  5594. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 251, __pyx_L1_error)
  5595. __Pyx_GOTREF(__pyx_t_4);
  5596. __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)
  5597. __Pyx_GOTREF(__pyx_t_5);
  5598. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5599. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 251, __pyx_L1_error)
  5600. __Pyx_GOTREF(__pyx_t_4);
  5601. __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)
  5602. __Pyx_GOTREF(__pyx_t_6);
  5603. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5604. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 251, __pyx_L1_error)
  5605. __Pyx_GOTREF(__pyx_t_4);
  5606. __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)
  5607. __Pyx_GOTREF(__pyx_t_7);
  5608. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5609. __pyx_t_8 = 1;
  5610. #if CYTHON_UNPACK_METHODS
  5611. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  5612. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  5613. assert(__pyx_t_2);
  5614. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  5615. __Pyx_INCREF(__pyx_t_2);
  5616. __Pyx_INCREF(__pyx__function);
  5617. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  5618. __pyx_t_8 = 0;
  5619. }
  5620. #endif
  5621. {
  5622. PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_t_5, __pyx_t_6, __pyx_t_7};
  5623. __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));
  5624. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  5625. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  5626. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  5627. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  5628. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5629. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error)
  5630. __Pyx_GOTREF(__pyx_t_1);
  5631. }
  5632. __pyx_r = __pyx_t_1;
  5633. __pyx_t_1 = 0;
  5634. goto __pyx_L0;
  5635. /* "fontTools/misc/bezierTools.py":237
  5636. *
  5637. *
  5638. * def approximateQuadraticArcLength(pt1, pt2, pt3): # <<<<<<<<<<<<<<
  5639. * """Calculates the arc length for a quadratic Bezier segment.
  5640. *
  5641. */
  5642. /* function exit code */
  5643. __pyx_L1_error:;
  5644. __Pyx_XDECREF(__pyx_t_1);
  5645. __Pyx_XDECREF(__pyx_t_2);
  5646. __Pyx_XDECREF(__pyx_t_3);
  5647. __Pyx_XDECREF(__pyx_t_4);
  5648. __Pyx_XDECREF(__pyx_t_5);
  5649. __Pyx_XDECREF(__pyx_t_6);
  5650. __Pyx_XDECREF(__pyx_t_7);
  5651. __Pyx_AddTraceback("fontTools.misc.bezierTools.approximateQuadraticArcLength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5652. __pyx_r = NULL;
  5653. __pyx_L0:;
  5654. __Pyx_XGIVEREF(__pyx_r);
  5655. __Pyx_RefNannyFinishContext();
  5656. return __pyx_r;
  5657. }
  5658. /* "fontTools/misc/bezierTools.py":254
  5659. *
  5660. *
  5661. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  5662. * @cython.locals(
  5663. * pt1=cython.complex,
  5664. */
  5665. /* Python wrapper */
  5666. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_15approximateQuadraticArcLengthC(PyObject *__pyx_self,
  5667. #if CYTHON_METH_FASTCALL
  5668. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  5669. #else
  5670. PyObject *__pyx_args, PyObject *__pyx_kwds
  5671. #endif
  5672. ); /*proto*/
  5673. 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.");
  5674. 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};
  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. ) {
  5682. __pyx_t_double_complex __pyx_v_pt1;
  5683. __pyx_t_double_complex __pyx_v_pt2;
  5684. __pyx_t_double_complex __pyx_v_pt3;
  5685. #if !CYTHON_METH_FASTCALL
  5686. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  5687. #endif
  5688. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  5689. PyObject* values[3] = {0,0,0};
  5690. int __pyx_lineno = 0;
  5691. const char *__pyx_filename = NULL;
  5692. int __pyx_clineno = 0;
  5693. PyObject *__pyx_r = 0;
  5694. __Pyx_RefNannyDeclarations
  5695. __Pyx_RefNannySetupContext("approximateQuadraticArcLengthC (wrapper)", 0);
  5696. #if !CYTHON_METH_FASTCALL
  5697. #if CYTHON_ASSUME_SAFE_SIZE
  5698. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  5699. #else
  5700. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  5701. #endif
  5702. #endif
  5703. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  5704. {
  5705. 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};
  5706. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  5707. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 254, __pyx_L3_error)
  5708. if (__pyx_kwds_len > 0) {
  5709. switch (__pyx_nargs) {
  5710. case 3:
  5711. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  5712. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 254, __pyx_L3_error)
  5713. CYTHON_FALLTHROUGH;
  5714. case 2:
  5715. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  5716. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 254, __pyx_L3_error)
  5717. CYTHON_FALLTHROUGH;
  5718. case 1:
  5719. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  5720. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 254, __pyx_L3_error)
  5721. CYTHON_FALLTHROUGH;
  5722. case 0: break;
  5723. default: goto __pyx_L5_argtuple_error;
  5724. }
  5725. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  5726. 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)
  5727. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  5728. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("approximateQuadraticArcLengthC", 1, 3, 3, i); __PYX_ERR(0, 254, __pyx_L3_error) }
  5729. }
  5730. } else if (unlikely(__pyx_nargs != 3)) {
  5731. goto __pyx_L5_argtuple_error;
  5732. } else {
  5733. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  5734. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 254, __pyx_L3_error)
  5735. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  5736. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 254, __pyx_L3_error)
  5737. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  5738. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 254, __pyx_L3_error)
  5739. }
  5740. __pyx_v_pt1 = __Pyx_PyComplex_As___pyx_t_double_complex(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 265, __pyx_L3_error)
  5741. __pyx_v_pt2 = __Pyx_PyComplex_As___pyx_t_double_complex(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 265, __pyx_L3_error)
  5742. __pyx_v_pt3 = __Pyx_PyComplex_As___pyx_t_double_complex(values[2]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 265, __pyx_L3_error)
  5743. }
  5744. goto __pyx_L6_skip;
  5745. __pyx_L5_argtuple_error:;
  5746. __Pyx_RaiseArgtupleInvalid("approximateQuadraticArcLengthC", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 254, __pyx_L3_error)
  5747. __pyx_L6_skip:;
  5748. goto __pyx_L4_argument_unpacking_done;
  5749. __pyx_L3_error:;
  5750. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  5751. Py_XDECREF(values[__pyx_temp]);
  5752. }
  5753. __Pyx_AddTraceback("fontTools.misc.bezierTools.approximateQuadraticArcLengthC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5754. __Pyx_RefNannyFinishContext();
  5755. return NULL;
  5756. __pyx_L4_argument_unpacking_done:;
  5757. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_14approximateQuadraticArcLengthC(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3);
  5758. /* function exit code */
  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_RefNannyFinishContext();
  5763. return __pyx_r;
  5764. }
  5765. 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) {
  5766. double __pyx_v_v0;
  5767. double __pyx_v_v1;
  5768. double __pyx_v_v2;
  5769. PyObject *__pyx_r = NULL;
  5770. __Pyx_RefNannyDeclarations
  5771. PyObject *__pyx_t_1 = NULL;
  5772. int __pyx_lineno = 0;
  5773. const char *__pyx_filename = NULL;
  5774. int __pyx_clineno = 0;
  5775. __Pyx_RefNannySetupContext("approximateQuadraticArcLengthC", 0);
  5776. /* "fontTools/misc/bezierTools.py":287
  5777. * # abs(BezierCurveC[2].diff(t).subs({t:T})) for T in sorted(.5, .5sqrt(3/5)/2),
  5778. * # weighted 5/18, 8/18, 5/18 respectively.
  5779. * v0 = abs( # <<<<<<<<<<<<<<
  5780. * -0.492943519233745 * pt1 + 0.430331482911935 * pt2 + 0.0626120363218102 * pt3
  5781. * )
  5782. */
  5783. __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)));
  5784. /* "fontTools/misc/bezierTools.py":290
  5785. * -0.492943519233745 * pt1 + 0.430331482911935 * pt2 + 0.0626120363218102 * pt3
  5786. * )
  5787. * v1 = abs(pt3 - pt1) * 0.4444444444444444 # <<<<<<<<<<<<<<
  5788. * v2 = abs(
  5789. * -0.0626120363218102 * pt1 - 0.430331482911935 * pt2 + 0.492943519233745 * pt3
  5790. */
  5791. __pyx_v_v1 = (__Pyx_c_abs_double(__Pyx_c_diff_double(__pyx_v_pt3, __pyx_v_pt1)) * 0.4444444444444444);
  5792. /* "fontTools/misc/bezierTools.py":291
  5793. * )
  5794. * v1 = abs(pt3 - pt1) * 0.4444444444444444
  5795. * v2 = abs( # <<<<<<<<<<<<<<
  5796. * -0.0626120363218102 * pt1 - 0.430331482911935 * pt2 + 0.492943519233745 * pt3
  5797. * )
  5798. */
  5799. __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)));
  5800. /* "fontTools/misc/bezierTools.py":295
  5801. * )
  5802. *
  5803. * return v0 + v1 + v2 # <<<<<<<<<<<<<<
  5804. *
  5805. *
  5806. */
  5807. __Pyx_XDECREF(__pyx_r);
  5808. __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)
  5809. __Pyx_GOTREF(__pyx_t_1);
  5810. __pyx_r = __pyx_t_1;
  5811. __pyx_t_1 = 0;
  5812. goto __pyx_L0;
  5813. /* "fontTools/misc/bezierTools.py":254
  5814. *
  5815. *
  5816. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  5817. * @cython.locals(
  5818. * pt1=cython.complex,
  5819. */
  5820. /* function exit code */
  5821. __pyx_L1_error:;
  5822. __Pyx_XDECREF(__pyx_t_1);
  5823. __Pyx_AddTraceback("fontTools.misc.bezierTools.approximateQuadraticArcLengthC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5824. __pyx_r = NULL;
  5825. __pyx_L0:;
  5826. __Pyx_XGIVEREF(__pyx_r);
  5827. __Pyx_RefNannyFinishContext();
  5828. return __pyx_r;
  5829. }
  5830. /* "fontTools/misc/bezierTools.py":298
  5831. *
  5832. *
  5833. * def calcQuadraticBounds(pt1, pt2, pt3): # <<<<<<<<<<<<<<
  5834. * """Calculates the bounding rectangle for a quadratic Bezier segment.
  5835. *
  5836. */
  5837. /* Python wrapper */
  5838. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_17calcQuadraticBounds(PyObject *__pyx_self,
  5839. #if CYTHON_METH_FASTCALL
  5840. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  5841. #else
  5842. PyObject *__pyx_args, PyObject *__pyx_kwds
  5843. #endif
  5844. ); /*proto*/
  5845. 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)");
  5846. 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};
  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. ) {
  5854. PyObject *__pyx_v_pt1 = 0;
  5855. PyObject *__pyx_v_pt2 = 0;
  5856. PyObject *__pyx_v_pt3 = 0;
  5857. #if !CYTHON_METH_FASTCALL
  5858. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  5859. #endif
  5860. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  5861. PyObject* values[3] = {0,0,0};
  5862. int __pyx_lineno = 0;
  5863. const char *__pyx_filename = NULL;
  5864. int __pyx_clineno = 0;
  5865. PyObject *__pyx_r = 0;
  5866. __Pyx_RefNannyDeclarations
  5867. __Pyx_RefNannySetupContext("calcQuadraticBounds (wrapper)", 0);
  5868. #if !CYTHON_METH_FASTCALL
  5869. #if CYTHON_ASSUME_SAFE_SIZE
  5870. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  5871. #else
  5872. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  5873. #endif
  5874. #endif
  5875. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  5876. {
  5877. 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};
  5878. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  5879. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 298, __pyx_L3_error)
  5880. if (__pyx_kwds_len > 0) {
  5881. switch (__pyx_nargs) {
  5882. case 3:
  5883. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  5884. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 298, __pyx_L3_error)
  5885. CYTHON_FALLTHROUGH;
  5886. case 2:
  5887. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  5888. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 298, __pyx_L3_error)
  5889. CYTHON_FALLTHROUGH;
  5890. case 1:
  5891. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  5892. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 298, __pyx_L3_error)
  5893. CYTHON_FALLTHROUGH;
  5894. case 0: break;
  5895. default: goto __pyx_L5_argtuple_error;
  5896. }
  5897. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  5898. 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)
  5899. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  5900. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("calcQuadraticBounds", 1, 3, 3, i); __PYX_ERR(0, 298, __pyx_L3_error) }
  5901. }
  5902. } else if (unlikely(__pyx_nargs != 3)) {
  5903. goto __pyx_L5_argtuple_error;
  5904. } else {
  5905. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  5906. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 298, __pyx_L3_error)
  5907. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  5908. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 298, __pyx_L3_error)
  5909. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  5910. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 298, __pyx_L3_error)
  5911. }
  5912. __pyx_v_pt1 = values[0];
  5913. __pyx_v_pt2 = values[1];
  5914. __pyx_v_pt3 = values[2];
  5915. }
  5916. goto __pyx_L6_skip;
  5917. __pyx_L5_argtuple_error:;
  5918. __Pyx_RaiseArgtupleInvalid("calcQuadraticBounds", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 298, __pyx_L3_error)
  5919. __pyx_L6_skip:;
  5920. goto __pyx_L4_argument_unpacking_done;
  5921. __pyx_L3_error:;
  5922. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  5923. Py_XDECREF(values[__pyx_temp]);
  5924. }
  5925. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcQuadraticBounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5926. __Pyx_RefNannyFinishContext();
  5927. return NULL;
  5928. __pyx_L4_argument_unpacking_done:;
  5929. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_16calcQuadraticBounds(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3);
  5930. /* function exit code */
  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_RefNannyFinishContext();
  5935. return __pyx_r;
  5936. }
  5937. 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) {
  5938. PyObject *__pyx_v_ax = NULL;
  5939. PyObject *__pyx_v_ay = NULL;
  5940. PyObject *__pyx_v_bx = NULL;
  5941. PyObject *__pyx_v_by = NULL;
  5942. PyObject *__pyx_v_cx = NULL;
  5943. PyObject *__pyx_v_cy = NULL;
  5944. PyObject *__pyx_v_ax2 = NULL;
  5945. PyObject *__pyx_v_ay2 = NULL;
  5946. PyObject *__pyx_v_roots = NULL;
  5947. PyObject *__pyx_v_points = NULL;
  5948. PyObject *__pyx_7genexpr__pyx_v_t = NULL;
  5949. PyObject *__pyx_r = NULL;
  5950. __Pyx_RefNannyDeclarations
  5951. PyObject *__pyx_t_1 = NULL;
  5952. PyObject *__pyx_t_2 = NULL;
  5953. PyObject *__pyx_t_3 = NULL;
  5954. size_t __pyx_t_4;
  5955. PyObject *__pyx_t_5 = NULL;
  5956. PyObject *__pyx_t_6 = NULL;
  5957. PyObject *(*__pyx_t_7)(PyObject *);
  5958. PyObject *__pyx_t_8 = NULL;
  5959. PyObject *__pyx_t_9 = NULL;
  5960. int __pyx_t_10;
  5961. int __pyx_t_11;
  5962. Py_ssize_t __pyx_t_12;
  5963. int __pyx_lineno = 0;
  5964. const char *__pyx_filename = NULL;
  5965. int __pyx_clineno = 0;
  5966. __Pyx_RefNannySetupContext("calcQuadraticBounds", 0);
  5967. /* "fontTools/misc/bezierTools.py":316
  5968. * (0.0, 0.0, 100, 100)
  5969. * """
  5970. * (ax, ay), (bx, by), (cx, cy) = calcQuadraticParameters(pt1, pt2, pt3) # <<<<<<<<<<<<<<
  5971. * ax2 = ax * 2.0
  5972. * ay2 = ay * 2.0
  5973. */
  5974. __pyx_t_2 = NULL;
  5975. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_calcQuadraticParameters); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 316, __pyx_L1_error)
  5976. __Pyx_GOTREF(__pyx_t_3);
  5977. __pyx_t_4 = 1;
  5978. #if CYTHON_UNPACK_METHODS
  5979. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  5980. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  5981. assert(__pyx_t_2);
  5982. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  5983. __Pyx_INCREF(__pyx_t_2);
  5984. __Pyx_INCREF(__pyx__function);
  5985. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  5986. __pyx_t_4 = 0;
  5987. }
  5988. #endif
  5989. {
  5990. PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3};
  5991. __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));
  5992. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  5993. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5994. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 316, __pyx_L1_error)
  5995. __Pyx_GOTREF(__pyx_t_1);
  5996. }
  5997. if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
  5998. PyObject* sequence = __pyx_t_1;
  5999. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  6000. if (unlikely(size != 3)) {
  6001. if (size > 3) __Pyx_RaiseTooManyValuesError(3);
  6002. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  6003. __PYX_ERR(0, 316, __pyx_L1_error)
  6004. }
  6005. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  6006. if (likely(PyTuple_CheckExact(sequence))) {
  6007. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  6008. __Pyx_INCREF(__pyx_t_3);
  6009. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  6010. __Pyx_INCREF(__pyx_t_2);
  6011. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2);
  6012. __Pyx_INCREF(__pyx_t_5);
  6013. } else {
  6014. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  6015. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 316, __pyx_L1_error)
  6016. __Pyx_XGOTREF(__pyx_t_3);
  6017. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  6018. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 316, __pyx_L1_error)
  6019. __Pyx_XGOTREF(__pyx_t_2);
  6020. __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  6021. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 316, __pyx_L1_error)
  6022. __Pyx_XGOTREF(__pyx_t_5);
  6023. }
  6024. #else
  6025. __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 316, __pyx_L1_error)
  6026. __Pyx_GOTREF(__pyx_t_3);
  6027. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 316, __pyx_L1_error)
  6028. __Pyx_GOTREF(__pyx_t_2);
  6029. __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 316, __pyx_L1_error)
  6030. __Pyx_GOTREF(__pyx_t_5);
  6031. #endif
  6032. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6033. } else {
  6034. Py_ssize_t index = -1;
  6035. __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 316, __pyx_L1_error)
  6036. __Pyx_GOTREF(__pyx_t_6);
  6037. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6038. __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6);
  6039. index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
  6040. __Pyx_GOTREF(__pyx_t_3);
  6041. index = 1; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  6042. __Pyx_GOTREF(__pyx_t_2);
  6043. index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
  6044. __Pyx_GOTREF(__pyx_t_5);
  6045. if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < (0)) __PYX_ERR(0, 316, __pyx_L1_error)
  6046. __pyx_t_7 = NULL;
  6047. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6048. goto __pyx_L4_unpacking_done;
  6049. __pyx_L3_unpacking_failed:;
  6050. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6051. __pyx_t_7 = NULL;
  6052. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  6053. __PYX_ERR(0, 316, __pyx_L1_error)
  6054. __pyx_L4_unpacking_done:;
  6055. }
  6056. if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
  6057. PyObject* sequence = __pyx_t_3;
  6058. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  6059. if (unlikely(size != 2)) {
  6060. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  6061. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  6062. __PYX_ERR(0, 316, __pyx_L1_error)
  6063. }
  6064. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  6065. if (likely(PyTuple_CheckExact(sequence))) {
  6066. __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
  6067. __Pyx_INCREF(__pyx_t_6);
  6068. __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
  6069. __Pyx_INCREF(__pyx_t_8);
  6070. } else {
  6071. __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  6072. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 316, __pyx_L1_error)
  6073. __Pyx_XGOTREF(__pyx_t_6);
  6074. __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  6075. if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 316, __pyx_L1_error)
  6076. __Pyx_XGOTREF(__pyx_t_8);
  6077. }
  6078. #else
  6079. __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 316, __pyx_L1_error)
  6080. __Pyx_GOTREF(__pyx_t_6);
  6081. __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 316, __pyx_L1_error)
  6082. __Pyx_GOTREF(__pyx_t_8);
  6083. #endif
  6084. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6085. } else {
  6086. Py_ssize_t index = -1;
  6087. __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 316, __pyx_L1_error)
  6088. __Pyx_GOTREF(__pyx_t_9);
  6089. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6090. __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9);
  6091. index = 0; __pyx_t_6 = __pyx_t_7(__pyx_t_9); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
  6092. __Pyx_GOTREF(__pyx_t_6);
  6093. index = 1; __pyx_t_8 = __pyx_t_7(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L5_unpacking_failed;
  6094. __Pyx_GOTREF(__pyx_t_8);
  6095. if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_9), 2) < (0)) __PYX_ERR(0, 316, __pyx_L1_error)
  6096. __pyx_t_7 = NULL;
  6097. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6098. goto __pyx_L6_unpacking_done;
  6099. __pyx_L5_unpacking_failed:;
  6100. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6101. __pyx_t_7 = NULL;
  6102. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  6103. __PYX_ERR(0, 316, __pyx_L1_error)
  6104. __pyx_L6_unpacking_done:;
  6105. }
  6106. __pyx_v_ax = __pyx_t_6;
  6107. __pyx_t_6 = 0;
  6108. __pyx_v_ay = __pyx_t_8;
  6109. __pyx_t_8 = 0;
  6110. if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
  6111. PyObject* sequence = __pyx_t_2;
  6112. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  6113. if (unlikely(size != 2)) {
  6114. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  6115. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  6116. __PYX_ERR(0, 316, __pyx_L1_error)
  6117. }
  6118. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  6119. if (likely(PyTuple_CheckExact(sequence))) {
  6120. __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0);
  6121. __Pyx_INCREF(__pyx_t_8);
  6122. __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
  6123. __Pyx_INCREF(__pyx_t_6);
  6124. } else {
  6125. __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  6126. if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 316, __pyx_L1_error)
  6127. __Pyx_XGOTREF(__pyx_t_8);
  6128. __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  6129. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 316, __pyx_L1_error)
  6130. __Pyx_XGOTREF(__pyx_t_6);
  6131. }
  6132. #else
  6133. __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 316, __pyx_L1_error)
  6134. __Pyx_GOTREF(__pyx_t_8);
  6135. __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 316, __pyx_L1_error)
  6136. __Pyx_GOTREF(__pyx_t_6);
  6137. #endif
  6138. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6139. } else {
  6140. Py_ssize_t index = -1;
  6141. __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 316, __pyx_L1_error)
  6142. __Pyx_GOTREF(__pyx_t_9);
  6143. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6144. __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9);
  6145. index = 0; __pyx_t_8 = __pyx_t_7(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L7_unpacking_failed;
  6146. __Pyx_GOTREF(__pyx_t_8);
  6147. index = 1; __pyx_t_6 = __pyx_t_7(__pyx_t_9); if (unlikely(!__pyx_t_6)) goto __pyx_L7_unpacking_failed;
  6148. __Pyx_GOTREF(__pyx_t_6);
  6149. if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_9), 2) < (0)) __PYX_ERR(0, 316, __pyx_L1_error)
  6150. __pyx_t_7 = NULL;
  6151. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6152. goto __pyx_L8_unpacking_done;
  6153. __pyx_L7_unpacking_failed:;
  6154. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6155. __pyx_t_7 = NULL;
  6156. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  6157. __PYX_ERR(0, 316, __pyx_L1_error)
  6158. __pyx_L8_unpacking_done:;
  6159. }
  6160. __pyx_v_bx = __pyx_t_8;
  6161. __pyx_t_8 = 0;
  6162. __pyx_v_by = __pyx_t_6;
  6163. __pyx_t_6 = 0;
  6164. if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
  6165. PyObject* sequence = __pyx_t_5;
  6166. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  6167. if (unlikely(size != 2)) {
  6168. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  6169. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  6170. __PYX_ERR(0, 316, __pyx_L1_error)
  6171. }
  6172. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  6173. if (likely(PyTuple_CheckExact(sequence))) {
  6174. __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
  6175. __Pyx_INCREF(__pyx_t_6);
  6176. __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1);
  6177. __Pyx_INCREF(__pyx_t_8);
  6178. } else {
  6179. __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  6180. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 316, __pyx_L1_error)
  6181. __Pyx_XGOTREF(__pyx_t_6);
  6182. __pyx_t_8 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  6183. if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 316, __pyx_L1_error)
  6184. __Pyx_XGOTREF(__pyx_t_8);
  6185. }
  6186. #else
  6187. __pyx_t_6 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 316, __pyx_L1_error)
  6188. __Pyx_GOTREF(__pyx_t_6);
  6189. __pyx_t_8 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 316, __pyx_L1_error)
  6190. __Pyx_GOTREF(__pyx_t_8);
  6191. #endif
  6192. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6193. } else {
  6194. Py_ssize_t index = -1;
  6195. __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 316, __pyx_L1_error)
  6196. __Pyx_GOTREF(__pyx_t_9);
  6197. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6198. __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9);
  6199. index = 0; __pyx_t_6 = __pyx_t_7(__pyx_t_9); if (unlikely(!__pyx_t_6)) goto __pyx_L9_unpacking_failed;
  6200. __Pyx_GOTREF(__pyx_t_6);
  6201. index = 1; __pyx_t_8 = __pyx_t_7(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L9_unpacking_failed;
  6202. __Pyx_GOTREF(__pyx_t_8);
  6203. if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_9), 2) < (0)) __PYX_ERR(0, 316, __pyx_L1_error)
  6204. __pyx_t_7 = NULL;
  6205. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6206. goto __pyx_L10_unpacking_done;
  6207. __pyx_L9_unpacking_failed:;
  6208. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  6209. __pyx_t_7 = NULL;
  6210. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  6211. __PYX_ERR(0, 316, __pyx_L1_error)
  6212. __pyx_L10_unpacking_done:;
  6213. }
  6214. __pyx_v_cx = __pyx_t_6;
  6215. __pyx_t_6 = 0;
  6216. __pyx_v_cy = __pyx_t_8;
  6217. __pyx_t_8 = 0;
  6218. /* "fontTools/misc/bezierTools.py":317
  6219. * """
  6220. * (ax, ay), (bx, by), (cx, cy) = calcQuadraticParameters(pt1, pt2, pt3)
  6221. * ax2 = ax * 2.0 # <<<<<<<<<<<<<<
  6222. * ay2 = ay * 2.0
  6223. * roots = []
  6224. */
  6225. __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)
  6226. __Pyx_GOTREF(__pyx_t_1);
  6227. __pyx_v_ax2 = __pyx_t_1;
  6228. __pyx_t_1 = 0;
  6229. /* "fontTools/misc/bezierTools.py":318
  6230. * (ax, ay), (bx, by), (cx, cy) = calcQuadraticParameters(pt1, pt2, pt3)
  6231. * ax2 = ax * 2.0
  6232. * ay2 = ay * 2.0 # <<<<<<<<<<<<<<
  6233. * roots = []
  6234. * if ax2 != 0:
  6235. */
  6236. __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)
  6237. __Pyx_GOTREF(__pyx_t_1);
  6238. __pyx_v_ay2 = __pyx_t_1;
  6239. __pyx_t_1 = 0;
  6240. /* "fontTools/misc/bezierTools.py":319
  6241. * ax2 = ax * 2.0
  6242. * ay2 = ay * 2.0
  6243. * roots = [] # <<<<<<<<<<<<<<
  6244. * if ax2 != 0:
  6245. * roots.append(-bx / ax2)
  6246. */
  6247. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 319, __pyx_L1_error)
  6248. __Pyx_GOTREF(__pyx_t_1);
  6249. __pyx_v_roots = ((PyObject*)__pyx_t_1);
  6250. __pyx_t_1 = 0;
  6251. /* "fontTools/misc/bezierTools.py":320
  6252. * ay2 = ay * 2.0
  6253. * roots = []
  6254. * if ax2 != 0: # <<<<<<<<<<<<<<
  6255. * roots.append(-bx / ax2)
  6256. * if ay2 != 0:
  6257. */
  6258. __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)
  6259. if (__pyx_t_10) {
  6260. /* "fontTools/misc/bezierTools.py":321
  6261. * roots = []
  6262. * if ax2 != 0:
  6263. * roots.append(-bx / ax2) # <<<<<<<<<<<<<<
  6264. * if ay2 != 0:
  6265. * roots.append(-by / ay2)
  6266. */
  6267. __pyx_t_1 = PyNumber_Negative(__pyx_v_bx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L1_error)
  6268. __Pyx_GOTREF(__pyx_t_1);
  6269. __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_ax2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 321, __pyx_L1_error)
  6270. __Pyx_GOTREF(__pyx_t_5);
  6271. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6272. __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)
  6273. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6274. /* "fontTools/misc/bezierTools.py":320
  6275. * ay2 = ay * 2.0
  6276. * roots = []
  6277. * if ax2 != 0: # <<<<<<<<<<<<<<
  6278. * roots.append(-bx / ax2)
  6279. * if ay2 != 0:
  6280. */
  6281. }
  6282. /* "fontTools/misc/bezierTools.py":322
  6283. * if ax2 != 0:
  6284. * roots.append(-bx / ax2)
  6285. * if ay2 != 0: # <<<<<<<<<<<<<<
  6286. * roots.append(-by / ay2)
  6287. * points = [
  6288. */
  6289. __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)
  6290. if (__pyx_t_10) {
  6291. /* "fontTools/misc/bezierTools.py":323
  6292. * roots.append(-bx / ax2)
  6293. * if ay2 != 0:
  6294. * roots.append(-by / ay2) # <<<<<<<<<<<<<<
  6295. * points = [
  6296. * (ax * t * t + bx * t + cx, ay * t * t + by * t + cy)
  6297. */
  6298. __pyx_t_5 = PyNumber_Negative(__pyx_v_by); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 323, __pyx_L1_error)
  6299. __Pyx_GOTREF(__pyx_t_5);
  6300. __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_v_ay2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 323, __pyx_L1_error)
  6301. __Pyx_GOTREF(__pyx_t_1);
  6302. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6303. __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)
  6304. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6305. /* "fontTools/misc/bezierTools.py":322
  6306. * if ax2 != 0:
  6307. * roots.append(-bx / ax2)
  6308. * if ay2 != 0: # <<<<<<<<<<<<<<
  6309. * roots.append(-by / ay2)
  6310. * points = [
  6311. */
  6312. }
  6313. /* "fontTools/misc/bezierTools.py":328
  6314. * for t in roots
  6315. * if 0 <= t < 1
  6316. * ] + [pt1, pt3] # <<<<<<<<<<<<<<
  6317. * return calcBounds(points)
  6318. *
  6319. */
  6320. { /* enter inner scope */
  6321. /* "fontTools/misc/bezierTools.py":324
  6322. * if ay2 != 0:
  6323. * roots.append(-by / ay2)
  6324. * points = [ # <<<<<<<<<<<<<<
  6325. * (ax * t * t + bx * t + cx, ay * t * t + by * t + cy)
  6326. * for t in roots
  6327. */
  6328. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 324, __pyx_L15_error)
  6329. __Pyx_GOTREF(__pyx_t_1);
  6330. /* "fontTools/misc/bezierTools.py":326
  6331. * points = [
  6332. * (ax * t * t + bx * t + cx, ay * t * t + by * t + cy)
  6333. * for t in roots # <<<<<<<<<<<<<<
  6334. * if 0 <= t < 1
  6335. * ] + [pt1, pt3]
  6336. */
  6337. __pyx_t_5 = __pyx_v_roots; __Pyx_INCREF(__pyx_t_5);
  6338. __pyx_t_12 = 0;
  6339. for (;;) {
  6340. {
  6341. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
  6342. #if !CYTHON_ASSUME_SAFE_SIZE
  6343. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 326, __pyx_L15_error)
  6344. #endif
  6345. if (__pyx_t_12 >= __pyx_temp) break;
  6346. }
  6347. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_12, __Pyx_ReferenceSharing_OwnStrongReference);
  6348. ++__pyx_t_12;
  6349. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 326, __pyx_L15_error)
  6350. __Pyx_GOTREF(__pyx_t_2);
  6351. __Pyx_XDECREF_SET(__pyx_7genexpr__pyx_v_t, __pyx_t_2);
  6352. __pyx_t_2 = 0;
  6353. /* "fontTools/misc/bezierTools.py":327
  6354. * (ax * t * t + bx * t + cx, ay * t * t + by * t + cy)
  6355. * for t in roots
  6356. * if 0 <= t < 1 # <<<<<<<<<<<<<<
  6357. * ] + [pt1, pt3]
  6358. * return calcBounds(points)
  6359. */
  6360. __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)
  6361. if (__Pyx_PyObject_IsTrue(__pyx_t_2)) {
  6362. __Pyx_DECREF(__pyx_t_2);
  6363. __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)
  6364. }
  6365. __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 327, __pyx_L15_error)
  6366. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6367. if (__pyx_t_10) {
  6368. /* "fontTools/misc/bezierTools.py":325
  6369. * roots.append(-by / ay2)
  6370. * points = [
  6371. * (ax * t * t + bx * t + cx, ay * t * t + by * t + cy) # <<<<<<<<<<<<<<
  6372. * for t in roots
  6373. * if 0 <= t < 1
  6374. */
  6375. __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)
  6376. __Pyx_GOTREF(__pyx_t_2);
  6377. __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)
  6378. __Pyx_GOTREF(__pyx_t_3);
  6379. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6380. __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)
  6381. __Pyx_GOTREF(__pyx_t_2);
  6382. __pyx_t_8 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 325, __pyx_L15_error)
  6383. __Pyx_GOTREF(__pyx_t_8);
  6384. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6385. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  6386. __pyx_t_2 = PyNumber_Add(__pyx_t_8, __pyx_v_cx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 325, __pyx_L15_error)
  6387. __Pyx_GOTREF(__pyx_t_2);
  6388. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6389. __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)
  6390. __Pyx_GOTREF(__pyx_t_8);
  6391. __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)
  6392. __Pyx_GOTREF(__pyx_t_3);
  6393. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6394. __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)
  6395. __Pyx_GOTREF(__pyx_t_8);
  6396. __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 325, __pyx_L15_error)
  6397. __Pyx_GOTREF(__pyx_t_6);
  6398. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6399. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6400. __pyx_t_8 = PyNumber_Add(__pyx_t_6, __pyx_v_cy); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 325, __pyx_L15_error)
  6401. __Pyx_GOTREF(__pyx_t_8);
  6402. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6403. __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 325, __pyx_L15_error)
  6404. __Pyx_GOTREF(__pyx_t_6);
  6405. __Pyx_GIVEREF(__pyx_t_2);
  6406. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 325, __pyx_L15_error);
  6407. __Pyx_GIVEREF(__pyx_t_8);
  6408. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8) != (0)) __PYX_ERR(0, 325, __pyx_L15_error);
  6409. __pyx_t_2 = 0;
  6410. __pyx_t_8 = 0;
  6411. if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 324, __pyx_L15_error)
  6412. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6413. /* "fontTools/misc/bezierTools.py":327
  6414. * (ax * t * t + bx * t + cx, ay * t * t + by * t + cy)
  6415. * for t in roots
  6416. * if 0 <= t < 1 # <<<<<<<<<<<<<<
  6417. * ] + [pt1, pt3]
  6418. * return calcBounds(points)
  6419. */
  6420. }
  6421. /* "fontTools/misc/bezierTools.py":326
  6422. * points = [
  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. */
  6428. }
  6429. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6430. __Pyx_XDECREF(__pyx_7genexpr__pyx_v_t); __pyx_7genexpr__pyx_v_t = 0;
  6431. goto __pyx_L20_exit_scope;
  6432. __pyx_L15_error:;
  6433. __Pyx_XDECREF(__pyx_7genexpr__pyx_v_t); __pyx_7genexpr__pyx_v_t = 0;
  6434. goto __pyx_L1_error;
  6435. __pyx_L20_exit_scope:;
  6436. } /* exit inner scope */
  6437. /* "fontTools/misc/bezierTools.py":328
  6438. * for t in roots
  6439. * if 0 <= t < 1
  6440. * ] + [pt1, pt3] # <<<<<<<<<<<<<<
  6441. * return calcBounds(points)
  6442. *
  6443. */
  6444. __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 328, __pyx_L1_error)
  6445. __Pyx_GOTREF(__pyx_t_5);
  6446. __Pyx_INCREF(__pyx_v_pt1);
  6447. __Pyx_GIVEREF(__pyx_v_pt1);
  6448. if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, __pyx_v_pt1) != (0)) __PYX_ERR(0, 328, __pyx_L1_error);
  6449. __Pyx_INCREF(__pyx_v_pt3);
  6450. __Pyx_GIVEREF(__pyx_v_pt3);
  6451. if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 1, __pyx_v_pt3) != (0)) __PYX_ERR(0, 328, __pyx_L1_error);
  6452. __pyx_t_6 = PyNumber_Add(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 328, __pyx_L1_error)
  6453. __Pyx_GOTREF(__pyx_t_6);
  6454. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6455. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6456. __pyx_v_points = ((PyObject*)__pyx_t_6);
  6457. __pyx_t_6 = 0;
  6458. /* "fontTools/misc/bezierTools.py":329
  6459. * if 0 <= t < 1
  6460. * ] + [pt1, pt3]
  6461. * return calcBounds(points) # <<<<<<<<<<<<<<
  6462. *
  6463. *
  6464. */
  6465. __Pyx_XDECREF(__pyx_r);
  6466. __pyx_t_5 = NULL;
  6467. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_calcBounds); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error)
  6468. __Pyx_GOTREF(__pyx_t_1);
  6469. __pyx_t_4 = 1;
  6470. #if CYTHON_UNPACK_METHODS
  6471. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  6472. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
  6473. assert(__pyx_t_5);
  6474. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  6475. __Pyx_INCREF(__pyx_t_5);
  6476. __Pyx_INCREF(__pyx__function);
  6477. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  6478. __pyx_t_4 = 0;
  6479. }
  6480. #endif
  6481. {
  6482. PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_points};
  6483. __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));
  6484. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  6485. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  6486. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 329, __pyx_L1_error)
  6487. __Pyx_GOTREF(__pyx_t_6);
  6488. }
  6489. __pyx_r = __pyx_t_6;
  6490. __pyx_t_6 = 0;
  6491. goto __pyx_L0;
  6492. /* "fontTools/misc/bezierTools.py":298
  6493. *
  6494. *
  6495. * def calcQuadraticBounds(pt1, pt2, pt3): # <<<<<<<<<<<<<<
  6496. * """Calculates the bounding rectangle for a quadratic Bezier segment.
  6497. *
  6498. */
  6499. /* function exit code */
  6500. __pyx_L1_error:;
  6501. __Pyx_XDECREF(__pyx_t_1);
  6502. __Pyx_XDECREF(__pyx_t_2);
  6503. __Pyx_XDECREF(__pyx_t_3);
  6504. __Pyx_XDECREF(__pyx_t_5);
  6505. __Pyx_XDECREF(__pyx_t_6);
  6506. __Pyx_XDECREF(__pyx_t_8);
  6507. __Pyx_XDECREF(__pyx_t_9);
  6508. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcQuadraticBounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6509. __pyx_r = NULL;
  6510. __pyx_L0:;
  6511. __Pyx_XDECREF(__pyx_v_ax);
  6512. __Pyx_XDECREF(__pyx_v_ay);
  6513. __Pyx_XDECREF(__pyx_v_bx);
  6514. __Pyx_XDECREF(__pyx_v_by);
  6515. __Pyx_XDECREF(__pyx_v_cx);
  6516. __Pyx_XDECREF(__pyx_v_cy);
  6517. __Pyx_XDECREF(__pyx_v_ax2);
  6518. __Pyx_XDECREF(__pyx_v_ay2);
  6519. __Pyx_XDECREF(__pyx_v_roots);
  6520. __Pyx_XDECREF(__pyx_v_points);
  6521. __Pyx_XDECREF(__pyx_7genexpr__pyx_v_t);
  6522. __Pyx_XGIVEREF(__pyx_r);
  6523. __Pyx_RefNannyFinishContext();
  6524. return __pyx_r;
  6525. }
  6526. /* "fontTools/misc/bezierTools.py":332
  6527. *
  6528. *
  6529. * def approximateCubicArcLength(pt1, pt2, pt3, pt4): # <<<<<<<<<<<<<<
  6530. * """Approximates the arc length for a cubic Bezier segment.
  6531. *
  6532. */
  6533. /* Python wrapper */
  6534. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_19approximateCubicArcLength(PyObject *__pyx_self,
  6535. #if CYTHON_METH_FASTCALL
  6536. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  6537. #else
  6538. PyObject *__pyx_args, PyObject *__pyx_kwds
  6539. #endif
  6540. ); /*proto*/
  6541. 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");
  6542. 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};
  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. ) {
  6550. PyObject *__pyx_v_pt1 = 0;
  6551. PyObject *__pyx_v_pt2 = 0;
  6552. PyObject *__pyx_v_pt3 = 0;
  6553. PyObject *__pyx_v_pt4 = 0;
  6554. #if !CYTHON_METH_FASTCALL
  6555. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  6556. #endif
  6557. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  6558. PyObject* values[4] = {0,0,0,0};
  6559. int __pyx_lineno = 0;
  6560. const char *__pyx_filename = NULL;
  6561. int __pyx_clineno = 0;
  6562. PyObject *__pyx_r = 0;
  6563. __Pyx_RefNannyDeclarations
  6564. __Pyx_RefNannySetupContext("approximateCubicArcLength (wrapper)", 0);
  6565. #if !CYTHON_METH_FASTCALL
  6566. #if CYTHON_ASSUME_SAFE_SIZE
  6567. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  6568. #else
  6569. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  6570. #endif
  6571. #endif
  6572. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  6573. {
  6574. 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};
  6575. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  6576. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 332, __pyx_L3_error)
  6577. if (__pyx_kwds_len > 0) {
  6578. switch (__pyx_nargs) {
  6579. case 4:
  6580. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  6581. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 332, __pyx_L3_error)
  6582. CYTHON_FALLTHROUGH;
  6583. case 3:
  6584. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  6585. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 332, __pyx_L3_error)
  6586. CYTHON_FALLTHROUGH;
  6587. case 2:
  6588. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  6589. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 332, __pyx_L3_error)
  6590. CYTHON_FALLTHROUGH;
  6591. case 1:
  6592. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  6593. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 332, __pyx_L3_error)
  6594. CYTHON_FALLTHROUGH;
  6595. case 0: break;
  6596. default: goto __pyx_L5_argtuple_error;
  6597. }
  6598. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  6599. 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)
  6600. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  6601. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("approximateCubicArcLength", 1, 4, 4, i); __PYX_ERR(0, 332, __pyx_L3_error) }
  6602. }
  6603. } else if (unlikely(__pyx_nargs != 4)) {
  6604. goto __pyx_L5_argtuple_error;
  6605. } else {
  6606. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  6607. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 332, __pyx_L3_error)
  6608. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  6609. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 332, __pyx_L3_error)
  6610. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  6611. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 332, __pyx_L3_error)
  6612. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  6613. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 332, __pyx_L3_error)
  6614. }
  6615. __pyx_v_pt1 = values[0];
  6616. __pyx_v_pt2 = values[1];
  6617. __pyx_v_pt3 = values[2];
  6618. __pyx_v_pt4 = values[3];
  6619. }
  6620. goto __pyx_L6_skip;
  6621. __pyx_L5_argtuple_error:;
  6622. __Pyx_RaiseArgtupleInvalid("approximateCubicArcLength", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 332, __pyx_L3_error)
  6623. __pyx_L6_skip:;
  6624. goto __pyx_L4_argument_unpacking_done;
  6625. __pyx_L3_error:;
  6626. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  6627. Py_XDECREF(values[__pyx_temp]);
  6628. }
  6629. __Pyx_AddTraceback("fontTools.misc.bezierTools.approximateCubicArcLength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6630. __Pyx_RefNannyFinishContext();
  6631. return NULL;
  6632. __pyx_L4_argument_unpacking_done:;
  6633. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_18approximateCubicArcLength(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_pt4);
  6634. /* function exit code */
  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_RefNannyFinishContext();
  6639. return __pyx_r;
  6640. }
  6641. 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) {
  6642. PyObject *__pyx_r = NULL;
  6643. __Pyx_RefNannyDeclarations
  6644. PyObject *__pyx_t_1 = NULL;
  6645. PyObject *__pyx_t_2 = NULL;
  6646. PyObject *__pyx_t_3 = NULL;
  6647. PyObject *__pyx_t_4 = NULL;
  6648. PyObject *__pyx_t_5 = NULL;
  6649. PyObject *__pyx_t_6 = NULL;
  6650. PyObject *__pyx_t_7 = NULL;
  6651. PyObject *__pyx_t_8 = NULL;
  6652. size_t __pyx_t_9;
  6653. int __pyx_lineno = 0;
  6654. const char *__pyx_filename = NULL;
  6655. int __pyx_clineno = 0;
  6656. __Pyx_RefNannySetupContext("approximateCubicArcLength", 0);
  6657. /* "fontTools/misc/bezierTools.py":357
  6658. * 154.80848416537057
  6659. * """
  6660. * return approximateCubicArcLengthC( # <<<<<<<<<<<<<<
  6661. * complex(*pt1), complex(*pt2), complex(*pt3), complex(*pt4)
  6662. * )
  6663. */
  6664. __Pyx_XDECREF(__pyx_r);
  6665. __pyx_t_2 = NULL;
  6666. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_approximateCubicArcLengthC); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 357, __pyx_L1_error)
  6667. __Pyx_GOTREF(__pyx_t_3);
  6668. /* "fontTools/misc/bezierTools.py":358
  6669. * """
  6670. * return approximateCubicArcLengthC(
  6671. * complex(*pt1), complex(*pt2), complex(*pt3), complex(*pt4) # <<<<<<<<<<<<<<
  6672. * )
  6673. *
  6674. */
  6675. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 358, __pyx_L1_error)
  6676. __Pyx_GOTREF(__pyx_t_4);
  6677. __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)
  6678. __Pyx_GOTREF(__pyx_t_5);
  6679. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6680. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 358, __pyx_L1_error)
  6681. __Pyx_GOTREF(__pyx_t_4);
  6682. __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)
  6683. __Pyx_GOTREF(__pyx_t_6);
  6684. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6685. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 358, __pyx_L1_error)
  6686. __Pyx_GOTREF(__pyx_t_4);
  6687. __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)
  6688. __Pyx_GOTREF(__pyx_t_7);
  6689. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6690. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_pt4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 358, __pyx_L1_error)
  6691. __Pyx_GOTREF(__pyx_t_4);
  6692. __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)
  6693. __Pyx_GOTREF(__pyx_t_8);
  6694. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  6695. __pyx_t_9 = 1;
  6696. #if CYTHON_UNPACK_METHODS
  6697. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  6698. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  6699. assert(__pyx_t_2);
  6700. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  6701. __Pyx_INCREF(__pyx_t_2);
  6702. __Pyx_INCREF(__pyx__function);
  6703. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  6704. __pyx_t_9 = 0;
  6705. }
  6706. #endif
  6707. {
  6708. PyObject *__pyx_callargs[5] = {__pyx_t_2, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8};
  6709. __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));
  6710. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  6711. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6712. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6713. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  6714. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6715. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6716. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 357, __pyx_L1_error)
  6717. __Pyx_GOTREF(__pyx_t_1);
  6718. }
  6719. __pyx_r = __pyx_t_1;
  6720. __pyx_t_1 = 0;
  6721. goto __pyx_L0;
  6722. /* "fontTools/misc/bezierTools.py":332
  6723. *
  6724. *
  6725. * def approximateCubicArcLength(pt1, pt2, pt3, pt4): # <<<<<<<<<<<<<<
  6726. * """Approximates the arc length for a cubic Bezier segment.
  6727. *
  6728. */
  6729. /* function exit code */
  6730. __pyx_L1_error:;
  6731. __Pyx_XDECREF(__pyx_t_1);
  6732. __Pyx_XDECREF(__pyx_t_2);
  6733. __Pyx_XDECREF(__pyx_t_3);
  6734. __Pyx_XDECREF(__pyx_t_4);
  6735. __Pyx_XDECREF(__pyx_t_5);
  6736. __Pyx_XDECREF(__pyx_t_6);
  6737. __Pyx_XDECREF(__pyx_t_7);
  6738. __Pyx_XDECREF(__pyx_t_8);
  6739. __Pyx_AddTraceback("fontTools.misc.bezierTools.approximateCubicArcLength", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6740. __pyx_r = NULL;
  6741. __pyx_L0:;
  6742. __Pyx_XGIVEREF(__pyx_r);
  6743. __Pyx_RefNannyFinishContext();
  6744. return __pyx_r;
  6745. }
  6746. /* "fontTools/misc/bezierTools.py":362
  6747. *
  6748. *
  6749. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  6750. * @cython.locals(
  6751. * pt1=cython.complex,
  6752. */
  6753. /* Python wrapper */
  6754. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_21approximateCubicArcLengthC(PyObject *__pyx_self,
  6755. #if CYTHON_METH_FASTCALL
  6756. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  6757. #else
  6758. PyObject *__pyx_args, PyObject *__pyx_kwds
  6759. #endif
  6760. ); /*proto*/
  6761. 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.");
  6762. 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};
  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. ) {
  6770. __pyx_t_double_complex __pyx_v_pt1;
  6771. __pyx_t_double_complex __pyx_v_pt2;
  6772. __pyx_t_double_complex __pyx_v_pt3;
  6773. __pyx_t_double_complex __pyx_v_pt4;
  6774. #if !CYTHON_METH_FASTCALL
  6775. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  6776. #endif
  6777. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  6778. PyObject* values[4] = {0,0,0,0};
  6779. int __pyx_lineno = 0;
  6780. const char *__pyx_filename = NULL;
  6781. int __pyx_clineno = 0;
  6782. PyObject *__pyx_r = 0;
  6783. __Pyx_RefNannyDeclarations
  6784. __Pyx_RefNannySetupContext("approximateCubicArcLengthC (wrapper)", 0);
  6785. #if !CYTHON_METH_FASTCALL
  6786. #if CYTHON_ASSUME_SAFE_SIZE
  6787. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  6788. #else
  6789. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  6790. #endif
  6791. #endif
  6792. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  6793. {
  6794. 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};
  6795. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  6796. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 362, __pyx_L3_error)
  6797. if (__pyx_kwds_len > 0) {
  6798. switch (__pyx_nargs) {
  6799. case 4:
  6800. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  6801. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 362, __pyx_L3_error)
  6802. CYTHON_FALLTHROUGH;
  6803. case 3:
  6804. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  6805. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 362, __pyx_L3_error)
  6806. CYTHON_FALLTHROUGH;
  6807. case 2:
  6808. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  6809. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 362, __pyx_L3_error)
  6810. CYTHON_FALLTHROUGH;
  6811. case 1:
  6812. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  6813. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 362, __pyx_L3_error)
  6814. CYTHON_FALLTHROUGH;
  6815. case 0: break;
  6816. default: goto __pyx_L5_argtuple_error;
  6817. }
  6818. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  6819. 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)
  6820. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  6821. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("approximateCubicArcLengthC", 1, 4, 4, i); __PYX_ERR(0, 362, __pyx_L3_error) }
  6822. }
  6823. } else if (unlikely(__pyx_nargs != 4)) {
  6824. goto __pyx_L5_argtuple_error;
  6825. } else {
  6826. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  6827. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 362, __pyx_L3_error)
  6828. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  6829. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 362, __pyx_L3_error)
  6830. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  6831. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 362, __pyx_L3_error)
  6832. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  6833. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 362, __pyx_L3_error)
  6834. }
  6835. __pyx_v_pt1 = __Pyx_PyComplex_As___pyx_t_double_complex(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 376, __pyx_L3_error)
  6836. __pyx_v_pt2 = __Pyx_PyComplex_As___pyx_t_double_complex(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 376, __pyx_L3_error)
  6837. __pyx_v_pt3 = __Pyx_PyComplex_As___pyx_t_double_complex(values[2]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 376, __pyx_L3_error)
  6838. __pyx_v_pt4 = __Pyx_PyComplex_As___pyx_t_double_complex(values[3]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 376, __pyx_L3_error)
  6839. }
  6840. goto __pyx_L6_skip;
  6841. __pyx_L5_argtuple_error:;
  6842. __Pyx_RaiseArgtupleInvalid("approximateCubicArcLengthC", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 362, __pyx_L3_error)
  6843. __pyx_L6_skip:;
  6844. goto __pyx_L4_argument_unpacking_done;
  6845. __pyx_L3_error:;
  6846. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  6847. Py_XDECREF(values[__pyx_temp]);
  6848. }
  6849. __Pyx_AddTraceback("fontTools.misc.bezierTools.approximateCubicArcLengthC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6850. __Pyx_RefNannyFinishContext();
  6851. return NULL;
  6852. __pyx_L4_argument_unpacking_done:;
  6853. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_20approximateCubicArcLengthC(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_pt4);
  6854. /* function exit code */
  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_RefNannyFinishContext();
  6859. return __pyx_r;
  6860. }
  6861. 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) {
  6862. double __pyx_v_v0;
  6863. double __pyx_v_v1;
  6864. double __pyx_v_v2;
  6865. double __pyx_v_v3;
  6866. double __pyx_v_v4;
  6867. PyObject *__pyx_r = NULL;
  6868. __Pyx_RefNannyDeclarations
  6869. PyObject *__pyx_t_1 = NULL;
  6870. int __pyx_lineno = 0;
  6871. const char *__pyx_filename = NULL;
  6872. int __pyx_clineno = 0;
  6873. __Pyx_RefNannySetupContext("approximateCubicArcLengthC", 0);
  6874. /* "fontTools/misc/bezierTools.py":393
  6875. * # abs(BezierCurveC[3].diff(t).subs({t:T})) for T in sorted(0, .5(3/7)**.5/2, .5, 1),
  6876. * # weighted 1/20, 49/180, 32/90, 49/180, 1/20 respectively.
  6877. * v0 = abs(pt2 - pt1) * 0.15 # <<<<<<<<<<<<<<
  6878. * v1 = abs(
  6879. * -0.558983582205757 * pt1
  6880. */
  6881. __pyx_v_v0 = (__Pyx_c_abs_double(__Pyx_c_diff_double(__pyx_v_pt2, __pyx_v_pt1)) * 0.15);
  6882. /* "fontTools/misc/bezierTools.py":394
  6883. * # weighted 1/20, 49/180, 32/90, 49/180, 1/20 respectively.
  6884. * v0 = abs(pt2 - pt1) * 0.15
  6885. * v1 = abs( # <<<<<<<<<<<<<<
  6886. * -0.558983582205757 * pt1
  6887. * + 0.325650248872424 * pt2
  6888. */
  6889. __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)));
  6890. /* "fontTools/misc/bezierTools.py":400
  6891. * + 0.024349751127576 * pt4
  6892. * )
  6893. * v2 = abs(pt4 - pt1 + pt3 - pt2) * 0.26666666666666666 # <<<<<<<<<<<<<<
  6894. * v3 = abs(
  6895. * -0.024349751127576 * pt1
  6896. */
  6897. __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);
  6898. /* "fontTools/misc/bezierTools.py":401
  6899. * )
  6900. * v2 = abs(pt4 - pt1 + pt3 - pt2) * 0.26666666666666666
  6901. * v3 = abs( # <<<<<<<<<<<<<<
  6902. * -0.024349751127576 * pt1
  6903. * - 0.208983582205757 * pt2
  6904. */
  6905. __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)));
  6906. /* "fontTools/misc/bezierTools.py":407
  6907. * + 0.558983582205757 * pt4
  6908. * )
  6909. * v4 = abs(pt4 - pt3) * 0.15 # <<<<<<<<<<<<<<
  6910. *
  6911. * return v0 + v1 + v2 + v3 + v4
  6912. */
  6913. __pyx_v_v4 = (__Pyx_c_abs_double(__Pyx_c_diff_double(__pyx_v_pt4, __pyx_v_pt3)) * 0.15);
  6914. /* "fontTools/misc/bezierTools.py":409
  6915. * v4 = abs(pt4 - pt3) * 0.15
  6916. *
  6917. * return v0 + v1 + v2 + v3 + v4 # <<<<<<<<<<<<<<
  6918. *
  6919. *
  6920. */
  6921. __Pyx_XDECREF(__pyx_r);
  6922. __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)
  6923. __Pyx_GOTREF(__pyx_t_1);
  6924. __pyx_r = __pyx_t_1;
  6925. __pyx_t_1 = 0;
  6926. goto __pyx_L0;
  6927. /* "fontTools/misc/bezierTools.py":362
  6928. *
  6929. *
  6930. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  6931. * @cython.locals(
  6932. * pt1=cython.complex,
  6933. */
  6934. /* function exit code */
  6935. __pyx_L1_error:;
  6936. __Pyx_XDECREF(__pyx_t_1);
  6937. __Pyx_AddTraceback("fontTools.misc.bezierTools.approximateCubicArcLengthC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6938. __pyx_r = NULL;
  6939. __pyx_L0:;
  6940. __Pyx_XGIVEREF(__pyx_r);
  6941. __Pyx_RefNannyFinishContext();
  6942. return __pyx_r;
  6943. }
  6944. /* "fontTools/misc/bezierTools.py":412
  6945. *
  6946. *
  6947. * def calcCubicBounds(pt1, pt2, pt3, pt4): # <<<<<<<<<<<<<<
  6948. * """Calculates the bounding rectangle for a quadratic Bezier segment.
  6949. *
  6950. */
  6951. /* Python wrapper */
  6952. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_23calcCubicBounds(PyObject *__pyx_self,
  6953. #if CYTHON_METH_FASTCALL
  6954. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  6955. #else
  6956. PyObject *__pyx_args, PyObject *__pyx_kwds
  6957. #endif
  6958. ); /*proto*/
  6959. 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");
  6960. 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};
  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. ) {
  6968. PyObject *__pyx_v_pt1 = 0;
  6969. PyObject *__pyx_v_pt2 = 0;
  6970. PyObject *__pyx_v_pt3 = 0;
  6971. PyObject *__pyx_v_pt4 = 0;
  6972. #if !CYTHON_METH_FASTCALL
  6973. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  6974. #endif
  6975. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  6976. PyObject* values[4] = {0,0,0,0};
  6977. int __pyx_lineno = 0;
  6978. const char *__pyx_filename = NULL;
  6979. int __pyx_clineno = 0;
  6980. PyObject *__pyx_r = 0;
  6981. __Pyx_RefNannyDeclarations
  6982. __Pyx_RefNannySetupContext("calcCubicBounds (wrapper)", 0);
  6983. #if !CYTHON_METH_FASTCALL
  6984. #if CYTHON_ASSUME_SAFE_SIZE
  6985. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  6986. #else
  6987. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  6988. #endif
  6989. #endif
  6990. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  6991. {
  6992. 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};
  6993. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  6994. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 412, __pyx_L3_error)
  6995. if (__pyx_kwds_len > 0) {
  6996. switch (__pyx_nargs) {
  6997. case 4:
  6998. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  6999. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 412, __pyx_L3_error)
  7000. CYTHON_FALLTHROUGH;
  7001. case 3:
  7002. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  7003. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 412, __pyx_L3_error)
  7004. CYTHON_FALLTHROUGH;
  7005. case 2:
  7006. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  7007. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 412, __pyx_L3_error)
  7008. CYTHON_FALLTHROUGH;
  7009. case 1:
  7010. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  7011. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 412, __pyx_L3_error)
  7012. CYTHON_FALLTHROUGH;
  7013. case 0: break;
  7014. default: goto __pyx_L5_argtuple_error;
  7015. }
  7016. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  7017. 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)
  7018. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  7019. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("calcCubicBounds", 1, 4, 4, i); __PYX_ERR(0, 412, __pyx_L3_error) }
  7020. }
  7021. } else if (unlikely(__pyx_nargs != 4)) {
  7022. goto __pyx_L5_argtuple_error;
  7023. } else {
  7024. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  7025. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 412, __pyx_L3_error)
  7026. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  7027. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 412, __pyx_L3_error)
  7028. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  7029. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 412, __pyx_L3_error)
  7030. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  7031. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 412, __pyx_L3_error)
  7032. }
  7033. __pyx_v_pt1 = values[0];
  7034. __pyx_v_pt2 = values[1];
  7035. __pyx_v_pt3 = values[2];
  7036. __pyx_v_pt4 = values[3];
  7037. }
  7038. goto __pyx_L6_skip;
  7039. __pyx_L5_argtuple_error:;
  7040. __Pyx_RaiseArgtupleInvalid("calcCubicBounds", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 412, __pyx_L3_error)
  7041. __pyx_L6_skip:;
  7042. goto __pyx_L4_argument_unpacking_done;
  7043. __pyx_L3_error:;
  7044. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  7045. Py_XDECREF(values[__pyx_temp]);
  7046. }
  7047. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcCubicBounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7048. __Pyx_RefNannyFinishContext();
  7049. return NULL;
  7050. __pyx_L4_argument_unpacking_done:;
  7051. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_22calcCubicBounds(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_pt4);
  7052. /* function exit code */
  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_RefNannyFinishContext();
  7057. return __pyx_r;
  7058. }
  7059. 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) {
  7060. PyObject *__pyx_v_ax = NULL;
  7061. PyObject *__pyx_v_ay = NULL;
  7062. PyObject *__pyx_v_bx = NULL;
  7063. PyObject *__pyx_v_by = NULL;
  7064. PyObject *__pyx_v_cx = NULL;
  7065. PyObject *__pyx_v_cy = NULL;
  7066. PyObject *__pyx_v_dx = NULL;
  7067. PyObject *__pyx_v_dy = NULL;
  7068. PyObject *__pyx_v_ax3 = NULL;
  7069. PyObject *__pyx_v_ay3 = NULL;
  7070. PyObject *__pyx_v_bx2 = NULL;
  7071. PyObject *__pyx_v_by2 = NULL;
  7072. PyObject *__pyx_v_xRoots = NULL;
  7073. PyObject *__pyx_v_yRoots = NULL;
  7074. PyObject *__pyx_v_roots = NULL;
  7075. PyObject *__pyx_v_points = NULL;
  7076. PyObject *__pyx_8genexpr1__pyx_v_t = NULL;
  7077. PyObject *__pyx_8genexpr2__pyx_v_t = NULL;
  7078. PyObject *__pyx_8genexpr3__pyx_v_t = NULL;
  7079. PyObject *__pyx_r = NULL;
  7080. __Pyx_RefNannyDeclarations
  7081. PyObject *__pyx_t_1 = NULL;
  7082. PyObject *__pyx_t_2 = NULL;
  7083. PyObject *__pyx_t_3 = NULL;
  7084. size_t __pyx_t_4;
  7085. PyObject *__pyx_t_5 = NULL;
  7086. PyObject *__pyx_t_6 = NULL;
  7087. PyObject *__pyx_t_7 = NULL;
  7088. PyObject *(*__pyx_t_8)(PyObject *);
  7089. PyObject *__pyx_t_9 = NULL;
  7090. PyObject *__pyx_t_10 = NULL;
  7091. Py_ssize_t __pyx_t_11;
  7092. PyObject *(*__pyx_t_12)(PyObject *);
  7093. int __pyx_t_13;
  7094. int __pyx_lineno = 0;
  7095. const char *__pyx_filename = NULL;
  7096. int __pyx_clineno = 0;
  7097. __Pyx_RefNannySetupContext("calcCubicBounds", 0);
  7098. /* "fontTools/misc/bezierTools.py":430
  7099. * 35.566243 0.000000 64.433757 75.000000
  7100. * """
  7101. * (ax, ay), (bx, by), (cx, cy), (dx, dy) = calcCubicParameters(pt1, pt2, pt3, pt4) # <<<<<<<<<<<<<<
  7102. * # calc first derivative
  7103. * ax3 = ax * 3.0
  7104. */
  7105. __pyx_t_2 = NULL;
  7106. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_calcCubicParameters); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 430, __pyx_L1_error)
  7107. __Pyx_GOTREF(__pyx_t_3);
  7108. __pyx_t_4 = 1;
  7109. #if CYTHON_UNPACK_METHODS
  7110. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  7111. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  7112. assert(__pyx_t_2);
  7113. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  7114. __Pyx_INCREF(__pyx_t_2);
  7115. __Pyx_INCREF(__pyx__function);
  7116. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  7117. __pyx_t_4 = 0;
  7118. }
  7119. #endif
  7120. {
  7121. PyObject *__pyx_callargs[5] = {__pyx_t_2, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_pt4};
  7122. __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));
  7123. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  7124. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7125. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error)
  7126. __Pyx_GOTREF(__pyx_t_1);
  7127. }
  7128. if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
  7129. PyObject* sequence = __pyx_t_1;
  7130. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  7131. if (unlikely(size != 4)) {
  7132. if (size > 4) __Pyx_RaiseTooManyValuesError(4);
  7133. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  7134. __PYX_ERR(0, 430, __pyx_L1_error)
  7135. }
  7136. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  7137. if (likely(PyTuple_CheckExact(sequence))) {
  7138. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  7139. __Pyx_INCREF(__pyx_t_3);
  7140. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  7141. __Pyx_INCREF(__pyx_t_2);
  7142. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2);
  7143. __Pyx_INCREF(__pyx_t_5);
  7144. __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3);
  7145. __Pyx_INCREF(__pyx_t_6);
  7146. } else {
  7147. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  7148. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 430, __pyx_L1_error)
  7149. __Pyx_XGOTREF(__pyx_t_3);
  7150. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  7151. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 430, __pyx_L1_error)
  7152. __Pyx_XGOTREF(__pyx_t_2);
  7153. __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  7154. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 430, __pyx_L1_error)
  7155. __Pyx_XGOTREF(__pyx_t_5);
  7156. __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 3, __Pyx_ReferenceSharing_SharedReference);
  7157. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 430, __pyx_L1_error)
  7158. __Pyx_XGOTREF(__pyx_t_6);
  7159. }
  7160. #else
  7161. {
  7162. Py_ssize_t i;
  7163. PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_2,&__pyx_t_5,&__pyx_t_6};
  7164. for (i=0; i < 4; i++) {
  7165. PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 430, __pyx_L1_error)
  7166. __Pyx_GOTREF(item);
  7167. *(temps[i]) = item;
  7168. }
  7169. }
  7170. #endif
  7171. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7172. } else {
  7173. Py_ssize_t index = -1;
  7174. PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_2,&__pyx_t_5,&__pyx_t_6};
  7175. __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L1_error)
  7176. __Pyx_GOTREF(__pyx_t_7);
  7177. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7178. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
  7179. for (index=0; index < 4; index++) {
  7180. PyObject* item = __pyx_t_8(__pyx_t_7); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
  7181. __Pyx_GOTREF(item);
  7182. *(temps[index]) = item;
  7183. }
  7184. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 4) < (0)) __PYX_ERR(0, 430, __pyx_L1_error)
  7185. __pyx_t_8 = NULL;
  7186. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  7187. goto __pyx_L4_unpacking_done;
  7188. __pyx_L3_unpacking_failed:;
  7189. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  7190. __pyx_t_8 = NULL;
  7191. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  7192. __PYX_ERR(0, 430, __pyx_L1_error)
  7193. __pyx_L4_unpacking_done:;
  7194. }
  7195. if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
  7196. PyObject* sequence = __pyx_t_3;
  7197. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  7198. if (unlikely(size != 2)) {
  7199. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  7200. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  7201. __PYX_ERR(0, 430, __pyx_L1_error)
  7202. }
  7203. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  7204. if (likely(PyTuple_CheckExact(sequence))) {
  7205. __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0);
  7206. __Pyx_INCREF(__pyx_t_7);
  7207. __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
  7208. __Pyx_INCREF(__pyx_t_9);
  7209. } else {
  7210. __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  7211. if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L1_error)
  7212. __Pyx_XGOTREF(__pyx_t_7);
  7213. __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  7214. if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 430, __pyx_L1_error)
  7215. __Pyx_XGOTREF(__pyx_t_9);
  7216. }
  7217. #else
  7218. __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L1_error)
  7219. __Pyx_GOTREF(__pyx_t_7);
  7220. __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 430, __pyx_L1_error)
  7221. __Pyx_GOTREF(__pyx_t_9);
  7222. #endif
  7223. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7224. } else {
  7225. Py_ssize_t index = -1;
  7226. __pyx_t_10 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 430, __pyx_L1_error)
  7227. __Pyx_GOTREF(__pyx_t_10);
  7228. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7229. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
  7230. index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed;
  7231. __Pyx_GOTREF(__pyx_t_7);
  7232. index = 1; __pyx_t_9 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L5_unpacking_failed;
  7233. __Pyx_GOTREF(__pyx_t_9);
  7234. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_10), 2) < (0)) __PYX_ERR(0, 430, __pyx_L1_error)
  7235. __pyx_t_8 = NULL;
  7236. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  7237. goto __pyx_L6_unpacking_done;
  7238. __pyx_L5_unpacking_failed:;
  7239. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  7240. __pyx_t_8 = NULL;
  7241. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  7242. __PYX_ERR(0, 430, __pyx_L1_error)
  7243. __pyx_L6_unpacking_done:;
  7244. }
  7245. __pyx_v_ax = __pyx_t_7;
  7246. __pyx_t_7 = 0;
  7247. __pyx_v_ay = __pyx_t_9;
  7248. __pyx_t_9 = 0;
  7249. if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
  7250. PyObject* sequence = __pyx_t_2;
  7251. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  7252. if (unlikely(size != 2)) {
  7253. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  7254. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  7255. __PYX_ERR(0, 430, __pyx_L1_error)
  7256. }
  7257. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  7258. if (likely(PyTuple_CheckExact(sequence))) {
  7259. __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0);
  7260. __Pyx_INCREF(__pyx_t_9);
  7261. __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
  7262. __Pyx_INCREF(__pyx_t_7);
  7263. } else {
  7264. __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  7265. if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 430, __pyx_L1_error)
  7266. __Pyx_XGOTREF(__pyx_t_9);
  7267. __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  7268. if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L1_error)
  7269. __Pyx_XGOTREF(__pyx_t_7);
  7270. }
  7271. #else
  7272. __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 430, __pyx_L1_error)
  7273. __Pyx_GOTREF(__pyx_t_9);
  7274. __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L1_error)
  7275. __Pyx_GOTREF(__pyx_t_7);
  7276. #endif
  7277. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7278. } else {
  7279. Py_ssize_t index = -1;
  7280. __pyx_t_10 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 430, __pyx_L1_error)
  7281. __Pyx_GOTREF(__pyx_t_10);
  7282. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7283. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
  7284. index = 0; __pyx_t_9 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L7_unpacking_failed;
  7285. __Pyx_GOTREF(__pyx_t_9);
  7286. index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed;
  7287. __Pyx_GOTREF(__pyx_t_7);
  7288. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_10), 2) < (0)) __PYX_ERR(0, 430, __pyx_L1_error)
  7289. __pyx_t_8 = NULL;
  7290. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  7291. goto __pyx_L8_unpacking_done;
  7292. __pyx_L7_unpacking_failed:;
  7293. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  7294. __pyx_t_8 = NULL;
  7295. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  7296. __PYX_ERR(0, 430, __pyx_L1_error)
  7297. __pyx_L8_unpacking_done:;
  7298. }
  7299. __pyx_v_bx = __pyx_t_9;
  7300. __pyx_t_9 = 0;
  7301. __pyx_v_by = __pyx_t_7;
  7302. __pyx_t_7 = 0;
  7303. if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
  7304. PyObject* sequence = __pyx_t_5;
  7305. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  7306. if (unlikely(size != 2)) {
  7307. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  7308. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  7309. __PYX_ERR(0, 430, __pyx_L1_error)
  7310. }
  7311. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  7312. if (likely(PyTuple_CheckExact(sequence))) {
  7313. __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0);
  7314. __Pyx_INCREF(__pyx_t_7);
  7315. __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
  7316. __Pyx_INCREF(__pyx_t_9);
  7317. } else {
  7318. __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  7319. if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L1_error)
  7320. __Pyx_XGOTREF(__pyx_t_7);
  7321. __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  7322. if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 430, __pyx_L1_error)
  7323. __Pyx_XGOTREF(__pyx_t_9);
  7324. }
  7325. #else
  7326. __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L1_error)
  7327. __Pyx_GOTREF(__pyx_t_7);
  7328. __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 430, __pyx_L1_error)
  7329. __Pyx_GOTREF(__pyx_t_9);
  7330. #endif
  7331. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7332. } else {
  7333. Py_ssize_t index = -1;
  7334. __pyx_t_10 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 430, __pyx_L1_error)
  7335. __Pyx_GOTREF(__pyx_t_10);
  7336. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7337. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
  7338. index = 0; __pyx_t_7 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L9_unpacking_failed;
  7339. __Pyx_GOTREF(__pyx_t_7);
  7340. index = 1; __pyx_t_9 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L9_unpacking_failed;
  7341. __Pyx_GOTREF(__pyx_t_9);
  7342. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_10), 2) < (0)) __PYX_ERR(0, 430, __pyx_L1_error)
  7343. __pyx_t_8 = NULL;
  7344. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  7345. goto __pyx_L10_unpacking_done;
  7346. __pyx_L9_unpacking_failed:;
  7347. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  7348. __pyx_t_8 = NULL;
  7349. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  7350. __PYX_ERR(0, 430, __pyx_L1_error)
  7351. __pyx_L10_unpacking_done:;
  7352. }
  7353. __pyx_v_cx = __pyx_t_7;
  7354. __pyx_t_7 = 0;
  7355. __pyx_v_cy = __pyx_t_9;
  7356. __pyx_t_9 = 0;
  7357. if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
  7358. PyObject* sequence = __pyx_t_6;
  7359. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  7360. if (unlikely(size != 2)) {
  7361. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  7362. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  7363. __PYX_ERR(0, 430, __pyx_L1_error)
  7364. }
  7365. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  7366. if (likely(PyTuple_CheckExact(sequence))) {
  7367. __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0);
  7368. __Pyx_INCREF(__pyx_t_9);
  7369. __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
  7370. __Pyx_INCREF(__pyx_t_7);
  7371. } else {
  7372. __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  7373. if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 430, __pyx_L1_error)
  7374. __Pyx_XGOTREF(__pyx_t_9);
  7375. __pyx_t_7 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  7376. if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L1_error)
  7377. __Pyx_XGOTREF(__pyx_t_7);
  7378. }
  7379. #else
  7380. __pyx_t_9 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 430, __pyx_L1_error)
  7381. __Pyx_GOTREF(__pyx_t_9);
  7382. __pyx_t_7 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L1_error)
  7383. __Pyx_GOTREF(__pyx_t_7);
  7384. #endif
  7385. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7386. } else {
  7387. Py_ssize_t index = -1;
  7388. __pyx_t_10 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 430, __pyx_L1_error)
  7389. __Pyx_GOTREF(__pyx_t_10);
  7390. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7391. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
  7392. index = 0; __pyx_t_9 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L11_unpacking_failed;
  7393. __Pyx_GOTREF(__pyx_t_9);
  7394. index = 1; __pyx_t_7 = __pyx_t_8(__pyx_t_10); if (unlikely(!__pyx_t_7)) goto __pyx_L11_unpacking_failed;
  7395. __Pyx_GOTREF(__pyx_t_7);
  7396. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_10), 2) < (0)) __PYX_ERR(0, 430, __pyx_L1_error)
  7397. __pyx_t_8 = NULL;
  7398. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  7399. goto __pyx_L12_unpacking_done;
  7400. __pyx_L11_unpacking_failed:;
  7401. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  7402. __pyx_t_8 = NULL;
  7403. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  7404. __PYX_ERR(0, 430, __pyx_L1_error)
  7405. __pyx_L12_unpacking_done:;
  7406. }
  7407. __pyx_v_dx = __pyx_t_9;
  7408. __pyx_t_9 = 0;
  7409. __pyx_v_dy = __pyx_t_7;
  7410. __pyx_t_7 = 0;
  7411. /* "fontTools/misc/bezierTools.py":432
  7412. * (ax, ay), (bx, by), (cx, cy), (dx, dy) = calcCubicParameters(pt1, pt2, pt3, pt4)
  7413. * # calc first derivative
  7414. * ax3 = ax * 3.0 # <<<<<<<<<<<<<<
  7415. * ay3 = ay * 3.0
  7416. * bx2 = bx * 2.0
  7417. */
  7418. __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)
  7419. __Pyx_GOTREF(__pyx_t_1);
  7420. __pyx_v_ax3 = __pyx_t_1;
  7421. __pyx_t_1 = 0;
  7422. /* "fontTools/misc/bezierTools.py":433
  7423. * # calc first derivative
  7424. * ax3 = ax * 3.0
  7425. * ay3 = ay * 3.0 # <<<<<<<<<<<<<<
  7426. * bx2 = bx * 2.0
  7427. * by2 = by * 2.0
  7428. */
  7429. __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)
  7430. __Pyx_GOTREF(__pyx_t_1);
  7431. __pyx_v_ay3 = __pyx_t_1;
  7432. __pyx_t_1 = 0;
  7433. /* "fontTools/misc/bezierTools.py":434
  7434. * ax3 = ax * 3.0
  7435. * ay3 = ay * 3.0
  7436. * bx2 = bx * 2.0 # <<<<<<<<<<<<<<
  7437. * by2 = by * 2.0
  7438. * xRoots = [t for t in solveQuadratic(ax3, bx2, cx) if 0 <= t < 1]
  7439. */
  7440. __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)
  7441. __Pyx_GOTREF(__pyx_t_1);
  7442. __pyx_v_bx2 = __pyx_t_1;
  7443. __pyx_t_1 = 0;
  7444. /* "fontTools/misc/bezierTools.py":435
  7445. * ay3 = ay * 3.0
  7446. * bx2 = bx * 2.0
  7447. * by2 = by * 2.0 # <<<<<<<<<<<<<<
  7448. * xRoots = [t for t in solveQuadratic(ax3, bx2, cx) if 0 <= t < 1]
  7449. * yRoots = [t for t in solveQuadratic(ay3, by2, cy) if 0 <= t < 1]
  7450. */
  7451. __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)
  7452. __Pyx_GOTREF(__pyx_t_1);
  7453. __pyx_v_by2 = __pyx_t_1;
  7454. __pyx_t_1 = 0;
  7455. /* "fontTools/misc/bezierTools.py":436
  7456. * bx2 = bx * 2.0
  7457. * by2 = by * 2.0
  7458. * xRoots = [t for t in solveQuadratic(ax3, bx2, cx) if 0 <= t < 1] # <<<<<<<<<<<<<<
  7459. * yRoots = [t for t in solveQuadratic(ay3, by2, cy) if 0 <= t < 1]
  7460. * roots = xRoots + yRoots
  7461. */
  7462. { /* enter inner scope */
  7463. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L15_error)
  7464. __Pyx_GOTREF(__pyx_t_1);
  7465. __pyx_t_5 = NULL;
  7466. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_solveQuadratic); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 436, __pyx_L15_error)
  7467. __Pyx_GOTREF(__pyx_t_2);
  7468. __pyx_t_4 = 1;
  7469. #if CYTHON_UNPACK_METHODS
  7470. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  7471. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
  7472. assert(__pyx_t_5);
  7473. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  7474. __Pyx_INCREF(__pyx_t_5);
  7475. __Pyx_INCREF(__pyx__function);
  7476. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  7477. __pyx_t_4 = 0;
  7478. }
  7479. #endif
  7480. {
  7481. PyObject *__pyx_callargs[4] = {__pyx_t_5, __pyx_v_ax3, __pyx_v_bx2, __pyx_v_cx};
  7482. __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));
  7483. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  7484. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7485. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 436, __pyx_L15_error)
  7486. __Pyx_GOTREF(__pyx_t_6);
  7487. }
  7488. if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
  7489. __pyx_t_2 = __pyx_t_6; __Pyx_INCREF(__pyx_t_2);
  7490. __pyx_t_11 = 0;
  7491. __pyx_t_12 = NULL;
  7492. } else {
  7493. __pyx_t_11 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 436, __pyx_L15_error)
  7494. __Pyx_GOTREF(__pyx_t_2);
  7495. __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)
  7496. }
  7497. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7498. for (;;) {
  7499. if (likely(!__pyx_t_12)) {
  7500. if (likely(PyList_CheckExact(__pyx_t_2))) {
  7501. {
  7502. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
  7503. #if !CYTHON_ASSUME_SAFE_SIZE
  7504. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 436, __pyx_L15_error)
  7505. #endif
  7506. if (__pyx_t_11 >= __pyx_temp) break;
  7507. }
  7508. __pyx_t_6 = __Pyx_PyList_GetItemRefFast(__pyx_t_2, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference);
  7509. ++__pyx_t_11;
  7510. } else {
  7511. {
  7512. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
  7513. #if !CYTHON_ASSUME_SAFE_SIZE
  7514. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 436, __pyx_L15_error)
  7515. #endif
  7516. if (__pyx_t_11 >= __pyx_temp) break;
  7517. }
  7518. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  7519. __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_11));
  7520. #else
  7521. __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_11);
  7522. #endif
  7523. ++__pyx_t_11;
  7524. }
  7525. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 436, __pyx_L15_error)
  7526. } else {
  7527. __pyx_t_6 = __pyx_t_12(__pyx_t_2);
  7528. if (unlikely(!__pyx_t_6)) {
  7529. PyObject* exc_type = PyErr_Occurred();
  7530. if (exc_type) {
  7531. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 436, __pyx_L15_error)
  7532. PyErr_Clear();
  7533. }
  7534. break;
  7535. }
  7536. }
  7537. __Pyx_GOTREF(__pyx_t_6);
  7538. __Pyx_XDECREF_SET(__pyx_8genexpr1__pyx_v_t, __pyx_t_6);
  7539. __pyx_t_6 = 0;
  7540. __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)
  7541. if (__Pyx_PyObject_IsTrue(__pyx_t_6)) {
  7542. __Pyx_DECREF(__pyx_t_6);
  7543. __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)
  7544. }
  7545. __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 436, __pyx_L15_error)
  7546. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7547. if (__pyx_t_13) {
  7548. if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_8genexpr1__pyx_v_t))) __PYX_ERR(0, 436, __pyx_L15_error)
  7549. }
  7550. }
  7551. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7552. __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_t); __pyx_8genexpr1__pyx_v_t = 0;
  7553. goto __pyx_L20_exit_scope;
  7554. __pyx_L15_error:;
  7555. __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_t); __pyx_8genexpr1__pyx_v_t = 0;
  7556. goto __pyx_L1_error;
  7557. __pyx_L20_exit_scope:;
  7558. } /* exit inner scope */
  7559. __pyx_v_xRoots = ((PyObject*)__pyx_t_1);
  7560. __pyx_t_1 = 0;
  7561. /* "fontTools/misc/bezierTools.py":437
  7562. * by2 = by * 2.0
  7563. * xRoots = [t for t in solveQuadratic(ax3, bx2, cx) if 0 <= t < 1]
  7564. * yRoots = [t for t in solveQuadratic(ay3, by2, cy) if 0 <= t < 1] # <<<<<<<<<<<<<<
  7565. * roots = xRoots + yRoots
  7566. *
  7567. */
  7568. { /* enter inner scope */
  7569. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 437, __pyx_L23_error)
  7570. __Pyx_GOTREF(__pyx_t_1);
  7571. __pyx_t_6 = NULL;
  7572. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_solveQuadratic); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 437, __pyx_L23_error)
  7573. __Pyx_GOTREF(__pyx_t_5);
  7574. __pyx_t_4 = 1;
  7575. #if CYTHON_UNPACK_METHODS
  7576. if (unlikely(PyMethod_Check(__pyx_t_5))) {
  7577. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
  7578. assert(__pyx_t_6);
  7579. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
  7580. __Pyx_INCREF(__pyx_t_6);
  7581. __Pyx_INCREF(__pyx__function);
  7582. __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
  7583. __pyx_t_4 = 0;
  7584. }
  7585. #endif
  7586. {
  7587. PyObject *__pyx_callargs[4] = {__pyx_t_6, __pyx_v_ay3, __pyx_v_by2, __pyx_v_cy};
  7588. __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));
  7589. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  7590. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7591. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __pyx_L23_error)
  7592. __Pyx_GOTREF(__pyx_t_2);
  7593. }
  7594. if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
  7595. __pyx_t_5 = __pyx_t_2; __Pyx_INCREF(__pyx_t_5);
  7596. __pyx_t_11 = 0;
  7597. __pyx_t_12 = NULL;
  7598. } else {
  7599. __pyx_t_11 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 437, __pyx_L23_error)
  7600. __Pyx_GOTREF(__pyx_t_5);
  7601. __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)
  7602. }
  7603. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7604. for (;;) {
  7605. if (likely(!__pyx_t_12)) {
  7606. if (likely(PyList_CheckExact(__pyx_t_5))) {
  7607. {
  7608. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
  7609. #if !CYTHON_ASSUME_SAFE_SIZE
  7610. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 437, __pyx_L23_error)
  7611. #endif
  7612. if (__pyx_t_11 >= __pyx_temp) break;
  7613. }
  7614. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference);
  7615. ++__pyx_t_11;
  7616. } else {
  7617. {
  7618. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_5);
  7619. #if !CYTHON_ASSUME_SAFE_SIZE
  7620. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 437, __pyx_L23_error)
  7621. #endif
  7622. if (__pyx_t_11 >= __pyx_temp) break;
  7623. }
  7624. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  7625. __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_11));
  7626. #else
  7627. __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_11);
  7628. #endif
  7629. ++__pyx_t_11;
  7630. }
  7631. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __pyx_L23_error)
  7632. } else {
  7633. __pyx_t_2 = __pyx_t_12(__pyx_t_5);
  7634. if (unlikely(!__pyx_t_2)) {
  7635. PyObject* exc_type = PyErr_Occurred();
  7636. if (exc_type) {
  7637. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 437, __pyx_L23_error)
  7638. PyErr_Clear();
  7639. }
  7640. break;
  7641. }
  7642. }
  7643. __Pyx_GOTREF(__pyx_t_2);
  7644. __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_t, __pyx_t_2);
  7645. __pyx_t_2 = 0;
  7646. __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)
  7647. if (__Pyx_PyObject_IsTrue(__pyx_t_2)) {
  7648. __Pyx_DECREF(__pyx_t_2);
  7649. __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)
  7650. }
  7651. __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 437, __pyx_L23_error)
  7652. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7653. if (__pyx_t_13) {
  7654. if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_8genexpr2__pyx_v_t))) __PYX_ERR(0, 437, __pyx_L23_error)
  7655. }
  7656. }
  7657. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7658. __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_t); __pyx_8genexpr2__pyx_v_t = 0;
  7659. goto __pyx_L28_exit_scope;
  7660. __pyx_L23_error:;
  7661. __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_t); __pyx_8genexpr2__pyx_v_t = 0;
  7662. goto __pyx_L1_error;
  7663. __pyx_L28_exit_scope:;
  7664. } /* exit inner scope */
  7665. __pyx_v_yRoots = ((PyObject*)__pyx_t_1);
  7666. __pyx_t_1 = 0;
  7667. /* "fontTools/misc/bezierTools.py":438
  7668. * xRoots = [t for t in solveQuadratic(ax3, bx2, cx) if 0 <= t < 1]
  7669. * yRoots = [t for t in solveQuadratic(ay3, by2, cy) if 0 <= t < 1]
  7670. * roots = xRoots + yRoots # <<<<<<<<<<<<<<
  7671. *
  7672. * points = [
  7673. */
  7674. __pyx_t_1 = PyNumber_Add(__pyx_v_xRoots, __pyx_v_yRoots); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __pyx_L1_error)
  7675. __Pyx_GOTREF(__pyx_t_1);
  7676. __pyx_v_roots = ((PyObject*)__pyx_t_1);
  7677. __pyx_t_1 = 0;
  7678. /* "fontTools/misc/bezierTools.py":446
  7679. * )
  7680. * for t in roots
  7681. * ] + [pt1, pt4] # <<<<<<<<<<<<<<
  7682. * return calcBounds(points)
  7683. *
  7684. */
  7685. { /* enter inner scope */
  7686. /* "fontTools/misc/bezierTools.py":440
  7687. * roots = xRoots + yRoots
  7688. *
  7689. * points = [ # <<<<<<<<<<<<<<
  7690. * (
  7691. * ax * t * t * t + bx * t * t + cx * t + dx,
  7692. */
  7693. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 440, __pyx_L31_error)
  7694. __Pyx_GOTREF(__pyx_t_1);
  7695. /* "fontTools/misc/bezierTools.py":445
  7696. * ay * t * t * t + by * t * t + cy * t + dy,
  7697. * )
  7698. * for t in roots # <<<<<<<<<<<<<<
  7699. * ] + [pt1, pt4]
  7700. * return calcBounds(points)
  7701. */
  7702. __pyx_t_5 = __pyx_v_roots; __Pyx_INCREF(__pyx_t_5);
  7703. __pyx_t_11 = 0;
  7704. for (;;) {
  7705. {
  7706. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_5);
  7707. #if !CYTHON_ASSUME_SAFE_SIZE
  7708. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 445, __pyx_L31_error)
  7709. #endif
  7710. if (__pyx_t_11 >= __pyx_temp) break;
  7711. }
  7712. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_5, __pyx_t_11, __Pyx_ReferenceSharing_OwnStrongReference);
  7713. ++__pyx_t_11;
  7714. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 445, __pyx_L31_error)
  7715. __Pyx_GOTREF(__pyx_t_2);
  7716. __Pyx_XDECREF_SET(__pyx_8genexpr3__pyx_v_t, __pyx_t_2);
  7717. __pyx_t_2 = 0;
  7718. /* "fontTools/misc/bezierTools.py":442
  7719. * points = [
  7720. * (
  7721. * ax * t * t * t + bx * t * t + cx * t + dx, # <<<<<<<<<<<<<<
  7722. * ay * t * t * t + by * t * t + cy * t + dy,
  7723. * )
  7724. */
  7725. __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)
  7726. __Pyx_GOTREF(__pyx_t_2);
  7727. __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)
  7728. __Pyx_GOTREF(__pyx_t_6);
  7729. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7730. __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)
  7731. __Pyx_GOTREF(__pyx_t_2);
  7732. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7733. __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)
  7734. __Pyx_GOTREF(__pyx_t_6);
  7735. __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)
  7736. __Pyx_GOTREF(__pyx_t_3);
  7737. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7738. __pyx_t_6 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 442, __pyx_L31_error)
  7739. __Pyx_GOTREF(__pyx_t_6);
  7740. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7741. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7742. __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)
  7743. __Pyx_GOTREF(__pyx_t_3);
  7744. __pyx_t_2 = PyNumber_Add(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 442, __pyx_L31_error)
  7745. __Pyx_GOTREF(__pyx_t_2);
  7746. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7747. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7748. __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_dx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 442, __pyx_L31_error)
  7749. __Pyx_GOTREF(__pyx_t_3);
  7750. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7751. /* "fontTools/misc/bezierTools.py":443
  7752. * (
  7753. * ax * t * t * t + bx * t * t + cx * t + dx,
  7754. * ay * t * t * t + by * t * t + cy * t + dy, # <<<<<<<<<<<<<<
  7755. * )
  7756. * for t in roots
  7757. */
  7758. __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)
  7759. __Pyx_GOTREF(__pyx_t_2);
  7760. __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)
  7761. __Pyx_GOTREF(__pyx_t_6);
  7762. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7763. __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)
  7764. __Pyx_GOTREF(__pyx_t_2);
  7765. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7766. __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)
  7767. __Pyx_GOTREF(__pyx_t_6);
  7768. __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)
  7769. __Pyx_GOTREF(__pyx_t_7);
  7770. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7771. __pyx_t_6 = PyNumber_Add(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 443, __pyx_L31_error)
  7772. __Pyx_GOTREF(__pyx_t_6);
  7773. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7774. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  7775. __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)
  7776. __Pyx_GOTREF(__pyx_t_7);
  7777. __pyx_t_2 = PyNumber_Add(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 443, __pyx_L31_error)
  7778. __Pyx_GOTREF(__pyx_t_2);
  7779. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  7780. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  7781. __pyx_t_7 = PyNumber_Add(__pyx_t_2, __pyx_v_dy); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 443, __pyx_L31_error)
  7782. __Pyx_GOTREF(__pyx_t_7);
  7783. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7784. /* "fontTools/misc/bezierTools.py":442
  7785. * points = [
  7786. * (
  7787. * ax * t * t * t + bx * t * t + cx * t + dx, # <<<<<<<<<<<<<<
  7788. * ay * t * t * t + by * t * t + cy * t + dy,
  7789. * )
  7790. */
  7791. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 442, __pyx_L31_error)
  7792. __Pyx_GOTREF(__pyx_t_2);
  7793. __Pyx_GIVEREF(__pyx_t_3);
  7794. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 442, __pyx_L31_error);
  7795. __Pyx_GIVEREF(__pyx_t_7);
  7796. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7) != (0)) __PYX_ERR(0, 442, __pyx_L31_error);
  7797. __pyx_t_3 = 0;
  7798. __pyx_t_7 = 0;
  7799. if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 440, __pyx_L31_error)
  7800. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7801. /* "fontTools/misc/bezierTools.py":445
  7802. * ay * t * t * t + by * t * t + cy * t + dy,
  7803. * )
  7804. * for t in roots # <<<<<<<<<<<<<<
  7805. * ] + [pt1, pt4]
  7806. * return calcBounds(points)
  7807. */
  7808. }
  7809. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7810. __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_t); __pyx_8genexpr3__pyx_v_t = 0;
  7811. goto __pyx_L35_exit_scope;
  7812. __pyx_L31_error:;
  7813. __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_t); __pyx_8genexpr3__pyx_v_t = 0;
  7814. goto __pyx_L1_error;
  7815. __pyx_L35_exit_scope:;
  7816. } /* exit inner scope */
  7817. /* "fontTools/misc/bezierTools.py":446
  7818. * )
  7819. * for t in roots
  7820. * ] + [pt1, pt4] # <<<<<<<<<<<<<<
  7821. * return calcBounds(points)
  7822. *
  7823. */
  7824. __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 446, __pyx_L1_error)
  7825. __Pyx_GOTREF(__pyx_t_5);
  7826. __Pyx_INCREF(__pyx_v_pt1);
  7827. __Pyx_GIVEREF(__pyx_v_pt1);
  7828. if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, __pyx_v_pt1) != (0)) __PYX_ERR(0, 446, __pyx_L1_error);
  7829. __Pyx_INCREF(__pyx_v_pt4);
  7830. __Pyx_GIVEREF(__pyx_v_pt4);
  7831. if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 1, __pyx_v_pt4) != (0)) __PYX_ERR(0, 446, __pyx_L1_error);
  7832. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 446, __pyx_L1_error)
  7833. __Pyx_GOTREF(__pyx_t_2);
  7834. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7835. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7836. __pyx_v_points = ((PyObject*)__pyx_t_2);
  7837. __pyx_t_2 = 0;
  7838. /* "fontTools/misc/bezierTools.py":447
  7839. * for t in roots
  7840. * ] + [pt1, pt4]
  7841. * return calcBounds(points) # <<<<<<<<<<<<<<
  7842. *
  7843. *
  7844. */
  7845. __Pyx_XDECREF(__pyx_r);
  7846. __pyx_t_5 = NULL;
  7847. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_calcBounds); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error)
  7848. __Pyx_GOTREF(__pyx_t_1);
  7849. __pyx_t_4 = 1;
  7850. #if CYTHON_UNPACK_METHODS
  7851. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  7852. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
  7853. assert(__pyx_t_5);
  7854. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  7855. __Pyx_INCREF(__pyx_t_5);
  7856. __Pyx_INCREF(__pyx__function);
  7857. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  7858. __pyx_t_4 = 0;
  7859. }
  7860. #endif
  7861. {
  7862. PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_points};
  7863. __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));
  7864. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  7865. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7866. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 447, __pyx_L1_error)
  7867. __Pyx_GOTREF(__pyx_t_2);
  7868. }
  7869. __pyx_r = __pyx_t_2;
  7870. __pyx_t_2 = 0;
  7871. goto __pyx_L0;
  7872. /* "fontTools/misc/bezierTools.py":412
  7873. *
  7874. *
  7875. * def calcCubicBounds(pt1, pt2, pt3, pt4): # <<<<<<<<<<<<<<
  7876. * """Calculates the bounding rectangle for a quadratic Bezier segment.
  7877. *
  7878. */
  7879. /* function exit code */
  7880. __pyx_L1_error:;
  7881. __Pyx_XDECREF(__pyx_t_1);
  7882. __Pyx_XDECREF(__pyx_t_2);
  7883. __Pyx_XDECREF(__pyx_t_3);
  7884. __Pyx_XDECREF(__pyx_t_5);
  7885. __Pyx_XDECREF(__pyx_t_6);
  7886. __Pyx_XDECREF(__pyx_t_7);
  7887. __Pyx_XDECREF(__pyx_t_9);
  7888. __Pyx_XDECREF(__pyx_t_10);
  7889. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcCubicBounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7890. __pyx_r = NULL;
  7891. __pyx_L0:;
  7892. __Pyx_XDECREF(__pyx_v_ax);
  7893. __Pyx_XDECREF(__pyx_v_ay);
  7894. __Pyx_XDECREF(__pyx_v_bx);
  7895. __Pyx_XDECREF(__pyx_v_by);
  7896. __Pyx_XDECREF(__pyx_v_cx);
  7897. __Pyx_XDECREF(__pyx_v_cy);
  7898. __Pyx_XDECREF(__pyx_v_dx);
  7899. __Pyx_XDECREF(__pyx_v_dy);
  7900. __Pyx_XDECREF(__pyx_v_ax3);
  7901. __Pyx_XDECREF(__pyx_v_ay3);
  7902. __Pyx_XDECREF(__pyx_v_bx2);
  7903. __Pyx_XDECREF(__pyx_v_by2);
  7904. __Pyx_XDECREF(__pyx_v_xRoots);
  7905. __Pyx_XDECREF(__pyx_v_yRoots);
  7906. __Pyx_XDECREF(__pyx_v_roots);
  7907. __Pyx_XDECREF(__pyx_v_points);
  7908. __Pyx_XDECREF(__pyx_8genexpr1__pyx_v_t);
  7909. __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_t);
  7910. __Pyx_XDECREF(__pyx_8genexpr3__pyx_v_t);
  7911. __Pyx_XGIVEREF(__pyx_r);
  7912. __Pyx_RefNannyFinishContext();
  7913. return __pyx_r;
  7914. }
  7915. /* "fontTools/misc/bezierTools.py":450
  7916. *
  7917. *
  7918. * def splitLine(pt1, pt2, where, isHorizontal): # <<<<<<<<<<<<<<
  7919. * """Split a line at a given coordinate.
  7920. *
  7921. */
  7922. /* Python wrapper */
  7923. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_25splitLine(PyObject *__pyx_self,
  7924. #if CYTHON_METH_FASTCALL
  7925. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  7926. #else
  7927. PyObject *__pyx_args, PyObject *__pyx_kwds
  7928. #endif
  7929. ); /*proto*/
  7930. 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))");
  7931. 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};
  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. ) {
  7939. PyObject *__pyx_v_pt1 = 0;
  7940. PyObject *__pyx_v_pt2 = 0;
  7941. PyObject *__pyx_v_where = 0;
  7942. PyObject *__pyx_v_isHorizontal = 0;
  7943. #if !CYTHON_METH_FASTCALL
  7944. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  7945. #endif
  7946. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  7947. PyObject* values[4] = {0,0,0,0};
  7948. int __pyx_lineno = 0;
  7949. const char *__pyx_filename = NULL;
  7950. int __pyx_clineno = 0;
  7951. PyObject *__pyx_r = 0;
  7952. __Pyx_RefNannyDeclarations
  7953. __Pyx_RefNannySetupContext("splitLine (wrapper)", 0);
  7954. #if !CYTHON_METH_FASTCALL
  7955. #if CYTHON_ASSUME_SAFE_SIZE
  7956. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  7957. #else
  7958. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  7959. #endif
  7960. #endif
  7961. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  7962. {
  7963. 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};
  7964. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  7965. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 450, __pyx_L3_error)
  7966. if (__pyx_kwds_len > 0) {
  7967. switch (__pyx_nargs) {
  7968. case 4:
  7969. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  7970. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 450, __pyx_L3_error)
  7971. CYTHON_FALLTHROUGH;
  7972. case 3:
  7973. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  7974. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 450, __pyx_L3_error)
  7975. CYTHON_FALLTHROUGH;
  7976. case 2:
  7977. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  7978. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 450, __pyx_L3_error)
  7979. CYTHON_FALLTHROUGH;
  7980. case 1:
  7981. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  7982. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 450, __pyx_L3_error)
  7983. CYTHON_FALLTHROUGH;
  7984. case 0: break;
  7985. default: goto __pyx_L5_argtuple_error;
  7986. }
  7987. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  7988. 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)
  7989. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  7990. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("splitLine", 1, 4, 4, i); __PYX_ERR(0, 450, __pyx_L3_error) }
  7991. }
  7992. } else if (unlikely(__pyx_nargs != 4)) {
  7993. goto __pyx_L5_argtuple_error;
  7994. } else {
  7995. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  7996. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 450, __pyx_L3_error)
  7997. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  7998. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 450, __pyx_L3_error)
  7999. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  8000. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 450, __pyx_L3_error)
  8001. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  8002. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 450, __pyx_L3_error)
  8003. }
  8004. __pyx_v_pt1 = values[0];
  8005. __pyx_v_pt2 = values[1];
  8006. __pyx_v_where = values[2];
  8007. __pyx_v_isHorizontal = values[3];
  8008. }
  8009. goto __pyx_L6_skip;
  8010. __pyx_L5_argtuple_error:;
  8011. __Pyx_RaiseArgtupleInvalid("splitLine", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 450, __pyx_L3_error)
  8012. __pyx_L6_skip:;
  8013. goto __pyx_L4_argument_unpacking_done;
  8014. __pyx_L3_error:;
  8015. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  8016. Py_XDECREF(values[__pyx_temp]);
  8017. }
  8018. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitLine", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8019. __Pyx_RefNannyFinishContext();
  8020. return NULL;
  8021. __pyx_L4_argument_unpacking_done:;
  8022. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_24splitLine(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_where, __pyx_v_isHorizontal);
  8023. /* function exit code */
  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_RefNannyFinishContext();
  8028. return __pyx_r;
  8029. }
  8030. 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) {
  8031. PyObject *__pyx_v_pt1x = NULL;
  8032. PyObject *__pyx_v_pt1y = NULL;
  8033. PyObject *__pyx_v_pt2x = NULL;
  8034. PyObject *__pyx_v_pt2y = NULL;
  8035. PyObject *__pyx_v_ax = NULL;
  8036. PyObject *__pyx_v_ay = NULL;
  8037. PyObject *__pyx_v_bx = NULL;
  8038. PyObject *__pyx_v_by = NULL;
  8039. PyObject *__pyx_v_a = NULL;
  8040. PyObject *__pyx_v_t = NULL;
  8041. PyObject *__pyx_v_midPt = NULL;
  8042. PyObject *__pyx_r = NULL;
  8043. __Pyx_RefNannyDeclarations
  8044. PyObject *__pyx_t_1 = NULL;
  8045. PyObject *__pyx_t_2 = NULL;
  8046. PyObject *__pyx_t_3 = NULL;
  8047. PyObject *(*__pyx_t_4)(PyObject *);
  8048. int __pyx_t_5;
  8049. int __pyx_lineno = 0;
  8050. const char *__pyx_filename = NULL;
  8051. int __pyx_clineno = 0;
  8052. __Pyx_RefNannySetupContext("splitLine", 0);
  8053. /* "fontTools/misc/bezierTools.py":486
  8054. * ((0, 50), (0, 0))
  8055. * """
  8056. * pt1x, pt1y = pt1 # <<<<<<<<<<<<<<
  8057. * pt2x, pt2y = pt2
  8058. *
  8059. */
  8060. if ((likely(PyTuple_CheckExact(__pyx_v_pt1))) || (PyList_CheckExact(__pyx_v_pt1))) {
  8061. PyObject* sequence = __pyx_v_pt1;
  8062. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  8063. if (unlikely(size != 2)) {
  8064. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  8065. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  8066. __PYX_ERR(0, 486, __pyx_L1_error)
  8067. }
  8068. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  8069. if (likely(PyTuple_CheckExact(sequence))) {
  8070. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  8071. __Pyx_INCREF(__pyx_t_1);
  8072. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  8073. __Pyx_INCREF(__pyx_t_2);
  8074. } else {
  8075. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  8076. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error)
  8077. __Pyx_XGOTREF(__pyx_t_1);
  8078. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  8079. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 486, __pyx_L1_error)
  8080. __Pyx_XGOTREF(__pyx_t_2);
  8081. }
  8082. #else
  8083. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error)
  8084. __Pyx_GOTREF(__pyx_t_1);
  8085. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 486, __pyx_L1_error)
  8086. __Pyx_GOTREF(__pyx_t_2);
  8087. #endif
  8088. } else {
  8089. Py_ssize_t index = -1;
  8090. __pyx_t_3 = PyObject_GetIter(__pyx_v_pt1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 486, __pyx_L1_error)
  8091. __Pyx_GOTREF(__pyx_t_3);
  8092. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  8093. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
  8094. __Pyx_GOTREF(__pyx_t_1);
  8095. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  8096. __Pyx_GOTREF(__pyx_t_2);
  8097. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 486, __pyx_L1_error)
  8098. __pyx_t_4 = NULL;
  8099. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8100. goto __pyx_L4_unpacking_done;
  8101. __pyx_L3_unpacking_failed:;
  8102. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8103. __pyx_t_4 = NULL;
  8104. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  8105. __PYX_ERR(0, 486, __pyx_L1_error)
  8106. __pyx_L4_unpacking_done:;
  8107. }
  8108. __pyx_v_pt1x = __pyx_t_1;
  8109. __pyx_t_1 = 0;
  8110. __pyx_v_pt1y = __pyx_t_2;
  8111. __pyx_t_2 = 0;
  8112. /* "fontTools/misc/bezierTools.py":487
  8113. * """
  8114. * pt1x, pt1y = pt1
  8115. * pt2x, pt2y = pt2 # <<<<<<<<<<<<<<
  8116. *
  8117. * ax = pt2x - pt1x
  8118. */
  8119. if ((likely(PyTuple_CheckExact(__pyx_v_pt2))) || (PyList_CheckExact(__pyx_v_pt2))) {
  8120. PyObject* sequence = __pyx_v_pt2;
  8121. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  8122. if (unlikely(size != 2)) {
  8123. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  8124. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  8125. __PYX_ERR(0, 487, __pyx_L1_error)
  8126. }
  8127. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  8128. if (likely(PyTuple_CheckExact(sequence))) {
  8129. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  8130. __Pyx_INCREF(__pyx_t_2);
  8131. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  8132. __Pyx_INCREF(__pyx_t_1);
  8133. } else {
  8134. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  8135. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 487, __pyx_L1_error)
  8136. __Pyx_XGOTREF(__pyx_t_2);
  8137. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  8138. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 487, __pyx_L1_error)
  8139. __Pyx_XGOTREF(__pyx_t_1);
  8140. }
  8141. #else
  8142. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 487, __pyx_L1_error)
  8143. __Pyx_GOTREF(__pyx_t_2);
  8144. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 487, __pyx_L1_error)
  8145. __Pyx_GOTREF(__pyx_t_1);
  8146. #endif
  8147. } else {
  8148. Py_ssize_t index = -1;
  8149. __pyx_t_3 = PyObject_GetIter(__pyx_v_pt2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 487, __pyx_L1_error)
  8150. __Pyx_GOTREF(__pyx_t_3);
  8151. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  8152. index = 0; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
  8153. __Pyx_GOTREF(__pyx_t_2);
  8154. index = 1; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
  8155. __Pyx_GOTREF(__pyx_t_1);
  8156. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 487, __pyx_L1_error)
  8157. __pyx_t_4 = NULL;
  8158. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8159. goto __pyx_L6_unpacking_done;
  8160. __pyx_L5_unpacking_failed:;
  8161. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8162. __pyx_t_4 = NULL;
  8163. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  8164. __PYX_ERR(0, 487, __pyx_L1_error)
  8165. __pyx_L6_unpacking_done:;
  8166. }
  8167. __pyx_v_pt2x = __pyx_t_2;
  8168. __pyx_t_2 = 0;
  8169. __pyx_v_pt2y = __pyx_t_1;
  8170. __pyx_t_1 = 0;
  8171. /* "fontTools/misc/bezierTools.py":489
  8172. * pt2x, pt2y = pt2
  8173. *
  8174. * ax = pt2x - pt1x # <<<<<<<<<<<<<<
  8175. * ay = pt2y - pt1y
  8176. *
  8177. */
  8178. __pyx_t_1 = PyNumber_Subtract(__pyx_v_pt2x, __pyx_v_pt1x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __pyx_L1_error)
  8179. __Pyx_GOTREF(__pyx_t_1);
  8180. __pyx_v_ax = __pyx_t_1;
  8181. __pyx_t_1 = 0;
  8182. /* "fontTools/misc/bezierTools.py":490
  8183. *
  8184. * ax = pt2x - pt1x
  8185. * ay = pt2y - pt1y # <<<<<<<<<<<<<<
  8186. *
  8187. * bx = pt1x
  8188. */
  8189. __pyx_t_1 = PyNumber_Subtract(__pyx_v_pt2y, __pyx_v_pt1y); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error)
  8190. __Pyx_GOTREF(__pyx_t_1);
  8191. __pyx_v_ay = __pyx_t_1;
  8192. __pyx_t_1 = 0;
  8193. /* "fontTools/misc/bezierTools.py":492
  8194. * ay = pt2y - pt1y
  8195. *
  8196. * bx = pt1x # <<<<<<<<<<<<<<
  8197. * by = pt1y
  8198. *
  8199. */
  8200. __Pyx_INCREF(__pyx_v_pt1x);
  8201. __pyx_v_bx = __pyx_v_pt1x;
  8202. /* "fontTools/misc/bezierTools.py":493
  8203. *
  8204. * bx = pt1x
  8205. * by = pt1y # <<<<<<<<<<<<<<
  8206. *
  8207. * a = (ax, ay)[isHorizontal]
  8208. */
  8209. __Pyx_INCREF(__pyx_v_pt1y);
  8210. __pyx_v_by = __pyx_v_pt1y;
  8211. /* "fontTools/misc/bezierTools.py":495
  8212. * by = pt1y
  8213. *
  8214. * a = (ax, ay)[isHorizontal] # <<<<<<<<<<<<<<
  8215. *
  8216. * if a == 0:
  8217. */
  8218. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L1_error)
  8219. __Pyx_GOTREF(__pyx_t_1);
  8220. __Pyx_INCREF(__pyx_v_ax);
  8221. __Pyx_GIVEREF(__pyx_v_ax);
  8222. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_ax) != (0)) __PYX_ERR(0, 495, __pyx_L1_error);
  8223. __Pyx_INCREF(__pyx_v_ay);
  8224. __Pyx_GIVEREF(__pyx_v_ay);
  8225. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_ay) != (0)) __PYX_ERR(0, 495, __pyx_L1_error);
  8226. __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_isHorizontal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 495, __pyx_L1_error)
  8227. __Pyx_GOTREF(__pyx_t_2);
  8228. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8229. __pyx_v_a = __pyx_t_2;
  8230. __pyx_t_2 = 0;
  8231. /* "fontTools/misc/bezierTools.py":497
  8232. * a = (ax, ay)[isHorizontal]
  8233. *
  8234. * if a == 0: # <<<<<<<<<<<<<<
  8235. * return [(pt1, pt2)]
  8236. * t = (where - (bx, by)[isHorizontal]) / a
  8237. */
  8238. __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)
  8239. if (__pyx_t_5) {
  8240. /* "fontTools/misc/bezierTools.py":498
  8241. *
  8242. * if a == 0:
  8243. * return [(pt1, pt2)] # <<<<<<<<<<<<<<
  8244. * t = (where - (bx, by)[isHorizontal]) / a
  8245. * if 0 <= t < 1:
  8246. */
  8247. __Pyx_XDECREF(__pyx_r);
  8248. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 498, __pyx_L1_error)
  8249. __Pyx_GOTREF(__pyx_t_2);
  8250. __Pyx_INCREF(__pyx_v_pt1);
  8251. __Pyx_GIVEREF(__pyx_v_pt1);
  8252. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pt1) != (0)) __PYX_ERR(0, 498, __pyx_L1_error);
  8253. __Pyx_INCREF(__pyx_v_pt2);
  8254. __Pyx_GIVEREF(__pyx_v_pt2);
  8255. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_pt2) != (0)) __PYX_ERR(0, 498, __pyx_L1_error);
  8256. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 498, __pyx_L1_error)
  8257. __Pyx_GOTREF(__pyx_t_1);
  8258. __Pyx_GIVEREF(__pyx_t_2);
  8259. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 498, __pyx_L1_error);
  8260. __pyx_t_2 = 0;
  8261. __pyx_r = __pyx_t_1;
  8262. __pyx_t_1 = 0;
  8263. goto __pyx_L0;
  8264. /* "fontTools/misc/bezierTools.py":497
  8265. * a = (ax, ay)[isHorizontal]
  8266. *
  8267. * if a == 0: # <<<<<<<<<<<<<<
  8268. * return [(pt1, pt2)]
  8269. * t = (where - (bx, by)[isHorizontal]) / a
  8270. */
  8271. }
  8272. /* "fontTools/misc/bezierTools.py":499
  8273. * if a == 0:
  8274. * return [(pt1, pt2)]
  8275. * t = (where - (bx, by)[isHorizontal]) / a # <<<<<<<<<<<<<<
  8276. * if 0 <= t < 1:
  8277. * midPt = ax * t + bx, ay * t + by
  8278. */
  8279. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 499, __pyx_L1_error)
  8280. __Pyx_GOTREF(__pyx_t_1);
  8281. __Pyx_INCREF(__pyx_v_bx);
  8282. __Pyx_GIVEREF(__pyx_v_bx);
  8283. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_bx) != (0)) __PYX_ERR(0, 499, __pyx_L1_error);
  8284. __Pyx_INCREF(__pyx_v_by);
  8285. __Pyx_GIVEREF(__pyx_v_by);
  8286. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_by) != (0)) __PYX_ERR(0, 499, __pyx_L1_error);
  8287. __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_isHorizontal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 499, __pyx_L1_error)
  8288. __Pyx_GOTREF(__pyx_t_2);
  8289. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8290. __pyx_t_1 = PyNumber_Subtract(__pyx_v_where, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 499, __pyx_L1_error)
  8291. __Pyx_GOTREF(__pyx_t_1);
  8292. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8293. __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_a); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 499, __pyx_L1_error)
  8294. __Pyx_GOTREF(__pyx_t_2);
  8295. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8296. __pyx_v_t = __pyx_t_2;
  8297. __pyx_t_2 = 0;
  8298. /* "fontTools/misc/bezierTools.py":500
  8299. * return [(pt1, pt2)]
  8300. * t = (where - (bx, by)[isHorizontal]) / a
  8301. * if 0 <= t < 1: # <<<<<<<<<<<<<<
  8302. * midPt = ax * t + bx, ay * t + by
  8303. * return [(pt1, midPt), (midPt, pt2)]
  8304. */
  8305. __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)
  8306. if (__Pyx_PyObject_IsTrue(__pyx_t_2)) {
  8307. __Pyx_DECREF(__pyx_t_2);
  8308. __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)
  8309. }
  8310. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 500, __pyx_L1_error)
  8311. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8312. if (__pyx_t_5) {
  8313. /* "fontTools/misc/bezierTools.py":501
  8314. * t = (where - (bx, by)[isHorizontal]) / a
  8315. * if 0 <= t < 1:
  8316. * midPt = ax * t + bx, ay * t + by # <<<<<<<<<<<<<<
  8317. * return [(pt1, midPt), (midPt, pt2)]
  8318. * else:
  8319. */
  8320. __pyx_t_2 = PyNumber_Multiply(__pyx_v_ax, __pyx_v_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 501, __pyx_L1_error)
  8321. __Pyx_GOTREF(__pyx_t_2);
  8322. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_bx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 501, __pyx_L1_error)
  8323. __Pyx_GOTREF(__pyx_t_1);
  8324. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8325. __pyx_t_2 = PyNumber_Multiply(__pyx_v_ay, __pyx_v_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 501, __pyx_L1_error)
  8326. __Pyx_GOTREF(__pyx_t_2);
  8327. __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_by); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 501, __pyx_L1_error)
  8328. __Pyx_GOTREF(__pyx_t_3);
  8329. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8330. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 501, __pyx_L1_error)
  8331. __Pyx_GOTREF(__pyx_t_2);
  8332. __Pyx_GIVEREF(__pyx_t_1);
  8333. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 501, __pyx_L1_error);
  8334. __Pyx_GIVEREF(__pyx_t_3);
  8335. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 501, __pyx_L1_error);
  8336. __pyx_t_1 = 0;
  8337. __pyx_t_3 = 0;
  8338. __pyx_v_midPt = ((PyObject*)__pyx_t_2);
  8339. __pyx_t_2 = 0;
  8340. /* "fontTools/misc/bezierTools.py":502
  8341. * if 0 <= t < 1:
  8342. * midPt = ax * t + bx, ay * t + by
  8343. * return [(pt1, midPt), (midPt, pt2)] # <<<<<<<<<<<<<<
  8344. * else:
  8345. * return [(pt1, pt2)]
  8346. */
  8347. __Pyx_XDECREF(__pyx_r);
  8348. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 502, __pyx_L1_error)
  8349. __Pyx_GOTREF(__pyx_t_2);
  8350. __Pyx_INCREF(__pyx_v_pt1);
  8351. __Pyx_GIVEREF(__pyx_v_pt1);
  8352. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pt1) != (0)) __PYX_ERR(0, 502, __pyx_L1_error);
  8353. __Pyx_INCREF(__pyx_v_midPt);
  8354. __Pyx_GIVEREF(__pyx_v_midPt);
  8355. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_midPt) != (0)) __PYX_ERR(0, 502, __pyx_L1_error);
  8356. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 502, __pyx_L1_error)
  8357. __Pyx_GOTREF(__pyx_t_3);
  8358. __Pyx_INCREF(__pyx_v_midPt);
  8359. __Pyx_GIVEREF(__pyx_v_midPt);
  8360. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_midPt) != (0)) __PYX_ERR(0, 502, __pyx_L1_error);
  8361. __Pyx_INCREF(__pyx_v_pt2);
  8362. __Pyx_GIVEREF(__pyx_v_pt2);
  8363. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_pt2) != (0)) __PYX_ERR(0, 502, __pyx_L1_error);
  8364. __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 502, __pyx_L1_error)
  8365. __Pyx_GOTREF(__pyx_t_1);
  8366. __Pyx_GIVEREF(__pyx_t_2);
  8367. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 502, __pyx_L1_error);
  8368. __Pyx_GIVEREF(__pyx_t_3);
  8369. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 502, __pyx_L1_error);
  8370. __pyx_t_2 = 0;
  8371. __pyx_t_3 = 0;
  8372. __pyx_r = __pyx_t_1;
  8373. __pyx_t_1 = 0;
  8374. goto __pyx_L0;
  8375. /* "fontTools/misc/bezierTools.py":500
  8376. * return [(pt1, pt2)]
  8377. * t = (where - (bx, by)[isHorizontal]) / a
  8378. * if 0 <= t < 1: # <<<<<<<<<<<<<<
  8379. * midPt = ax * t + bx, ay * t + by
  8380. * return [(pt1, midPt), (midPt, pt2)]
  8381. */
  8382. }
  8383. /* "fontTools/misc/bezierTools.py":504
  8384. * return [(pt1, midPt), (midPt, pt2)]
  8385. * else:
  8386. * return [(pt1, pt2)] # <<<<<<<<<<<<<<
  8387. *
  8388. *
  8389. */
  8390. /*else*/ {
  8391. __Pyx_XDECREF(__pyx_r);
  8392. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 504, __pyx_L1_error)
  8393. __Pyx_GOTREF(__pyx_t_1);
  8394. __Pyx_INCREF(__pyx_v_pt1);
  8395. __Pyx_GIVEREF(__pyx_v_pt1);
  8396. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pt1) != (0)) __PYX_ERR(0, 504, __pyx_L1_error);
  8397. __Pyx_INCREF(__pyx_v_pt2);
  8398. __Pyx_GIVEREF(__pyx_v_pt2);
  8399. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_pt2) != (0)) __PYX_ERR(0, 504, __pyx_L1_error);
  8400. __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 504, __pyx_L1_error)
  8401. __Pyx_GOTREF(__pyx_t_3);
  8402. __Pyx_GIVEREF(__pyx_t_1);
  8403. if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 504, __pyx_L1_error);
  8404. __pyx_t_1 = 0;
  8405. __pyx_r = __pyx_t_3;
  8406. __pyx_t_3 = 0;
  8407. goto __pyx_L0;
  8408. }
  8409. /* "fontTools/misc/bezierTools.py":450
  8410. *
  8411. *
  8412. * def splitLine(pt1, pt2, where, isHorizontal): # <<<<<<<<<<<<<<
  8413. * """Split a line at a given coordinate.
  8414. *
  8415. */
  8416. /* function exit code */
  8417. __pyx_L1_error:;
  8418. __Pyx_XDECREF(__pyx_t_1);
  8419. __Pyx_XDECREF(__pyx_t_2);
  8420. __Pyx_XDECREF(__pyx_t_3);
  8421. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitLine", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8422. __pyx_r = NULL;
  8423. __pyx_L0:;
  8424. __Pyx_XDECREF(__pyx_v_pt1x);
  8425. __Pyx_XDECREF(__pyx_v_pt1y);
  8426. __Pyx_XDECREF(__pyx_v_pt2x);
  8427. __Pyx_XDECREF(__pyx_v_pt2y);
  8428. __Pyx_XDECREF(__pyx_v_ax);
  8429. __Pyx_XDECREF(__pyx_v_ay);
  8430. __Pyx_XDECREF(__pyx_v_bx);
  8431. __Pyx_XDECREF(__pyx_v_by);
  8432. __Pyx_XDECREF(__pyx_v_a);
  8433. __Pyx_XDECREF(__pyx_v_t);
  8434. __Pyx_XDECREF(__pyx_v_midPt);
  8435. __Pyx_XGIVEREF(__pyx_r);
  8436. __Pyx_RefNannyFinishContext();
  8437. return __pyx_r;
  8438. }
  8439. /* "fontTools/misc/bezierTools.py":507
  8440. *
  8441. *
  8442. * def splitQuadratic(pt1, pt2, pt3, where, isHorizontal): # <<<<<<<<<<<<<<
  8443. * """Split a quadratic Bezier curve at a given coordinate.
  8444. *
  8445. */
  8446. /* Python wrapper */
  8447. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_27splitQuadratic(PyObject *__pyx_self,
  8448. #if CYTHON_METH_FASTCALL
  8449. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  8450. #else
  8451. PyObject *__pyx_args, PyObject *__pyx_kwds
  8452. #endif
  8453. ); /*proto*/
  8454. 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))");
  8455. 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};
  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. ) {
  8463. PyObject *__pyx_v_pt1 = 0;
  8464. PyObject *__pyx_v_pt2 = 0;
  8465. PyObject *__pyx_v_pt3 = 0;
  8466. PyObject *__pyx_v_where = 0;
  8467. PyObject *__pyx_v_isHorizontal = 0;
  8468. #if !CYTHON_METH_FASTCALL
  8469. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  8470. #endif
  8471. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  8472. PyObject* values[5] = {0,0,0,0,0};
  8473. int __pyx_lineno = 0;
  8474. const char *__pyx_filename = NULL;
  8475. int __pyx_clineno = 0;
  8476. PyObject *__pyx_r = 0;
  8477. __Pyx_RefNannyDeclarations
  8478. __Pyx_RefNannySetupContext("splitQuadratic (wrapper)", 0);
  8479. #if !CYTHON_METH_FASTCALL
  8480. #if CYTHON_ASSUME_SAFE_SIZE
  8481. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  8482. #else
  8483. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  8484. #endif
  8485. #endif
  8486. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  8487. {
  8488. 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};
  8489. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  8490. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 507, __pyx_L3_error)
  8491. if (__pyx_kwds_len > 0) {
  8492. switch (__pyx_nargs) {
  8493. case 5:
  8494. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  8495. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 507, __pyx_L3_error)
  8496. CYTHON_FALLTHROUGH;
  8497. case 4:
  8498. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  8499. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 507, __pyx_L3_error)
  8500. CYTHON_FALLTHROUGH;
  8501. case 3:
  8502. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  8503. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 507, __pyx_L3_error)
  8504. CYTHON_FALLTHROUGH;
  8505. case 2:
  8506. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  8507. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 507, __pyx_L3_error)
  8508. CYTHON_FALLTHROUGH;
  8509. case 1:
  8510. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  8511. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 507, __pyx_L3_error)
  8512. CYTHON_FALLTHROUGH;
  8513. case 0: break;
  8514. default: goto __pyx_L5_argtuple_error;
  8515. }
  8516. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  8517. 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)
  8518. for (Py_ssize_t i = __pyx_nargs; i < 5; i++) {
  8519. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("splitQuadratic", 1, 5, 5, i); __PYX_ERR(0, 507, __pyx_L3_error) }
  8520. }
  8521. } else if (unlikely(__pyx_nargs != 5)) {
  8522. goto __pyx_L5_argtuple_error;
  8523. } else {
  8524. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  8525. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 507, __pyx_L3_error)
  8526. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  8527. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 507, __pyx_L3_error)
  8528. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  8529. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 507, __pyx_L3_error)
  8530. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  8531. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 507, __pyx_L3_error)
  8532. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  8533. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 507, __pyx_L3_error)
  8534. }
  8535. __pyx_v_pt1 = values[0];
  8536. __pyx_v_pt2 = values[1];
  8537. __pyx_v_pt3 = values[2];
  8538. __pyx_v_where = values[3];
  8539. __pyx_v_isHorizontal = values[4];
  8540. }
  8541. goto __pyx_L6_skip;
  8542. __pyx_L5_argtuple_error:;
  8543. __Pyx_RaiseArgtupleInvalid("splitQuadratic", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 507, __pyx_L3_error)
  8544. __pyx_L6_skip:;
  8545. goto __pyx_L4_argument_unpacking_done;
  8546. __pyx_L3_error:;
  8547. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  8548. Py_XDECREF(values[__pyx_temp]);
  8549. }
  8550. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitQuadratic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8551. __Pyx_RefNannyFinishContext();
  8552. return NULL;
  8553. __pyx_L4_argument_unpacking_done:;
  8554. __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);
  8555. /* function exit code */
  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_RefNannyFinishContext();
  8560. return __pyx_r;
  8561. }
  8562. static PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_14splitQuadratic_2generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
  8563. /* "fontTools/misc/bezierTools.py":546
  8564. * a[isHorizontal], b[isHorizontal], c[isHorizontal] - where
  8565. * )
  8566. * solutions = sorted(t for t in solutions if 0 <= t < 1) # <<<<<<<<<<<<<<
  8567. * if not solutions:
  8568. * return [(pt1, pt2, pt3)]
  8569. */
  8570. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_14splitQuadratic_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  8571. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr *__pyx_cur_scope;
  8572. PyObject *__pyx_r = NULL;
  8573. __Pyx_RefNannyDeclarations
  8574. int __pyx_lineno = 0;
  8575. const char *__pyx_filename = NULL;
  8576. int __pyx_clineno = 0;
  8577. __Pyx_RefNannySetupContext("genexpr", 0);
  8578. __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);
  8579. if (unlikely(!__pyx_cur_scope)) {
  8580. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr *)Py_None);
  8581. __Pyx_INCREF(Py_None);
  8582. __PYX_ERR(0, 546, __pyx_L1_error)
  8583. } else {
  8584. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  8585. }
  8586. __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  8587. __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  8588. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  8589. {
  8590. __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)
  8591. __Pyx_DECREF(__pyx_cur_scope);
  8592. __Pyx_RefNannyFinishContext();
  8593. return (PyObject *) gen;
  8594. }
  8595. /* function exit code */
  8596. __pyx_L1_error:;
  8597. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitQuadratic.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8598. __pyx_r = NULL;
  8599. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  8600. __Pyx_XGIVEREF(__pyx_r);
  8601. __Pyx_RefNannyFinishContext();
  8602. return __pyx_r;
  8603. }
  8604. static PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_14splitQuadratic_2generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
  8605. {
  8606. 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);
  8607. PyObject *__pyx_r = NULL;
  8608. PyObject *__pyx_t_1 = NULL;
  8609. Py_ssize_t __pyx_t_2;
  8610. PyObject *(*__pyx_t_3)(PyObject *);
  8611. PyObject *__pyx_t_4 = NULL;
  8612. int __pyx_t_5;
  8613. int __pyx_lineno = 0;
  8614. const char *__pyx_filename = NULL;
  8615. int __pyx_clineno = 0;
  8616. __Pyx_RefNannyDeclarations
  8617. __Pyx_RefNannySetupContext("genexpr", 0);
  8618. switch (__pyx_generator->resume_label) {
  8619. case 0: goto __pyx_L3_first_run;
  8620. default: /* CPython raises the right error here */
  8621. __Pyx_RefNannyFinishContext();
  8622. return NULL;
  8623. }
  8624. __pyx_L3_first_run:;
  8625. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 546, __pyx_L1_error)
  8626. __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 546, __pyx_L1_error)
  8627. __Pyx_GOTREF(__pyx_r);
  8628. if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 546, __pyx_L1_error) }
  8629. if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
  8630. __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
  8631. __pyx_t_2 = 0;
  8632. __pyx_t_3 = NULL;
  8633. } else {
  8634. __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)
  8635. __Pyx_GOTREF(__pyx_t_1);
  8636. __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)
  8637. }
  8638. for (;;) {
  8639. if (likely(!__pyx_t_3)) {
  8640. if (likely(PyList_CheckExact(__pyx_t_1))) {
  8641. {
  8642. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  8643. #if !CYTHON_ASSUME_SAFE_SIZE
  8644. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 546, __pyx_L1_error)
  8645. #endif
  8646. if (__pyx_t_2 >= __pyx_temp) break;
  8647. }
  8648. __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
  8649. ++__pyx_t_2;
  8650. } else {
  8651. {
  8652. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  8653. #if !CYTHON_ASSUME_SAFE_SIZE
  8654. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 546, __pyx_L1_error)
  8655. #endif
  8656. if (__pyx_t_2 >= __pyx_temp) break;
  8657. }
  8658. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  8659. __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
  8660. #else
  8661. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
  8662. #endif
  8663. ++__pyx_t_2;
  8664. }
  8665. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 546, __pyx_L1_error)
  8666. } else {
  8667. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  8668. if (unlikely(!__pyx_t_4)) {
  8669. PyObject* exc_type = PyErr_Occurred();
  8670. if (exc_type) {
  8671. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 546, __pyx_L1_error)
  8672. PyErr_Clear();
  8673. }
  8674. break;
  8675. }
  8676. }
  8677. __Pyx_GOTREF(__pyx_t_4);
  8678. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_t);
  8679. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_t, __pyx_t_4);
  8680. __Pyx_GIVEREF(__pyx_t_4);
  8681. __pyx_t_4 = 0;
  8682. __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)
  8683. if (__Pyx_PyObject_IsTrue(__pyx_t_4)) {
  8684. __Pyx_DECREF(__pyx_t_4);
  8685. __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)
  8686. }
  8687. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 546, __pyx_L1_error)
  8688. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  8689. if (__pyx_t_5) {
  8690. if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_cur_scope->__pyx_v_t))) __PYX_ERR(0, 546, __pyx_L1_error)
  8691. }
  8692. }
  8693. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8694. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  8695. /* function exit code */
  8696. goto __pyx_L0;
  8697. __pyx_L1_error:;
  8698. __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  8699. __Pyx_XDECREF(__pyx_t_1);
  8700. __Pyx_XDECREF(__pyx_t_4);
  8701. if (__Pyx_PyErr_Occurred()) {
  8702. __Pyx_Generator_Replace_StopIteration(0);
  8703. __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8704. }
  8705. __pyx_L0:;
  8706. __Pyx_XGIVEREF(__pyx_r);
  8707. #if !CYTHON_USE_EXC_INFO_STACK
  8708. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  8709. #endif
  8710. __pyx_generator->resume_label = -1;
  8711. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  8712. __Pyx_RefNannyFinishContext();
  8713. return __pyx_r;
  8714. }
  8715. /* "fontTools/misc/bezierTools.py":507
  8716. *
  8717. *
  8718. * def splitQuadratic(pt1, pt2, pt3, where, isHorizontal): # <<<<<<<<<<<<<<
  8719. * """Split a quadratic Bezier curve at a given coordinate.
  8720. *
  8721. */
  8722. 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) {
  8723. PyObject *__pyx_v_a = NULL;
  8724. PyObject *__pyx_v_b = NULL;
  8725. PyObject *__pyx_v_c = NULL;
  8726. PyObject *__pyx_v_solutions = NULL;
  8727. PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_14splitQuadratic_2generator2 = 0;
  8728. PyObject *__pyx_r = NULL;
  8729. __Pyx_RefNannyDeclarations
  8730. PyObject *__pyx_t_1 = NULL;
  8731. PyObject *__pyx_t_2 = NULL;
  8732. PyObject *__pyx_t_3 = NULL;
  8733. size_t __pyx_t_4;
  8734. PyObject *__pyx_t_5 = NULL;
  8735. PyObject *__pyx_t_6 = NULL;
  8736. PyObject *(*__pyx_t_7)(PyObject *);
  8737. PyObject *__pyx_t_8 = NULL;
  8738. PyObject *__pyx_t_9 = NULL;
  8739. int __pyx_t_10;
  8740. int __pyx_t_11;
  8741. int __pyx_lineno = 0;
  8742. const char *__pyx_filename = NULL;
  8743. int __pyx_clineno = 0;
  8744. __Pyx_RefNannySetupContext("splitQuadratic", 0);
  8745. /* "fontTools/misc/bezierTools.py":542
  8746. * ((50, 50), (75, 50), (100, 0))
  8747. * """
  8748. * a, b, c = calcQuadraticParameters(pt1, pt2, pt3) # <<<<<<<<<<<<<<
  8749. * solutions = solveQuadratic(
  8750. * a[isHorizontal], b[isHorizontal], c[isHorizontal] - where
  8751. */
  8752. __pyx_t_2 = NULL;
  8753. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_calcQuadraticParameters); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 542, __pyx_L1_error)
  8754. __Pyx_GOTREF(__pyx_t_3);
  8755. __pyx_t_4 = 1;
  8756. #if CYTHON_UNPACK_METHODS
  8757. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  8758. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  8759. assert(__pyx_t_2);
  8760. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  8761. __Pyx_INCREF(__pyx_t_2);
  8762. __Pyx_INCREF(__pyx__function);
  8763. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  8764. __pyx_t_4 = 0;
  8765. }
  8766. #endif
  8767. {
  8768. PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3};
  8769. __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));
  8770. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  8771. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8772. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 542, __pyx_L1_error)
  8773. __Pyx_GOTREF(__pyx_t_1);
  8774. }
  8775. if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
  8776. PyObject* sequence = __pyx_t_1;
  8777. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  8778. if (unlikely(size != 3)) {
  8779. if (size > 3) __Pyx_RaiseTooManyValuesError(3);
  8780. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  8781. __PYX_ERR(0, 542, __pyx_L1_error)
  8782. }
  8783. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  8784. if (likely(PyTuple_CheckExact(sequence))) {
  8785. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  8786. __Pyx_INCREF(__pyx_t_3);
  8787. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  8788. __Pyx_INCREF(__pyx_t_2);
  8789. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2);
  8790. __Pyx_INCREF(__pyx_t_5);
  8791. } else {
  8792. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  8793. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 542, __pyx_L1_error)
  8794. __Pyx_XGOTREF(__pyx_t_3);
  8795. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  8796. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 542, __pyx_L1_error)
  8797. __Pyx_XGOTREF(__pyx_t_2);
  8798. __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  8799. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 542, __pyx_L1_error)
  8800. __Pyx_XGOTREF(__pyx_t_5);
  8801. }
  8802. #else
  8803. __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 542, __pyx_L1_error)
  8804. __Pyx_GOTREF(__pyx_t_3);
  8805. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 542, __pyx_L1_error)
  8806. __Pyx_GOTREF(__pyx_t_2);
  8807. __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 542, __pyx_L1_error)
  8808. __Pyx_GOTREF(__pyx_t_5);
  8809. #endif
  8810. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8811. } else {
  8812. Py_ssize_t index = -1;
  8813. __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 542, __pyx_L1_error)
  8814. __Pyx_GOTREF(__pyx_t_6);
  8815. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8816. __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6);
  8817. index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
  8818. __Pyx_GOTREF(__pyx_t_3);
  8819. index = 1; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  8820. __Pyx_GOTREF(__pyx_t_2);
  8821. index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
  8822. __Pyx_GOTREF(__pyx_t_5);
  8823. if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < (0)) __PYX_ERR(0, 542, __pyx_L1_error)
  8824. __pyx_t_7 = NULL;
  8825. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  8826. goto __pyx_L4_unpacking_done;
  8827. __pyx_L3_unpacking_failed:;
  8828. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  8829. __pyx_t_7 = NULL;
  8830. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  8831. __PYX_ERR(0, 542, __pyx_L1_error)
  8832. __pyx_L4_unpacking_done:;
  8833. }
  8834. __pyx_v_a = __pyx_t_3;
  8835. __pyx_t_3 = 0;
  8836. __pyx_v_b = __pyx_t_2;
  8837. __pyx_t_2 = 0;
  8838. __pyx_v_c = __pyx_t_5;
  8839. __pyx_t_5 = 0;
  8840. /* "fontTools/misc/bezierTools.py":543
  8841. * """
  8842. * a, b, c = calcQuadraticParameters(pt1, pt2, pt3)
  8843. * solutions = solveQuadratic( # <<<<<<<<<<<<<<
  8844. * a[isHorizontal], b[isHorizontal], c[isHorizontal] - where
  8845. * )
  8846. */
  8847. __pyx_t_5 = NULL;
  8848. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_solveQuadratic); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 543, __pyx_L1_error)
  8849. __Pyx_GOTREF(__pyx_t_2);
  8850. /* "fontTools/misc/bezierTools.py":544
  8851. * a, b, c = calcQuadraticParameters(pt1, pt2, pt3)
  8852. * solutions = solveQuadratic(
  8853. * a[isHorizontal], b[isHorizontal], c[isHorizontal] - where # <<<<<<<<<<<<<<
  8854. * )
  8855. * solutions = sorted(t for t in solutions if 0 <= t < 1)
  8856. */
  8857. __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_a, __pyx_v_isHorizontal); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 544, __pyx_L1_error)
  8858. __Pyx_GOTREF(__pyx_t_3);
  8859. __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_b, __pyx_v_isHorizontal); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 544, __pyx_L1_error)
  8860. __Pyx_GOTREF(__pyx_t_6);
  8861. __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_v_c, __pyx_v_isHorizontal); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 544, __pyx_L1_error)
  8862. __Pyx_GOTREF(__pyx_t_8);
  8863. __pyx_t_9 = PyNumber_Subtract(__pyx_t_8, __pyx_v_where); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 544, __pyx_L1_error)
  8864. __Pyx_GOTREF(__pyx_t_9);
  8865. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  8866. __pyx_t_4 = 1;
  8867. #if CYTHON_UNPACK_METHODS
  8868. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  8869. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
  8870. assert(__pyx_t_5);
  8871. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  8872. __Pyx_INCREF(__pyx_t_5);
  8873. __Pyx_INCREF(__pyx__function);
  8874. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  8875. __pyx_t_4 = 0;
  8876. }
  8877. #endif
  8878. {
  8879. PyObject *__pyx_callargs[4] = {__pyx_t_5, __pyx_t_3, __pyx_t_6, __pyx_t_9};
  8880. __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));
  8881. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  8882. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8883. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  8884. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  8885. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8886. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __pyx_L1_error)
  8887. __Pyx_GOTREF(__pyx_t_1);
  8888. }
  8889. __pyx_v_solutions = __pyx_t_1;
  8890. __pyx_t_1 = 0;
  8891. /* "fontTools/misc/bezierTools.py":546
  8892. * a[isHorizontal], b[isHorizontal], c[isHorizontal] - where
  8893. * )
  8894. * solutions = sorted(t for t in solutions if 0 <= t < 1) # <<<<<<<<<<<<<<
  8895. * if not solutions:
  8896. * return [(pt1, pt2, pt3)]
  8897. */
  8898. __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)
  8899. __Pyx_GOTREF(__pyx_t_1);
  8900. __pyx_t_2 = __Pyx_Generator_GetInlinedResult(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 546, __pyx_L1_error)
  8901. __Pyx_GOTREF(__pyx_t_2);
  8902. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8903. if (unlikely((PyList_Sort(__pyx_t_2) < 0))) __PYX_ERR(0, 546, __pyx_L1_error)
  8904. __Pyx_DECREF_SET(__pyx_v_solutions, __pyx_t_2);
  8905. __pyx_t_2 = 0;
  8906. /* "fontTools/misc/bezierTools.py":547
  8907. * )
  8908. * solutions = sorted(t for t in solutions if 0 <= t < 1)
  8909. * if not solutions: # <<<<<<<<<<<<<<
  8910. * return [(pt1, pt2, pt3)]
  8911. * return _splitQuadraticAtT(a, b, c, *solutions)
  8912. */
  8913. __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_solutions); if (unlikely((__pyx_t_10 < 0))) __PYX_ERR(0, 547, __pyx_L1_error)
  8914. __pyx_t_11 = (!__pyx_t_10);
  8915. if (__pyx_t_11) {
  8916. /* "fontTools/misc/bezierTools.py":548
  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. */
  8923. __Pyx_XDECREF(__pyx_r);
  8924. __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 548, __pyx_L1_error)
  8925. __Pyx_GOTREF(__pyx_t_2);
  8926. __Pyx_INCREF(__pyx_v_pt1);
  8927. __Pyx_GIVEREF(__pyx_v_pt1);
  8928. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pt1) != (0)) __PYX_ERR(0, 548, __pyx_L1_error);
  8929. __Pyx_INCREF(__pyx_v_pt2);
  8930. __Pyx_GIVEREF(__pyx_v_pt2);
  8931. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_pt2) != (0)) __PYX_ERR(0, 548, __pyx_L1_error);
  8932. __Pyx_INCREF(__pyx_v_pt3);
  8933. __Pyx_GIVEREF(__pyx_v_pt3);
  8934. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_pt3) != (0)) __PYX_ERR(0, 548, __pyx_L1_error);
  8935. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error)
  8936. __Pyx_GOTREF(__pyx_t_1);
  8937. __Pyx_GIVEREF(__pyx_t_2);
  8938. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 548, __pyx_L1_error);
  8939. __pyx_t_2 = 0;
  8940. __pyx_r = __pyx_t_1;
  8941. __pyx_t_1 = 0;
  8942. goto __pyx_L0;
  8943. /* "fontTools/misc/bezierTools.py":547
  8944. * )
  8945. * solutions = sorted(t for t in solutions if 0 <= t < 1)
  8946. * if not solutions: # <<<<<<<<<<<<<<
  8947. * return [(pt1, pt2, pt3)]
  8948. * return _splitQuadraticAtT(a, b, c, *solutions)
  8949. */
  8950. }
  8951. /* "fontTools/misc/bezierTools.py":549
  8952. * if not solutions:
  8953. * return [(pt1, pt2, pt3)]
  8954. * return _splitQuadraticAtT(a, b, c, *solutions) # <<<<<<<<<<<<<<
  8955. *
  8956. *
  8957. */
  8958. __Pyx_XDECREF(__pyx_r);
  8959. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_splitQuadraticAtT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 549, __pyx_L1_error)
  8960. __Pyx_GOTREF(__pyx_t_1);
  8961. __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 549, __pyx_L1_error)
  8962. __Pyx_GOTREF(__pyx_t_2);
  8963. __Pyx_INCREF(__pyx_v_a);
  8964. __Pyx_GIVEREF(__pyx_v_a);
  8965. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_a) != (0)) __PYX_ERR(0, 549, __pyx_L1_error);
  8966. __Pyx_INCREF(__pyx_v_b);
  8967. __Pyx_GIVEREF(__pyx_v_b);
  8968. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_b) != (0)) __PYX_ERR(0, 549, __pyx_L1_error);
  8969. __Pyx_INCREF(__pyx_v_c);
  8970. __Pyx_GIVEREF(__pyx_v_c);
  8971. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_c) != (0)) __PYX_ERR(0, 549, __pyx_L1_error);
  8972. __pyx_t_9 = __Pyx_PySequence_Tuple(__pyx_v_solutions); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 549, __pyx_L1_error)
  8973. __Pyx_GOTREF(__pyx_t_9);
  8974. __pyx_t_6 = PyNumber_Add(__pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 549, __pyx_L1_error)
  8975. __Pyx_GOTREF(__pyx_t_6);
  8976. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8977. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  8978. __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)
  8979. __Pyx_GOTREF(__pyx_t_9);
  8980. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8981. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  8982. __pyx_r = __pyx_t_9;
  8983. __pyx_t_9 = 0;
  8984. goto __pyx_L0;
  8985. /* "fontTools/misc/bezierTools.py":507
  8986. *
  8987. *
  8988. * def splitQuadratic(pt1, pt2, pt3, where, isHorizontal): # <<<<<<<<<<<<<<
  8989. * """Split a quadratic Bezier curve at a given coordinate.
  8990. *
  8991. */
  8992. /* function exit code */
  8993. __pyx_L1_error:;
  8994. __Pyx_XDECREF(__pyx_t_1);
  8995. __Pyx_XDECREF(__pyx_t_2);
  8996. __Pyx_XDECREF(__pyx_t_3);
  8997. __Pyx_XDECREF(__pyx_t_5);
  8998. __Pyx_XDECREF(__pyx_t_6);
  8999. __Pyx_XDECREF(__pyx_t_8);
  9000. __Pyx_XDECREF(__pyx_t_9);
  9001. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitQuadratic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9002. __pyx_r = NULL;
  9003. __pyx_L0:;
  9004. __Pyx_XDECREF(__pyx_v_a);
  9005. __Pyx_XDECREF(__pyx_v_b);
  9006. __Pyx_XDECREF(__pyx_v_c);
  9007. __Pyx_XDECREF(__pyx_v_solutions);
  9008. __Pyx_XDECREF(__pyx_gb_9fontTools_4misc_11bezierTools_14splitQuadratic_2generator2);
  9009. __Pyx_XGIVEREF(__pyx_r);
  9010. __Pyx_RefNannyFinishContext();
  9011. return __pyx_r;
  9012. }
  9013. /* "fontTools/misc/bezierTools.py":552
  9014. *
  9015. *
  9016. * def splitCubic(pt1, pt2, pt3, pt4, where, isHorizontal): # <<<<<<<<<<<<<<
  9017. * """Split a cubic Bezier curve at a given coordinate.
  9018. *
  9019. */
  9020. /* Python wrapper */
  9021. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_29splitCubic(PyObject *__pyx_self,
  9022. #if CYTHON_METH_FASTCALL
  9023. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  9024. #else
  9025. PyObject *__pyx_args, PyObject *__pyx_kwds
  9026. #endif
  9027. ); /*proto*/
  9028. 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))");
  9029. 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};
  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. ) {
  9037. PyObject *__pyx_v_pt1 = 0;
  9038. PyObject *__pyx_v_pt2 = 0;
  9039. PyObject *__pyx_v_pt3 = 0;
  9040. PyObject *__pyx_v_pt4 = 0;
  9041. PyObject *__pyx_v_where = 0;
  9042. PyObject *__pyx_v_isHorizontal = 0;
  9043. #if !CYTHON_METH_FASTCALL
  9044. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  9045. #endif
  9046. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  9047. PyObject* values[6] = {0,0,0,0,0,0};
  9048. int __pyx_lineno = 0;
  9049. const char *__pyx_filename = NULL;
  9050. int __pyx_clineno = 0;
  9051. PyObject *__pyx_r = 0;
  9052. __Pyx_RefNannyDeclarations
  9053. __Pyx_RefNannySetupContext("splitCubic (wrapper)", 0);
  9054. #if !CYTHON_METH_FASTCALL
  9055. #if CYTHON_ASSUME_SAFE_SIZE
  9056. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  9057. #else
  9058. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  9059. #endif
  9060. #endif
  9061. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  9062. {
  9063. 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};
  9064. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  9065. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 552, __pyx_L3_error)
  9066. if (__pyx_kwds_len > 0) {
  9067. switch (__pyx_nargs) {
  9068. case 6:
  9069. values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
  9070. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 552, __pyx_L3_error)
  9071. CYTHON_FALLTHROUGH;
  9072. case 5:
  9073. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  9074. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 552, __pyx_L3_error)
  9075. CYTHON_FALLTHROUGH;
  9076. case 4:
  9077. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  9078. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 552, __pyx_L3_error)
  9079. CYTHON_FALLTHROUGH;
  9080. case 3:
  9081. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  9082. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 552, __pyx_L3_error)
  9083. CYTHON_FALLTHROUGH;
  9084. case 2:
  9085. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  9086. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 552, __pyx_L3_error)
  9087. CYTHON_FALLTHROUGH;
  9088. case 1:
  9089. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  9090. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 552, __pyx_L3_error)
  9091. CYTHON_FALLTHROUGH;
  9092. case 0: break;
  9093. default: goto __pyx_L5_argtuple_error;
  9094. }
  9095. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  9096. 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)
  9097. for (Py_ssize_t i = __pyx_nargs; i < 6; i++) {
  9098. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("splitCubic", 1, 6, 6, i); __PYX_ERR(0, 552, __pyx_L3_error) }
  9099. }
  9100. } else if (unlikely(__pyx_nargs != 6)) {
  9101. goto __pyx_L5_argtuple_error;
  9102. } else {
  9103. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  9104. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 552, __pyx_L3_error)
  9105. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  9106. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 552, __pyx_L3_error)
  9107. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  9108. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 552, __pyx_L3_error)
  9109. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  9110. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 552, __pyx_L3_error)
  9111. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  9112. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 552, __pyx_L3_error)
  9113. values[5] = __Pyx_ArgRef_FASTCALL(__pyx_args, 5);
  9114. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[5])) __PYX_ERR(0, 552, __pyx_L3_error)
  9115. }
  9116. __pyx_v_pt1 = values[0];
  9117. __pyx_v_pt2 = values[1];
  9118. __pyx_v_pt3 = values[2];
  9119. __pyx_v_pt4 = values[3];
  9120. __pyx_v_where = values[4];
  9121. __pyx_v_isHorizontal = values[5];
  9122. }
  9123. goto __pyx_L6_skip;
  9124. __pyx_L5_argtuple_error:;
  9125. __Pyx_RaiseArgtupleInvalid("splitCubic", 1, 6, 6, __pyx_nargs); __PYX_ERR(0, 552, __pyx_L3_error)
  9126. __pyx_L6_skip:;
  9127. goto __pyx_L4_argument_unpacking_done;
  9128. __pyx_L3_error:;
  9129. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  9130. Py_XDECREF(values[__pyx_temp]);
  9131. }
  9132. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitCubic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9133. __Pyx_RefNannyFinishContext();
  9134. return NULL;
  9135. __pyx_L4_argument_unpacking_done:;
  9136. __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);
  9137. /* function exit code */
  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_RefNannyFinishContext();
  9142. return __pyx_r;
  9143. }
  9144. static PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_10splitCubic_2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
  9145. /* "fontTools/misc/bezierTools.py":583
  9146. * a[isHorizontal], b[isHorizontal], c[isHorizontal], d[isHorizontal] - where
  9147. * )
  9148. * solutions = sorted(t for t in solutions if 0 <= t < 1) # <<<<<<<<<<<<<<
  9149. * if not solutions:
  9150. * return [(pt1, pt2, pt3, pt4)]
  9151. */
  9152. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_10splitCubic_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  9153. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
  9154. PyObject *__pyx_r = NULL;
  9155. __Pyx_RefNannyDeclarations
  9156. int __pyx_lineno = 0;
  9157. const char *__pyx_filename = NULL;
  9158. int __pyx_clineno = 0;
  9159. __Pyx_RefNannySetupContext("genexpr", 0);
  9160. __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);
  9161. if (unlikely(!__pyx_cur_scope)) {
  9162. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr *)Py_None);
  9163. __Pyx_INCREF(Py_None);
  9164. __PYX_ERR(0, 583, __pyx_L1_error)
  9165. } else {
  9166. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  9167. }
  9168. __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  9169. __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  9170. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  9171. {
  9172. __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)
  9173. __Pyx_DECREF(__pyx_cur_scope);
  9174. __Pyx_RefNannyFinishContext();
  9175. return (PyObject *) gen;
  9176. }
  9177. /* function exit code */
  9178. __pyx_L1_error:;
  9179. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitCubic.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9180. __pyx_r = NULL;
  9181. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  9182. __Pyx_XGIVEREF(__pyx_r);
  9183. __Pyx_RefNannyFinishContext();
  9184. return __pyx_r;
  9185. }
  9186. static PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_10splitCubic_2generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
  9187. {
  9188. 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);
  9189. PyObject *__pyx_r = NULL;
  9190. PyObject *__pyx_t_1 = NULL;
  9191. Py_ssize_t __pyx_t_2;
  9192. PyObject *(*__pyx_t_3)(PyObject *);
  9193. PyObject *__pyx_t_4 = NULL;
  9194. int __pyx_t_5;
  9195. int __pyx_lineno = 0;
  9196. const char *__pyx_filename = NULL;
  9197. int __pyx_clineno = 0;
  9198. __Pyx_RefNannyDeclarations
  9199. __Pyx_RefNannySetupContext("genexpr", 0);
  9200. switch (__pyx_generator->resume_label) {
  9201. case 0: goto __pyx_L3_first_run;
  9202. default: /* CPython raises the right error here */
  9203. __Pyx_RefNannyFinishContext();
  9204. return NULL;
  9205. }
  9206. __pyx_L3_first_run:;
  9207. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 583, __pyx_L1_error)
  9208. __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 583, __pyx_L1_error)
  9209. __Pyx_GOTREF(__pyx_r);
  9210. if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 583, __pyx_L1_error) }
  9211. if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
  9212. __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
  9213. __pyx_t_2 = 0;
  9214. __pyx_t_3 = NULL;
  9215. } else {
  9216. __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)
  9217. __Pyx_GOTREF(__pyx_t_1);
  9218. __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)
  9219. }
  9220. for (;;) {
  9221. if (likely(!__pyx_t_3)) {
  9222. if (likely(PyList_CheckExact(__pyx_t_1))) {
  9223. {
  9224. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  9225. #if !CYTHON_ASSUME_SAFE_SIZE
  9226. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 583, __pyx_L1_error)
  9227. #endif
  9228. if (__pyx_t_2 >= __pyx_temp) break;
  9229. }
  9230. __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
  9231. ++__pyx_t_2;
  9232. } else {
  9233. {
  9234. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  9235. #if !CYTHON_ASSUME_SAFE_SIZE
  9236. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 583, __pyx_L1_error)
  9237. #endif
  9238. if (__pyx_t_2 >= __pyx_temp) break;
  9239. }
  9240. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9241. __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
  9242. #else
  9243. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
  9244. #endif
  9245. ++__pyx_t_2;
  9246. }
  9247. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 583, __pyx_L1_error)
  9248. } else {
  9249. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  9250. if (unlikely(!__pyx_t_4)) {
  9251. PyObject* exc_type = PyErr_Occurred();
  9252. if (exc_type) {
  9253. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 583, __pyx_L1_error)
  9254. PyErr_Clear();
  9255. }
  9256. break;
  9257. }
  9258. }
  9259. __Pyx_GOTREF(__pyx_t_4);
  9260. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_t);
  9261. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_t, __pyx_t_4);
  9262. __Pyx_GIVEREF(__pyx_t_4);
  9263. __pyx_t_4 = 0;
  9264. __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)
  9265. if (__Pyx_PyObject_IsTrue(__pyx_t_4)) {
  9266. __Pyx_DECREF(__pyx_t_4);
  9267. __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)
  9268. }
  9269. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 583, __pyx_L1_error)
  9270. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  9271. if (__pyx_t_5) {
  9272. if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_cur_scope->__pyx_v_t))) __PYX_ERR(0, 583, __pyx_L1_error)
  9273. }
  9274. }
  9275. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9276. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  9277. /* function exit code */
  9278. goto __pyx_L0;
  9279. __pyx_L1_error:;
  9280. __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  9281. __Pyx_XDECREF(__pyx_t_1);
  9282. __Pyx_XDECREF(__pyx_t_4);
  9283. if (__Pyx_PyErr_Occurred()) {
  9284. __Pyx_Generator_Replace_StopIteration(0);
  9285. __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9286. }
  9287. __pyx_L0:;
  9288. __Pyx_XGIVEREF(__pyx_r);
  9289. #if !CYTHON_USE_EXC_INFO_STACK
  9290. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  9291. #endif
  9292. __pyx_generator->resume_label = -1;
  9293. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  9294. __Pyx_RefNannyFinishContext();
  9295. return __pyx_r;
  9296. }
  9297. /* "fontTools/misc/bezierTools.py":552
  9298. *
  9299. *
  9300. * def splitCubic(pt1, pt2, pt3, pt4, where, isHorizontal): # <<<<<<<<<<<<<<
  9301. * """Split a cubic Bezier curve at a given coordinate.
  9302. *
  9303. */
  9304. 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) {
  9305. PyObject *__pyx_v_a = NULL;
  9306. PyObject *__pyx_v_b = NULL;
  9307. PyObject *__pyx_v_c = NULL;
  9308. PyObject *__pyx_v_d = NULL;
  9309. PyObject *__pyx_v_solutions = NULL;
  9310. PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_10splitCubic_2generator3 = 0;
  9311. PyObject *__pyx_r = NULL;
  9312. __Pyx_RefNannyDeclarations
  9313. PyObject *__pyx_t_1 = NULL;
  9314. PyObject *__pyx_t_2 = NULL;
  9315. PyObject *__pyx_t_3 = NULL;
  9316. size_t __pyx_t_4;
  9317. PyObject *__pyx_t_5 = NULL;
  9318. PyObject *__pyx_t_6 = NULL;
  9319. PyObject *__pyx_t_7 = NULL;
  9320. PyObject *(*__pyx_t_8)(PyObject *);
  9321. PyObject *__pyx_t_9 = NULL;
  9322. PyObject *__pyx_t_10 = NULL;
  9323. int __pyx_t_11;
  9324. int __pyx_t_12;
  9325. int __pyx_lineno = 0;
  9326. const char *__pyx_filename = NULL;
  9327. int __pyx_clineno = 0;
  9328. __Pyx_RefNannySetupContext("splitCubic", 0);
  9329. /* "fontTools/misc/bezierTools.py":579
  9330. * ((92.5259, 25), (95.202, 17.5085), (97.7062, 9.17517), (100, 1.77636e-15))
  9331. * """
  9332. * a, b, c, d = calcCubicParameters(pt1, pt2, pt3, pt4) # <<<<<<<<<<<<<<
  9333. * solutions = solveCubic(
  9334. * a[isHorizontal], b[isHorizontal], c[isHorizontal], d[isHorizontal] - where
  9335. */
  9336. __pyx_t_2 = NULL;
  9337. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_calcCubicParameters); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 579, __pyx_L1_error)
  9338. __Pyx_GOTREF(__pyx_t_3);
  9339. __pyx_t_4 = 1;
  9340. #if CYTHON_UNPACK_METHODS
  9341. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  9342. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  9343. assert(__pyx_t_2);
  9344. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  9345. __Pyx_INCREF(__pyx_t_2);
  9346. __Pyx_INCREF(__pyx__function);
  9347. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  9348. __pyx_t_4 = 0;
  9349. }
  9350. #endif
  9351. {
  9352. PyObject *__pyx_callargs[5] = {__pyx_t_2, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_pt4};
  9353. __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));
  9354. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  9355. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9356. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 579, __pyx_L1_error)
  9357. __Pyx_GOTREF(__pyx_t_1);
  9358. }
  9359. if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
  9360. PyObject* sequence = __pyx_t_1;
  9361. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  9362. if (unlikely(size != 4)) {
  9363. if (size > 4) __Pyx_RaiseTooManyValuesError(4);
  9364. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  9365. __PYX_ERR(0, 579, __pyx_L1_error)
  9366. }
  9367. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9368. if (likely(PyTuple_CheckExact(sequence))) {
  9369. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  9370. __Pyx_INCREF(__pyx_t_3);
  9371. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  9372. __Pyx_INCREF(__pyx_t_2);
  9373. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2);
  9374. __Pyx_INCREF(__pyx_t_5);
  9375. __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3);
  9376. __Pyx_INCREF(__pyx_t_6);
  9377. } else {
  9378. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  9379. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 579, __pyx_L1_error)
  9380. __Pyx_XGOTREF(__pyx_t_3);
  9381. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  9382. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 579, __pyx_L1_error)
  9383. __Pyx_XGOTREF(__pyx_t_2);
  9384. __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  9385. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 579, __pyx_L1_error)
  9386. __Pyx_XGOTREF(__pyx_t_5);
  9387. __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 3, __Pyx_ReferenceSharing_SharedReference);
  9388. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 579, __pyx_L1_error)
  9389. __Pyx_XGOTREF(__pyx_t_6);
  9390. }
  9391. #else
  9392. {
  9393. Py_ssize_t i;
  9394. PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_2,&__pyx_t_5,&__pyx_t_6};
  9395. for (i=0; i < 4; i++) {
  9396. PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 579, __pyx_L1_error)
  9397. __Pyx_GOTREF(item);
  9398. *(temps[i]) = item;
  9399. }
  9400. }
  9401. #endif
  9402. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9403. } else {
  9404. Py_ssize_t index = -1;
  9405. PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_2,&__pyx_t_5,&__pyx_t_6};
  9406. __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 579, __pyx_L1_error)
  9407. __Pyx_GOTREF(__pyx_t_7);
  9408. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9409. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
  9410. for (index=0; index < 4; index++) {
  9411. PyObject* item = __pyx_t_8(__pyx_t_7); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
  9412. __Pyx_GOTREF(item);
  9413. *(temps[index]) = item;
  9414. }
  9415. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 4) < (0)) __PYX_ERR(0, 579, __pyx_L1_error)
  9416. __pyx_t_8 = NULL;
  9417. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9418. goto __pyx_L4_unpacking_done;
  9419. __pyx_L3_unpacking_failed:;
  9420. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9421. __pyx_t_8 = NULL;
  9422. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  9423. __PYX_ERR(0, 579, __pyx_L1_error)
  9424. __pyx_L4_unpacking_done:;
  9425. }
  9426. __pyx_v_a = __pyx_t_3;
  9427. __pyx_t_3 = 0;
  9428. __pyx_v_b = __pyx_t_2;
  9429. __pyx_t_2 = 0;
  9430. __pyx_v_c = __pyx_t_5;
  9431. __pyx_t_5 = 0;
  9432. __pyx_v_d = __pyx_t_6;
  9433. __pyx_t_6 = 0;
  9434. /* "fontTools/misc/bezierTools.py":580
  9435. * """
  9436. * a, b, c, d = calcCubicParameters(pt1, pt2, pt3, pt4)
  9437. * solutions = solveCubic( # <<<<<<<<<<<<<<
  9438. * a[isHorizontal], b[isHorizontal], c[isHorizontal], d[isHorizontal] - where
  9439. * )
  9440. */
  9441. __pyx_t_6 = NULL;
  9442. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_solveCubic); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 580, __pyx_L1_error)
  9443. __Pyx_GOTREF(__pyx_t_5);
  9444. /* "fontTools/misc/bezierTools.py":581
  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. * solutions = sorted(t for t in solutions if 0 <= t < 1)
  9450. */
  9451. __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_a, __pyx_v_isHorizontal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __pyx_L1_error)
  9452. __Pyx_GOTREF(__pyx_t_2);
  9453. __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_b, __pyx_v_isHorizontal); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 581, __pyx_L1_error)
  9454. __Pyx_GOTREF(__pyx_t_3);
  9455. __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_c, __pyx_v_isHorizontal); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 581, __pyx_L1_error)
  9456. __Pyx_GOTREF(__pyx_t_7);
  9457. __pyx_t_9 = __Pyx_PyObject_GetItem(__pyx_v_d, __pyx_v_isHorizontal); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 581, __pyx_L1_error)
  9458. __Pyx_GOTREF(__pyx_t_9);
  9459. __pyx_t_10 = PyNumber_Subtract(__pyx_t_9, __pyx_v_where); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 581, __pyx_L1_error)
  9460. __Pyx_GOTREF(__pyx_t_10);
  9461. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  9462. __pyx_t_4 = 1;
  9463. #if CYTHON_UNPACK_METHODS
  9464. if (unlikely(PyMethod_Check(__pyx_t_5))) {
  9465. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
  9466. assert(__pyx_t_6);
  9467. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
  9468. __Pyx_INCREF(__pyx_t_6);
  9469. __Pyx_INCREF(__pyx__function);
  9470. __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
  9471. __pyx_t_4 = 0;
  9472. }
  9473. #endif
  9474. {
  9475. PyObject *__pyx_callargs[5] = {__pyx_t_6, __pyx_t_2, __pyx_t_3, __pyx_t_7, __pyx_t_10};
  9476. __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));
  9477. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  9478. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9479. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9480. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9481. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  9482. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9483. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 580, __pyx_L1_error)
  9484. __Pyx_GOTREF(__pyx_t_1);
  9485. }
  9486. __pyx_v_solutions = __pyx_t_1;
  9487. __pyx_t_1 = 0;
  9488. /* "fontTools/misc/bezierTools.py":583
  9489. * a[isHorizontal], b[isHorizontal], c[isHorizontal], d[isHorizontal] - where
  9490. * )
  9491. * solutions = sorted(t for t in solutions if 0 <= t < 1) # <<<<<<<<<<<<<<
  9492. * if not solutions:
  9493. * return [(pt1, pt2, pt3, pt4)]
  9494. */
  9495. __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)
  9496. __Pyx_GOTREF(__pyx_t_1);
  9497. __pyx_t_5 = __Pyx_Generator_GetInlinedResult(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 583, __pyx_L1_error)
  9498. __Pyx_GOTREF(__pyx_t_5);
  9499. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9500. if (unlikely((PyList_Sort(__pyx_t_5) < 0))) __PYX_ERR(0, 583, __pyx_L1_error)
  9501. __Pyx_DECREF_SET(__pyx_v_solutions, __pyx_t_5);
  9502. __pyx_t_5 = 0;
  9503. /* "fontTools/misc/bezierTools.py":584
  9504. * )
  9505. * solutions = sorted(t for t in solutions if 0 <= t < 1)
  9506. * if not solutions: # <<<<<<<<<<<<<<
  9507. * return [(pt1, pt2, pt3, pt4)]
  9508. * return _splitCubicAtT(a, b, c, d, *solutions)
  9509. */
  9510. __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_solutions); if (unlikely((__pyx_t_11 < 0))) __PYX_ERR(0, 584, __pyx_L1_error)
  9511. __pyx_t_12 = (!__pyx_t_11);
  9512. if (__pyx_t_12) {
  9513. /* "fontTools/misc/bezierTools.py":585
  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. */
  9520. __Pyx_XDECREF(__pyx_r);
  9521. __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 585, __pyx_L1_error)
  9522. __Pyx_GOTREF(__pyx_t_5);
  9523. __Pyx_INCREF(__pyx_v_pt1);
  9524. __Pyx_GIVEREF(__pyx_v_pt1);
  9525. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_pt1) != (0)) __PYX_ERR(0, 585, __pyx_L1_error);
  9526. __Pyx_INCREF(__pyx_v_pt2);
  9527. __Pyx_GIVEREF(__pyx_v_pt2);
  9528. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_pt2) != (0)) __PYX_ERR(0, 585, __pyx_L1_error);
  9529. __Pyx_INCREF(__pyx_v_pt3);
  9530. __Pyx_GIVEREF(__pyx_v_pt3);
  9531. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_pt3) != (0)) __PYX_ERR(0, 585, __pyx_L1_error);
  9532. __Pyx_INCREF(__pyx_v_pt4);
  9533. __Pyx_GIVEREF(__pyx_v_pt4);
  9534. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_pt4) != (0)) __PYX_ERR(0, 585, __pyx_L1_error);
  9535. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 585, __pyx_L1_error)
  9536. __Pyx_GOTREF(__pyx_t_1);
  9537. __Pyx_GIVEREF(__pyx_t_5);
  9538. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_5) != (0)) __PYX_ERR(0, 585, __pyx_L1_error);
  9539. __pyx_t_5 = 0;
  9540. __pyx_r = __pyx_t_1;
  9541. __pyx_t_1 = 0;
  9542. goto __pyx_L0;
  9543. /* "fontTools/misc/bezierTools.py":584
  9544. * )
  9545. * solutions = sorted(t for t in solutions if 0 <= t < 1)
  9546. * if not solutions: # <<<<<<<<<<<<<<
  9547. * return [(pt1, pt2, pt3, pt4)]
  9548. * return _splitCubicAtT(a, b, c, d, *solutions)
  9549. */
  9550. }
  9551. /* "fontTools/misc/bezierTools.py":586
  9552. * if not solutions:
  9553. * return [(pt1, pt2, pt3, pt4)]
  9554. * return _splitCubicAtT(a, b, c, d, *solutions) # <<<<<<<<<<<<<<
  9555. *
  9556. *
  9557. */
  9558. __Pyx_XDECREF(__pyx_r);
  9559. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_splitCubicAtT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error)
  9560. __Pyx_GOTREF(__pyx_t_1);
  9561. __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 586, __pyx_L1_error)
  9562. __Pyx_GOTREF(__pyx_t_5);
  9563. __Pyx_INCREF(__pyx_v_a);
  9564. __Pyx_GIVEREF(__pyx_v_a);
  9565. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_a) != (0)) __PYX_ERR(0, 586, __pyx_L1_error);
  9566. __Pyx_INCREF(__pyx_v_b);
  9567. __Pyx_GIVEREF(__pyx_v_b);
  9568. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_b) != (0)) __PYX_ERR(0, 586, __pyx_L1_error);
  9569. __Pyx_INCREF(__pyx_v_c);
  9570. __Pyx_GIVEREF(__pyx_v_c);
  9571. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_c) != (0)) __PYX_ERR(0, 586, __pyx_L1_error);
  9572. __Pyx_INCREF(__pyx_v_d);
  9573. __Pyx_GIVEREF(__pyx_v_d);
  9574. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_d) != (0)) __PYX_ERR(0, 586, __pyx_L1_error);
  9575. __pyx_t_10 = __Pyx_PySequence_Tuple(__pyx_v_solutions); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 586, __pyx_L1_error)
  9576. __Pyx_GOTREF(__pyx_t_10);
  9577. __pyx_t_7 = PyNumber_Add(__pyx_t_5, __pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 586, __pyx_L1_error)
  9578. __Pyx_GOTREF(__pyx_t_7);
  9579. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9580. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  9581. __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)
  9582. __Pyx_GOTREF(__pyx_t_10);
  9583. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9584. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9585. __pyx_r = __pyx_t_10;
  9586. __pyx_t_10 = 0;
  9587. goto __pyx_L0;
  9588. /* "fontTools/misc/bezierTools.py":552
  9589. *
  9590. *
  9591. * def splitCubic(pt1, pt2, pt3, pt4, where, isHorizontal): # <<<<<<<<<<<<<<
  9592. * """Split a cubic Bezier curve at a given coordinate.
  9593. *
  9594. */
  9595. /* function exit code */
  9596. __pyx_L1_error:;
  9597. __Pyx_XDECREF(__pyx_t_1);
  9598. __Pyx_XDECREF(__pyx_t_2);
  9599. __Pyx_XDECREF(__pyx_t_3);
  9600. __Pyx_XDECREF(__pyx_t_5);
  9601. __Pyx_XDECREF(__pyx_t_6);
  9602. __Pyx_XDECREF(__pyx_t_7);
  9603. __Pyx_XDECREF(__pyx_t_9);
  9604. __Pyx_XDECREF(__pyx_t_10);
  9605. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitCubic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9606. __pyx_r = NULL;
  9607. __pyx_L0:;
  9608. __Pyx_XDECREF(__pyx_v_a);
  9609. __Pyx_XDECREF(__pyx_v_b);
  9610. __Pyx_XDECREF(__pyx_v_c);
  9611. __Pyx_XDECREF(__pyx_v_d);
  9612. __Pyx_XDECREF(__pyx_v_solutions);
  9613. __Pyx_XDECREF(__pyx_gb_9fontTools_4misc_11bezierTools_10splitCubic_2generator3);
  9614. __Pyx_XGIVEREF(__pyx_r);
  9615. __Pyx_RefNannyFinishContext();
  9616. return __pyx_r;
  9617. }
  9618. /* "fontTools/misc/bezierTools.py":589
  9619. *
  9620. *
  9621. * def splitQuadraticAtT(pt1, pt2, pt3, *ts): # <<<<<<<<<<<<<<
  9622. * """Split a quadratic Bezier curve at one or more values of t.
  9623. *
  9624. */
  9625. /* Python wrapper */
  9626. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_31splitQuadraticAtT(PyObject *__pyx_self,
  9627. #if CYTHON_METH_FASTCALL
  9628. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  9629. #else
  9630. PyObject *__pyx_args, PyObject *__pyx_kwds
  9631. #endif
  9632. ); /*proto*/
  9633. 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))");
  9634. 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};
  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. ) {
  9642. PyObject *__pyx_v_pt1 = 0;
  9643. PyObject *__pyx_v_pt2 = 0;
  9644. PyObject *__pyx_v_pt3 = 0;
  9645. PyObject *__pyx_v_ts = 0;
  9646. #if !CYTHON_METH_FASTCALL
  9647. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  9648. #endif
  9649. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  9650. PyObject* values[3] = {0,0,0};
  9651. int __pyx_lineno = 0;
  9652. const char *__pyx_filename = NULL;
  9653. int __pyx_clineno = 0;
  9654. PyObject *__pyx_r = 0;
  9655. __Pyx_RefNannyDeclarations
  9656. __Pyx_RefNannySetupContext("splitQuadraticAtT (wrapper)", 0);
  9657. #if !CYTHON_METH_FASTCALL
  9658. #if CYTHON_ASSUME_SAFE_SIZE
  9659. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  9660. #else
  9661. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  9662. #endif
  9663. #endif
  9664. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  9665. __pyx_v_ts = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 3, __pyx_nargs);
  9666. if (unlikely(!__pyx_v_ts)) {
  9667. __Pyx_RefNannyFinishContext();
  9668. return NULL;
  9669. }
  9670. __Pyx_GOTREF(__pyx_v_ts);
  9671. {
  9672. 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};
  9673. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  9674. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 589, __pyx_L3_error)
  9675. if (__pyx_kwds_len > 0) {
  9676. switch (__pyx_nargs) {
  9677. default:
  9678. case 3:
  9679. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  9680. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 589, __pyx_L3_error)
  9681. CYTHON_FALLTHROUGH;
  9682. case 2:
  9683. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  9684. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 589, __pyx_L3_error)
  9685. CYTHON_FALLTHROUGH;
  9686. case 1:
  9687. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  9688. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 589, __pyx_L3_error)
  9689. CYTHON_FALLTHROUGH;
  9690. case 0: break;
  9691. }
  9692. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  9693. const Py_ssize_t used_pos_args = (kwd_pos_args < 3) ? kwd_pos_args : 3;
  9694. 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)
  9695. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  9696. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("splitQuadraticAtT", 0, 3, 3, i); __PYX_ERR(0, 589, __pyx_L3_error) }
  9697. }
  9698. } else if (unlikely(__pyx_nargs < 3)) {
  9699. goto __pyx_L5_argtuple_error;
  9700. } else {
  9701. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  9702. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 589, __pyx_L3_error)
  9703. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  9704. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 589, __pyx_L3_error)
  9705. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  9706. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 589, __pyx_L3_error)
  9707. }
  9708. __pyx_v_pt1 = values[0];
  9709. __pyx_v_pt2 = values[1];
  9710. __pyx_v_pt3 = values[2];
  9711. }
  9712. goto __pyx_L6_skip;
  9713. __pyx_L5_argtuple_error:;
  9714. __Pyx_RaiseArgtupleInvalid("splitQuadraticAtT", 0, 3, 3, __pyx_nargs); __PYX_ERR(0, 589, __pyx_L3_error)
  9715. __pyx_L6_skip:;
  9716. goto __pyx_L4_argument_unpacking_done;
  9717. __pyx_L3_error:;
  9718. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  9719. Py_XDECREF(values[__pyx_temp]);
  9720. }
  9721. __Pyx_DECREF(__pyx_v_ts); __pyx_v_ts = 0;
  9722. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitQuadraticAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9723. __Pyx_RefNannyFinishContext();
  9724. return NULL;
  9725. __pyx_L4_argument_unpacking_done:;
  9726. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_30splitQuadraticAtT(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_ts);
  9727. /* function exit code */
  9728. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  9729. Py_XDECREF(values[__pyx_temp]);
  9730. }
  9731. __Pyx_DECREF(__pyx_v_ts);
  9732. __Pyx_RefNannyFinishContext();
  9733. return __pyx_r;
  9734. }
  9735. 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) {
  9736. PyObject *__pyx_v_a = NULL;
  9737. PyObject *__pyx_v_b = NULL;
  9738. PyObject *__pyx_v_c = NULL;
  9739. PyObject *__pyx_r = NULL;
  9740. __Pyx_RefNannyDeclarations
  9741. PyObject *__pyx_t_1 = NULL;
  9742. PyObject *__pyx_t_2 = NULL;
  9743. PyObject *__pyx_t_3 = NULL;
  9744. size_t __pyx_t_4;
  9745. PyObject *__pyx_t_5 = NULL;
  9746. PyObject *__pyx_t_6 = NULL;
  9747. PyObject *(*__pyx_t_7)(PyObject *);
  9748. int __pyx_lineno = 0;
  9749. const char *__pyx_filename = NULL;
  9750. int __pyx_clineno = 0;
  9751. __Pyx_RefNannySetupContext("splitQuadraticAtT", 0);
  9752. /* "fontTools/misc/bezierTools.py":609
  9753. * ((75, 37.5), (87.5, 25), (100, 0))
  9754. * """
  9755. * a, b, c = calcQuadraticParameters(pt1, pt2, pt3) # <<<<<<<<<<<<<<
  9756. * return _splitQuadraticAtT(a, b, c, *ts)
  9757. *
  9758. */
  9759. __pyx_t_2 = NULL;
  9760. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_calcQuadraticParameters); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 609, __pyx_L1_error)
  9761. __Pyx_GOTREF(__pyx_t_3);
  9762. __pyx_t_4 = 1;
  9763. #if CYTHON_UNPACK_METHODS
  9764. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  9765. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  9766. assert(__pyx_t_2);
  9767. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  9768. __Pyx_INCREF(__pyx_t_2);
  9769. __Pyx_INCREF(__pyx__function);
  9770. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  9771. __pyx_t_4 = 0;
  9772. }
  9773. #endif
  9774. {
  9775. PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3};
  9776. __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));
  9777. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  9778. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9779. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 609, __pyx_L1_error)
  9780. __Pyx_GOTREF(__pyx_t_1);
  9781. }
  9782. if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
  9783. PyObject* sequence = __pyx_t_1;
  9784. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  9785. if (unlikely(size != 3)) {
  9786. if (size > 3) __Pyx_RaiseTooManyValuesError(3);
  9787. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  9788. __PYX_ERR(0, 609, __pyx_L1_error)
  9789. }
  9790. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9791. if (likely(PyTuple_CheckExact(sequence))) {
  9792. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  9793. __Pyx_INCREF(__pyx_t_3);
  9794. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  9795. __Pyx_INCREF(__pyx_t_2);
  9796. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2);
  9797. __Pyx_INCREF(__pyx_t_5);
  9798. } else {
  9799. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  9800. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 609, __pyx_L1_error)
  9801. __Pyx_XGOTREF(__pyx_t_3);
  9802. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  9803. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 609, __pyx_L1_error)
  9804. __Pyx_XGOTREF(__pyx_t_2);
  9805. __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  9806. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 609, __pyx_L1_error)
  9807. __Pyx_XGOTREF(__pyx_t_5);
  9808. }
  9809. #else
  9810. __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 609, __pyx_L1_error)
  9811. __Pyx_GOTREF(__pyx_t_3);
  9812. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 609, __pyx_L1_error)
  9813. __Pyx_GOTREF(__pyx_t_2);
  9814. __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 609, __pyx_L1_error)
  9815. __Pyx_GOTREF(__pyx_t_5);
  9816. #endif
  9817. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9818. } else {
  9819. Py_ssize_t index = -1;
  9820. __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 609, __pyx_L1_error)
  9821. __Pyx_GOTREF(__pyx_t_6);
  9822. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9823. __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6);
  9824. index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
  9825. __Pyx_GOTREF(__pyx_t_3);
  9826. index = 1; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  9827. __Pyx_GOTREF(__pyx_t_2);
  9828. index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
  9829. __Pyx_GOTREF(__pyx_t_5);
  9830. if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < (0)) __PYX_ERR(0, 609, __pyx_L1_error)
  9831. __pyx_t_7 = NULL;
  9832. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  9833. goto __pyx_L4_unpacking_done;
  9834. __pyx_L3_unpacking_failed:;
  9835. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  9836. __pyx_t_7 = NULL;
  9837. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  9838. __PYX_ERR(0, 609, __pyx_L1_error)
  9839. __pyx_L4_unpacking_done:;
  9840. }
  9841. __pyx_v_a = __pyx_t_3;
  9842. __pyx_t_3 = 0;
  9843. __pyx_v_b = __pyx_t_2;
  9844. __pyx_t_2 = 0;
  9845. __pyx_v_c = __pyx_t_5;
  9846. __pyx_t_5 = 0;
  9847. /* "fontTools/misc/bezierTools.py":610
  9848. * """
  9849. * a, b, c = calcQuadraticParameters(pt1, pt2, pt3)
  9850. * return _splitQuadraticAtT(a, b, c, *ts) # <<<<<<<<<<<<<<
  9851. *
  9852. *
  9853. */
  9854. __Pyx_XDECREF(__pyx_r);
  9855. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_splitQuadraticAtT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __pyx_L1_error)
  9856. __Pyx_GOTREF(__pyx_t_1);
  9857. __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 610, __pyx_L1_error)
  9858. __Pyx_GOTREF(__pyx_t_5);
  9859. __Pyx_INCREF(__pyx_v_a);
  9860. __Pyx_GIVEREF(__pyx_v_a);
  9861. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_a) != (0)) __PYX_ERR(0, 610, __pyx_L1_error);
  9862. __Pyx_INCREF(__pyx_v_b);
  9863. __Pyx_GIVEREF(__pyx_v_b);
  9864. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_b) != (0)) __PYX_ERR(0, 610, __pyx_L1_error);
  9865. __Pyx_INCREF(__pyx_v_c);
  9866. __Pyx_GIVEREF(__pyx_v_c);
  9867. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_c) != (0)) __PYX_ERR(0, 610, __pyx_L1_error);
  9868. __pyx_t_2 = PyNumber_Add(__pyx_t_5, __pyx_v_ts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 610, __pyx_L1_error)
  9869. __Pyx_GOTREF(__pyx_t_2);
  9870. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9871. __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)
  9872. __Pyx_GOTREF(__pyx_t_5);
  9873. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  9874. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9875. __pyx_r = __pyx_t_5;
  9876. __pyx_t_5 = 0;
  9877. goto __pyx_L0;
  9878. /* "fontTools/misc/bezierTools.py":589
  9879. *
  9880. *
  9881. * def splitQuadraticAtT(pt1, pt2, pt3, *ts): # <<<<<<<<<<<<<<
  9882. * """Split a quadratic Bezier curve at one or more values of t.
  9883. *
  9884. */
  9885. /* function exit code */
  9886. __pyx_L1_error:;
  9887. __Pyx_XDECREF(__pyx_t_1);
  9888. __Pyx_XDECREF(__pyx_t_2);
  9889. __Pyx_XDECREF(__pyx_t_3);
  9890. __Pyx_XDECREF(__pyx_t_5);
  9891. __Pyx_XDECREF(__pyx_t_6);
  9892. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitQuadraticAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9893. __pyx_r = NULL;
  9894. __pyx_L0:;
  9895. __Pyx_XDECREF(__pyx_v_a);
  9896. __Pyx_XDECREF(__pyx_v_b);
  9897. __Pyx_XDECREF(__pyx_v_c);
  9898. __Pyx_XGIVEREF(__pyx_r);
  9899. __Pyx_RefNannyFinishContext();
  9900. return __pyx_r;
  9901. }
  9902. /* "fontTools/misc/bezierTools.py":613
  9903. *
  9904. *
  9905. * def splitCubicAtT(pt1, pt2, pt3, pt4, *ts): # <<<<<<<<<<<<<<
  9906. * """Split a cubic Bezier curve at one or more values of t.
  9907. *
  9908. */
  9909. /* Python wrapper */
  9910. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_33splitCubicAtT(PyObject *__pyx_self,
  9911. #if CYTHON_METH_FASTCALL
  9912. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  9913. #else
  9914. PyObject *__pyx_args, PyObject *__pyx_kwds
  9915. #endif
  9916. ); /*proto*/
  9917. 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))");
  9918. 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};
  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. ) {
  9926. PyObject *__pyx_v_pt1 = 0;
  9927. PyObject *__pyx_v_pt2 = 0;
  9928. PyObject *__pyx_v_pt3 = 0;
  9929. PyObject *__pyx_v_pt4 = 0;
  9930. PyObject *__pyx_v_ts = 0;
  9931. #if !CYTHON_METH_FASTCALL
  9932. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  9933. #endif
  9934. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  9935. PyObject* values[4] = {0,0,0,0};
  9936. int __pyx_lineno = 0;
  9937. const char *__pyx_filename = NULL;
  9938. int __pyx_clineno = 0;
  9939. PyObject *__pyx_r = 0;
  9940. __Pyx_RefNannyDeclarations
  9941. __Pyx_RefNannySetupContext("splitCubicAtT (wrapper)", 0);
  9942. #if !CYTHON_METH_FASTCALL
  9943. #if CYTHON_ASSUME_SAFE_SIZE
  9944. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  9945. #else
  9946. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  9947. #endif
  9948. #endif
  9949. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  9950. __pyx_v_ts = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 4, __pyx_nargs);
  9951. if (unlikely(!__pyx_v_ts)) {
  9952. __Pyx_RefNannyFinishContext();
  9953. return NULL;
  9954. }
  9955. __Pyx_GOTREF(__pyx_v_ts);
  9956. {
  9957. 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};
  9958. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  9959. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 613, __pyx_L3_error)
  9960. if (__pyx_kwds_len > 0) {
  9961. switch (__pyx_nargs) {
  9962. default:
  9963. case 4:
  9964. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  9965. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 613, __pyx_L3_error)
  9966. CYTHON_FALLTHROUGH;
  9967. case 3:
  9968. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  9969. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 613, __pyx_L3_error)
  9970. CYTHON_FALLTHROUGH;
  9971. case 2:
  9972. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  9973. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 613, __pyx_L3_error)
  9974. CYTHON_FALLTHROUGH;
  9975. case 1:
  9976. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  9977. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 613, __pyx_L3_error)
  9978. CYTHON_FALLTHROUGH;
  9979. case 0: break;
  9980. }
  9981. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  9982. const Py_ssize_t used_pos_args = (kwd_pos_args < 4) ? kwd_pos_args : 4;
  9983. 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)
  9984. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  9985. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("splitCubicAtT", 0, 4, 4, i); __PYX_ERR(0, 613, __pyx_L3_error) }
  9986. }
  9987. } else if (unlikely(__pyx_nargs < 4)) {
  9988. goto __pyx_L5_argtuple_error;
  9989. } else {
  9990. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  9991. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 613, __pyx_L3_error)
  9992. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  9993. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 613, __pyx_L3_error)
  9994. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  9995. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 613, __pyx_L3_error)
  9996. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  9997. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 613, __pyx_L3_error)
  9998. }
  9999. __pyx_v_pt1 = values[0];
  10000. __pyx_v_pt2 = values[1];
  10001. __pyx_v_pt3 = values[2];
  10002. __pyx_v_pt4 = values[3];
  10003. }
  10004. goto __pyx_L6_skip;
  10005. __pyx_L5_argtuple_error:;
  10006. __Pyx_RaiseArgtupleInvalid("splitCubicAtT", 0, 4, 4, __pyx_nargs); __PYX_ERR(0, 613, __pyx_L3_error)
  10007. __pyx_L6_skip:;
  10008. goto __pyx_L4_argument_unpacking_done;
  10009. __pyx_L3_error:;
  10010. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  10011. Py_XDECREF(values[__pyx_temp]);
  10012. }
  10013. __Pyx_DECREF(__pyx_v_ts); __pyx_v_ts = 0;
  10014. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitCubicAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10015. __Pyx_RefNannyFinishContext();
  10016. return NULL;
  10017. __pyx_L4_argument_unpacking_done:;
  10018. __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);
  10019. /* function exit code */
  10020. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  10021. Py_XDECREF(values[__pyx_temp]);
  10022. }
  10023. __Pyx_DECREF(__pyx_v_ts);
  10024. __Pyx_RefNannyFinishContext();
  10025. return __pyx_r;
  10026. }
  10027. 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) {
  10028. PyObject *__pyx_v_a = NULL;
  10029. PyObject *__pyx_v_b = NULL;
  10030. PyObject *__pyx_v_c = NULL;
  10031. PyObject *__pyx_v_d = NULL;
  10032. PyObject *__pyx_v_split = NULL;
  10033. PyObject *__pyx_r = NULL;
  10034. __Pyx_RefNannyDeclarations
  10035. PyObject *__pyx_t_1 = NULL;
  10036. PyObject *__pyx_t_2 = NULL;
  10037. PyObject *__pyx_t_3 = NULL;
  10038. size_t __pyx_t_4;
  10039. PyObject *__pyx_t_5 = NULL;
  10040. PyObject *__pyx_t_6 = NULL;
  10041. PyObject *__pyx_t_7 = NULL;
  10042. PyObject *(*__pyx_t_8)(PyObject *);
  10043. int __pyx_lineno = 0;
  10044. const char *__pyx_filename = NULL;
  10045. int __pyx_clineno = 0;
  10046. __Pyx_RefNannySetupContext("splitCubicAtT", 0);
  10047. /* "fontTools/misc/bezierTools.py":633
  10048. * ((77.3438, 56.25), (85.9375, 43.75), (93.75, 25), (100, 0))
  10049. * """
  10050. * a, b, c, d = calcCubicParameters(pt1, pt2, pt3, pt4) # <<<<<<<<<<<<<<
  10051. * split = _splitCubicAtT(a, b, c, d, *ts)
  10052. *
  10053. */
  10054. __pyx_t_2 = NULL;
  10055. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_calcCubicParameters); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 633, __pyx_L1_error)
  10056. __Pyx_GOTREF(__pyx_t_3);
  10057. __pyx_t_4 = 1;
  10058. #if CYTHON_UNPACK_METHODS
  10059. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  10060. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  10061. assert(__pyx_t_2);
  10062. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  10063. __Pyx_INCREF(__pyx_t_2);
  10064. __Pyx_INCREF(__pyx__function);
  10065. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  10066. __pyx_t_4 = 0;
  10067. }
  10068. #endif
  10069. {
  10070. PyObject *__pyx_callargs[5] = {__pyx_t_2, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_pt4};
  10071. __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));
  10072. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  10073. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  10074. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 633, __pyx_L1_error)
  10075. __Pyx_GOTREF(__pyx_t_1);
  10076. }
  10077. if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
  10078. PyObject* sequence = __pyx_t_1;
  10079. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  10080. if (unlikely(size != 4)) {
  10081. if (size > 4) __Pyx_RaiseTooManyValuesError(4);
  10082. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  10083. __PYX_ERR(0, 633, __pyx_L1_error)
  10084. }
  10085. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  10086. if (likely(PyTuple_CheckExact(sequence))) {
  10087. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  10088. __Pyx_INCREF(__pyx_t_3);
  10089. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  10090. __Pyx_INCREF(__pyx_t_2);
  10091. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2);
  10092. __Pyx_INCREF(__pyx_t_5);
  10093. __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3);
  10094. __Pyx_INCREF(__pyx_t_6);
  10095. } else {
  10096. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  10097. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 633, __pyx_L1_error)
  10098. __Pyx_XGOTREF(__pyx_t_3);
  10099. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  10100. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 633, __pyx_L1_error)
  10101. __Pyx_XGOTREF(__pyx_t_2);
  10102. __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  10103. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 633, __pyx_L1_error)
  10104. __Pyx_XGOTREF(__pyx_t_5);
  10105. __pyx_t_6 = __Pyx_PyList_GetItemRefFast(sequence, 3, __Pyx_ReferenceSharing_SharedReference);
  10106. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 633, __pyx_L1_error)
  10107. __Pyx_XGOTREF(__pyx_t_6);
  10108. }
  10109. #else
  10110. {
  10111. Py_ssize_t i;
  10112. PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_2,&__pyx_t_5,&__pyx_t_6};
  10113. for (i=0; i < 4; i++) {
  10114. PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 633, __pyx_L1_error)
  10115. __Pyx_GOTREF(item);
  10116. *(temps[i]) = item;
  10117. }
  10118. }
  10119. #endif
  10120. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10121. } else {
  10122. Py_ssize_t index = -1;
  10123. PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_2,&__pyx_t_5,&__pyx_t_6};
  10124. __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 633, __pyx_L1_error)
  10125. __Pyx_GOTREF(__pyx_t_7);
  10126. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10127. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
  10128. for (index=0; index < 4; index++) {
  10129. PyObject* item = __pyx_t_8(__pyx_t_7); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
  10130. __Pyx_GOTREF(item);
  10131. *(temps[index]) = item;
  10132. }
  10133. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 4) < (0)) __PYX_ERR(0, 633, __pyx_L1_error)
  10134. __pyx_t_8 = NULL;
  10135. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10136. goto __pyx_L4_unpacking_done;
  10137. __pyx_L3_unpacking_failed:;
  10138. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  10139. __pyx_t_8 = NULL;
  10140. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  10141. __PYX_ERR(0, 633, __pyx_L1_error)
  10142. __pyx_L4_unpacking_done:;
  10143. }
  10144. __pyx_v_a = __pyx_t_3;
  10145. __pyx_t_3 = 0;
  10146. __pyx_v_b = __pyx_t_2;
  10147. __pyx_t_2 = 0;
  10148. __pyx_v_c = __pyx_t_5;
  10149. __pyx_t_5 = 0;
  10150. __pyx_v_d = __pyx_t_6;
  10151. __pyx_t_6 = 0;
  10152. /* "fontTools/misc/bezierTools.py":634
  10153. * """
  10154. * a, b, c, d = calcCubicParameters(pt1, pt2, pt3, pt4)
  10155. * split = _splitCubicAtT(a, b, c, d, *ts) # <<<<<<<<<<<<<<
  10156. *
  10157. * # the split impl can introduce floating point errors; we know the first
  10158. */
  10159. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_splitCubicAtT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error)
  10160. __Pyx_GOTREF(__pyx_t_1);
  10161. __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 634, __pyx_L1_error)
  10162. __Pyx_GOTREF(__pyx_t_6);
  10163. __Pyx_INCREF(__pyx_v_a);
  10164. __Pyx_GIVEREF(__pyx_v_a);
  10165. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_a) != (0)) __PYX_ERR(0, 634, __pyx_L1_error);
  10166. __Pyx_INCREF(__pyx_v_b);
  10167. __Pyx_GIVEREF(__pyx_v_b);
  10168. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_b) != (0)) __PYX_ERR(0, 634, __pyx_L1_error);
  10169. __Pyx_INCREF(__pyx_v_c);
  10170. __Pyx_GIVEREF(__pyx_v_c);
  10171. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_c) != (0)) __PYX_ERR(0, 634, __pyx_L1_error);
  10172. __Pyx_INCREF(__pyx_v_d);
  10173. __Pyx_GIVEREF(__pyx_v_d);
  10174. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_v_d) != (0)) __PYX_ERR(0, 634, __pyx_L1_error);
  10175. __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_v_ts); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 634, __pyx_L1_error)
  10176. __Pyx_GOTREF(__pyx_t_5);
  10177. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10178. __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)
  10179. __Pyx_GOTREF(__pyx_t_6);
  10180. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10181. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  10182. __pyx_v_split = __pyx_t_6;
  10183. __pyx_t_6 = 0;
  10184. /* "fontTools/misc/bezierTools.py":639
  10185. * # segment should always start at pt1 and the last segment should end at pt4,
  10186. * # so we set those values directly before returning.
  10187. * split[0] = (pt1, *split[0][1:]) # <<<<<<<<<<<<<<
  10188. * split[-1] = (*split[-1][:-1], pt4)
  10189. * return split
  10190. */
  10191. __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 639, __pyx_L1_error)
  10192. __Pyx_GOTREF(__pyx_t_5);
  10193. __Pyx_INCREF(__pyx_v_pt1);
  10194. __Pyx_GIVEREF(__pyx_v_pt1);
  10195. if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, __pyx_v_pt1) != (0)) __PYX_ERR(0, 639, __pyx_L1_error);
  10196. __pyx_t_6 = __pyx_t_5;
  10197. __pyx_t_5 = 0;
  10198. __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)
  10199. __Pyx_GOTREF(__pyx_t_5);
  10200. __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)
  10201. __Pyx_GOTREF(__pyx_t_1);
  10202. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  10203. if (__Pyx_PyList_Extend(__pyx_t_6, __pyx_t_1) < (0)) __PYX_ERR(0, 639, __pyx_L1_error)
  10204. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10205. {
  10206. PyObject *__pyx_temp = PyList_AsTuple(__pyx_t_6);
  10207. __Pyx_DECREF(__pyx_t_6);
  10208. __pyx_t_6 = __pyx_temp; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 639, __pyx_L1_error)
  10209. __Pyx_GOTREF(__pyx_t_6);
  10210. }
  10211. 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)
  10212. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10213. /* "fontTools/misc/bezierTools.py":640
  10214. * # so we set those values directly before returning.
  10215. * split[0] = (pt1, *split[0][1:])
  10216. * split[-1] = (*split[-1][:-1], pt4) # <<<<<<<<<<<<<<
  10217. * return split
  10218. *
  10219. */
  10220. __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)
  10221. __Pyx_GOTREF(__pyx_t_1);
  10222. __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)
  10223. __Pyx_GOTREF(__pyx_t_5);
  10224. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10225. __pyx_t_6 = __Pyx_PySequence_ListKeepNew(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 640, __pyx_L1_error)
  10226. __Pyx_GOTREF(__pyx_t_6);
  10227. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  10228. if (__Pyx_ListComp_Append(__pyx_t_6, __pyx_v_pt4) < (0)) __PYX_ERR(0, 640, __pyx_L1_error)
  10229. {
  10230. PyObject *__pyx_temp = PyList_AsTuple(__pyx_t_6);
  10231. __Pyx_DECREF(__pyx_t_6);
  10232. __pyx_t_6 = __pyx_temp; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 640, __pyx_L1_error)
  10233. __Pyx_GOTREF(__pyx_t_6);
  10234. }
  10235. 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)
  10236. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10237. /* "fontTools/misc/bezierTools.py":641
  10238. * split[0] = (pt1, *split[0][1:])
  10239. * split[-1] = (*split[-1][:-1], pt4)
  10240. * return split # <<<<<<<<<<<<<<
  10241. *
  10242. *
  10243. */
  10244. __Pyx_XDECREF(__pyx_r);
  10245. __Pyx_INCREF(__pyx_v_split);
  10246. __pyx_r = __pyx_v_split;
  10247. goto __pyx_L0;
  10248. /* "fontTools/misc/bezierTools.py":613
  10249. *
  10250. *
  10251. * def splitCubicAtT(pt1, pt2, pt3, pt4, *ts): # <<<<<<<<<<<<<<
  10252. * """Split a cubic Bezier curve at one or more values of t.
  10253. *
  10254. */
  10255. /* function exit code */
  10256. __pyx_L1_error:;
  10257. __Pyx_XDECREF(__pyx_t_1);
  10258. __Pyx_XDECREF(__pyx_t_2);
  10259. __Pyx_XDECREF(__pyx_t_3);
  10260. __Pyx_XDECREF(__pyx_t_5);
  10261. __Pyx_XDECREF(__pyx_t_6);
  10262. __Pyx_XDECREF(__pyx_t_7);
  10263. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitCubicAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10264. __pyx_r = NULL;
  10265. __pyx_L0:;
  10266. __Pyx_XDECREF(__pyx_v_a);
  10267. __Pyx_XDECREF(__pyx_v_b);
  10268. __Pyx_XDECREF(__pyx_v_c);
  10269. __Pyx_XDECREF(__pyx_v_d);
  10270. __Pyx_XDECREF(__pyx_v_split);
  10271. __Pyx_XGIVEREF(__pyx_r);
  10272. __Pyx_RefNannyFinishContext();
  10273. return __pyx_r;
  10274. }
  10275. static PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_36generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
  10276. /* "fontTools/misc/bezierTools.py":644
  10277. *
  10278. *
  10279. * @cython.locals( # <<<<<<<<<<<<<<
  10280. * pt1=cython.complex,
  10281. * pt2=cython.complex,
  10282. */
  10283. /* Python wrapper */
  10284. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_35splitCubicAtTC(PyObject *__pyx_self,
  10285. #if CYTHON_METH_FASTCALL
  10286. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  10287. #else
  10288. PyObject *__pyx_args, PyObject *__pyx_kwds
  10289. #endif
  10290. ); /*proto*/
  10291. 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).");
  10292. 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};
  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. ) {
  10300. __pyx_t_double_complex __pyx_v_pt1;
  10301. __pyx_t_double_complex __pyx_v_pt2;
  10302. __pyx_t_double_complex __pyx_v_pt3;
  10303. __pyx_t_double_complex __pyx_v_pt4;
  10304. PyObject *__pyx_v_ts = 0;
  10305. #if !CYTHON_METH_FASTCALL
  10306. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  10307. #endif
  10308. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  10309. PyObject* values[4] = {0,0,0,0};
  10310. int __pyx_lineno = 0;
  10311. const char *__pyx_filename = NULL;
  10312. int __pyx_clineno = 0;
  10313. PyObject *__pyx_r = 0;
  10314. __Pyx_RefNannyDeclarations
  10315. __Pyx_RefNannySetupContext("splitCubicAtTC (wrapper)", 0);
  10316. #if !CYTHON_METH_FASTCALL
  10317. #if CYTHON_ASSUME_SAFE_SIZE
  10318. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  10319. #else
  10320. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  10321. #endif
  10322. #endif
  10323. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  10324. __pyx_v_ts = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 4, __pyx_nargs);
  10325. if (unlikely(!__pyx_v_ts)) {
  10326. __Pyx_RefNannyFinishContext();
  10327. return NULL;
  10328. }
  10329. __Pyx_GOTREF(__pyx_v_ts);
  10330. {
  10331. 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};
  10332. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  10333. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 644, __pyx_L3_error)
  10334. if (__pyx_kwds_len > 0) {
  10335. switch (__pyx_nargs) {
  10336. default:
  10337. case 4:
  10338. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  10339. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 644, __pyx_L3_error)
  10340. CYTHON_FALLTHROUGH;
  10341. case 3:
  10342. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  10343. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 644, __pyx_L3_error)
  10344. CYTHON_FALLTHROUGH;
  10345. case 2:
  10346. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  10347. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 644, __pyx_L3_error)
  10348. CYTHON_FALLTHROUGH;
  10349. case 1:
  10350. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  10351. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 644, __pyx_L3_error)
  10352. CYTHON_FALLTHROUGH;
  10353. case 0: break;
  10354. }
  10355. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  10356. const Py_ssize_t used_pos_args = (kwd_pos_args < 4) ? kwd_pos_args : 4;
  10357. 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)
  10358. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  10359. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("splitCubicAtTC", 0, 4, 4, i); __PYX_ERR(0, 644, __pyx_L3_error) }
  10360. }
  10361. } else if (unlikely(__pyx_nargs < 4)) {
  10362. goto __pyx_L5_argtuple_error;
  10363. } else {
  10364. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  10365. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 644, __pyx_L3_error)
  10366. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  10367. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 644, __pyx_L3_error)
  10368. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  10369. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 644, __pyx_L3_error)
  10370. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  10371. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 644, __pyx_L3_error)
  10372. }
  10373. __pyx_v_pt1 = __Pyx_PyComplex_As___pyx_t_double_complex(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 654, __pyx_L3_error)
  10374. __pyx_v_pt2 = __Pyx_PyComplex_As___pyx_t_double_complex(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 654, __pyx_L3_error)
  10375. __pyx_v_pt3 = __Pyx_PyComplex_As___pyx_t_double_complex(values[2]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 654, __pyx_L3_error)
  10376. __pyx_v_pt4 = __Pyx_PyComplex_As___pyx_t_double_complex(values[3]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 654, __pyx_L3_error)
  10377. }
  10378. goto __pyx_L6_skip;
  10379. __pyx_L5_argtuple_error:;
  10380. __Pyx_RaiseArgtupleInvalid("splitCubicAtTC", 0, 4, 4, __pyx_nargs); __PYX_ERR(0, 644, __pyx_L3_error)
  10381. __pyx_L6_skip:;
  10382. goto __pyx_L4_argument_unpacking_done;
  10383. __pyx_L3_error:;
  10384. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  10385. Py_XDECREF(values[__pyx_temp]);
  10386. }
  10387. __Pyx_CLEAR(__pyx_v_ts);
  10388. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitCubicAtTC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10389. __Pyx_RefNannyFinishContext();
  10390. return NULL;
  10391. __pyx_L4_argument_unpacking_done:;
  10392. __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);
  10393. /* function exit code */
  10394. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  10395. Py_XDECREF(values[__pyx_temp]);
  10396. }
  10397. __Pyx_DECREF(__pyx_v_ts);
  10398. __Pyx_RefNannyFinishContext();
  10399. return __pyx_r;
  10400. }
  10401. 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) {
  10402. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC *__pyx_cur_scope;
  10403. PyObject *__pyx_r = NULL;
  10404. __Pyx_RefNannyDeclarations
  10405. int __pyx_lineno = 0;
  10406. const char *__pyx_filename = NULL;
  10407. int __pyx_clineno = 0;
  10408. __Pyx_RefNannySetupContext("splitCubicAtTC", 0);
  10409. __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);
  10410. if (unlikely(!__pyx_cur_scope)) {
  10411. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC *)Py_None);
  10412. __Pyx_INCREF(Py_None);
  10413. __PYX_ERR(0, 644, __pyx_L1_error)
  10414. } else {
  10415. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  10416. }
  10417. __pyx_cur_scope->__pyx_v_pt1 = __pyx_v_pt1;
  10418. __pyx_cur_scope->__pyx_v_pt2 = __pyx_v_pt2;
  10419. __pyx_cur_scope->__pyx_v_pt3 = __pyx_v_pt3;
  10420. __pyx_cur_scope->__pyx_v_pt4 = __pyx_v_pt4;
  10421. __pyx_cur_scope->__pyx_v_ts = __pyx_v_ts;
  10422. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_ts);
  10423. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_ts);
  10424. {
  10425. __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)
  10426. __Pyx_DECREF(__pyx_cur_scope);
  10427. __Pyx_RefNannyFinishContext();
  10428. return (PyObject *) gen;
  10429. }
  10430. /* function exit code */
  10431. __pyx_L1_error:;
  10432. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitCubicAtTC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10433. __pyx_r = NULL;
  10434. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  10435. __Pyx_XGIVEREF(__pyx_r);
  10436. __Pyx_RefNannyFinishContext();
  10437. return __pyx_r;
  10438. }
  10439. static PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_36generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
  10440. {
  10441. 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);
  10442. PyObject *__pyx_r = NULL;
  10443. PyObject *__pyx_t_1 = NULL;
  10444. PyObject *__pyx_t_2 = NULL;
  10445. PyObject *__pyx_t_3 = NULL;
  10446. PyObject *__pyx_t_4 = NULL;
  10447. PyObject *__pyx_t_5 = NULL;
  10448. PyObject *__pyx_t_6 = NULL;
  10449. PyObject *(*__pyx_t_7)(PyObject *);
  10450. __pyx_t_double_complex __pyx_t_8;
  10451. __pyx_t_double_complex __pyx_t_9;
  10452. __pyx_t_double_complex __pyx_t_10;
  10453. __pyx_t_double_complex __pyx_t_11;
  10454. __Pyx_PySendResult __pyx_t_12;
  10455. int __pyx_lineno = 0;
  10456. const char *__pyx_filename = NULL;
  10457. int __pyx_clineno = 0;
  10458. __Pyx_RefNannyDeclarations
  10459. __Pyx_RefNannySetupContext("splitCubicAtTC", 0);
  10460. switch (__pyx_generator->resume_label) {
  10461. case 0: goto __pyx_L3_first_run;
  10462. case 1: goto __pyx_L6_resume_from_yield_from;
  10463. default: /* CPython raises the right error here */
  10464. __Pyx_RefNannyFinishContext();
  10465. return NULL;
  10466. }
  10467. __pyx_L3_first_run:;
  10468. if (unlikely(__pyx_sent_value != Py_None)) {
  10469. if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
  10470. __PYX_ERR(0, 644, __pyx_L1_error)
  10471. }
  10472. /* "fontTools/misc/bezierTools.py":664
  10473. * Curve segments (each curve segment being four complex numbers).
  10474. * """
  10475. * a, b, c, d = calcCubicParametersC(pt1, pt2, pt3, pt4) # <<<<<<<<<<<<<<
  10476. * yield from _splitCubicAtTC(a, b, c, d, *ts)
  10477. *
  10478. */
  10479. __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)
  10480. __Pyx_GOTREF(__pyx_t_1);
  10481. if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
  10482. PyObject* sequence = __pyx_t_1;
  10483. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  10484. if (unlikely(size != 4)) {
  10485. if (size > 4) __Pyx_RaiseTooManyValuesError(4);
  10486. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  10487. __PYX_ERR(0, 664, __pyx_L1_error)
  10488. }
  10489. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  10490. if (likely(PyTuple_CheckExact(sequence))) {
  10491. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  10492. __Pyx_INCREF(__pyx_t_2);
  10493. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
  10494. __Pyx_INCREF(__pyx_t_3);
  10495. __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
  10496. __Pyx_INCREF(__pyx_t_4);
  10497. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3);
  10498. __Pyx_INCREF(__pyx_t_5);
  10499. } else {
  10500. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  10501. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 664, __pyx_L1_error)
  10502. __Pyx_XGOTREF(__pyx_t_2);
  10503. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  10504. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 664, __pyx_L1_error)
  10505. __Pyx_XGOTREF(__pyx_t_3);
  10506. __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  10507. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 664, __pyx_L1_error)
  10508. __Pyx_XGOTREF(__pyx_t_4);
  10509. __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 3, __Pyx_ReferenceSharing_SharedReference);
  10510. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 664, __pyx_L1_error)
  10511. __Pyx_XGOTREF(__pyx_t_5);
  10512. }
  10513. #else
  10514. {
  10515. Py_ssize_t i;
  10516. PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_5};
  10517. for (i=0; i < 4; i++) {
  10518. PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 664, __pyx_L1_error)
  10519. __Pyx_GOTREF(item);
  10520. *(temps[i]) = item;
  10521. }
  10522. }
  10523. #endif
  10524. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10525. } else {
  10526. Py_ssize_t index = -1;
  10527. PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_5};
  10528. __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 664, __pyx_L1_error)
  10529. __Pyx_GOTREF(__pyx_t_6);
  10530. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10531. __pyx_t_7 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6);
  10532. for (index=0; index < 4; index++) {
  10533. PyObject* item = __pyx_t_7(__pyx_t_6); if (unlikely(!item)) goto __pyx_L4_unpacking_failed;
  10534. __Pyx_GOTREF(item);
  10535. *(temps[index]) = item;
  10536. }
  10537. if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 4) < (0)) __PYX_ERR(0, 664, __pyx_L1_error)
  10538. __pyx_t_7 = NULL;
  10539. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10540. goto __pyx_L5_unpacking_done;
  10541. __pyx_L4_unpacking_failed:;
  10542. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10543. __pyx_t_7 = NULL;
  10544. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  10545. __PYX_ERR(0, 664, __pyx_L1_error)
  10546. __pyx_L5_unpacking_done:;
  10547. }
  10548. __pyx_t_8 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_2); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 664, __pyx_L1_error)
  10549. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  10550. __pyx_t_9 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 664, __pyx_L1_error)
  10551. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  10552. __pyx_t_10 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_4); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 664, __pyx_L1_error)
  10553. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  10554. __pyx_t_11 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_5); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 664, __pyx_L1_error)
  10555. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  10556. __pyx_cur_scope->__pyx_v_a = __pyx_t_8;
  10557. __pyx_cur_scope->__pyx_v_b = __pyx_t_9;
  10558. __pyx_cur_scope->__pyx_v_c = __pyx_t_10;
  10559. __pyx_cur_scope->__pyx_v_d = __pyx_t_11;
  10560. /* "fontTools/misc/bezierTools.py":665
  10561. * """
  10562. * a, b, c, d = calcCubicParametersC(pt1, pt2, pt3, pt4)
  10563. * yield from _splitCubicAtTC(a, b, c, d, *ts) # <<<<<<<<<<<<<<
  10564. *
  10565. *
  10566. */
  10567. __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)
  10568. __Pyx_GOTREF(__pyx_t_1);
  10569. __pyx_t_5 = __pyx_PyComplex_FromComplex(__pyx_cur_scope->__pyx_v_a); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 665, __pyx_L1_error)
  10570. __Pyx_GOTREF(__pyx_t_5);
  10571. __pyx_t_4 = __pyx_PyComplex_FromComplex(__pyx_cur_scope->__pyx_v_b); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 665, __pyx_L1_error)
  10572. __Pyx_GOTREF(__pyx_t_4);
  10573. __pyx_t_3 = __pyx_PyComplex_FromComplex(__pyx_cur_scope->__pyx_v_c); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 665, __pyx_L1_error)
  10574. __Pyx_GOTREF(__pyx_t_3);
  10575. __pyx_t_2 = __pyx_PyComplex_FromComplex(__pyx_cur_scope->__pyx_v_d); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 665, __pyx_L1_error)
  10576. __Pyx_GOTREF(__pyx_t_2);
  10577. __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 665, __pyx_L1_error)
  10578. __Pyx_GOTREF(__pyx_t_6);
  10579. __Pyx_GIVEREF(__pyx_t_5);
  10580. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5) != (0)) __PYX_ERR(0, 665, __pyx_L1_error);
  10581. __Pyx_GIVEREF(__pyx_t_4);
  10582. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 665, __pyx_L1_error);
  10583. __Pyx_GIVEREF(__pyx_t_3);
  10584. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 665, __pyx_L1_error);
  10585. __Pyx_GIVEREF(__pyx_t_2);
  10586. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_2) != (0)) __PYX_ERR(0, 665, __pyx_L1_error);
  10587. __pyx_t_5 = 0;
  10588. __pyx_t_4 = 0;
  10589. __pyx_t_3 = 0;
  10590. __pyx_t_2 = 0;
  10591. __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)
  10592. __Pyx_GOTREF(__pyx_t_2);
  10593. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10594. __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)
  10595. __Pyx_GOTREF(__pyx_t_6);
  10596. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10597. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  10598. __pyx_t_12 = __Pyx_Generator_Yield_From(__pyx_generator, __pyx_t_6, &__pyx_r);
  10599. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10600. if (likely(__pyx_t_12 == PYGEN_NEXT)) {
  10601. __Pyx_GOTREF(__pyx_r);
  10602. __Pyx_XGIVEREF(__pyx_r);
  10603. __Pyx_RefNannyFinishContext();
  10604. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  10605. /* return from generator, yielding value */
  10606. __pyx_generator->resume_label = 1;
  10607. return __pyx_r;
  10608. __pyx_L6_resume_from_yield_from:;
  10609. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 665, __pyx_L1_error)
  10610. } else if (likely(__pyx_t_12 == PYGEN_RETURN)) {
  10611. __Pyx_GOTREF(__pyx_r);
  10612. __Pyx_DECREF(__pyx_r); __pyx_r = 0;
  10613. } else {
  10614. __Pyx_XGOTREF(__pyx_r);
  10615. __PYX_ERR(0, 665, __pyx_L1_error)
  10616. }
  10617. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  10618. /* "fontTools/misc/bezierTools.py":644
  10619. *
  10620. *
  10621. * @cython.locals( # <<<<<<<<<<<<<<
  10622. * pt1=cython.complex,
  10623. * pt2=cython.complex,
  10624. */
  10625. /* function exit code */
  10626. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  10627. goto __pyx_L0;
  10628. __pyx_L1_error:;
  10629. __Pyx_XDECREF(__pyx_t_1);
  10630. __Pyx_XDECREF(__pyx_t_2);
  10631. __Pyx_XDECREF(__pyx_t_3);
  10632. __Pyx_XDECREF(__pyx_t_4);
  10633. __Pyx_XDECREF(__pyx_t_5);
  10634. __Pyx_XDECREF(__pyx_t_6);
  10635. if (__Pyx_PyErr_Occurred()) {
  10636. __Pyx_Generator_Replace_StopIteration(0);
  10637. __Pyx_AddTraceback("splitCubicAtTC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10638. }
  10639. __pyx_L0:;
  10640. __Pyx_XGIVEREF(__pyx_r);
  10641. #if !CYTHON_USE_EXC_INFO_STACK
  10642. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  10643. #endif
  10644. __pyx_generator->resume_label = -1;
  10645. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  10646. __Pyx_RefNannyFinishContext();
  10647. return __pyx_r;
  10648. }
  10649. /* "fontTools/misc/bezierTools.py":668
  10650. *
  10651. *
  10652. * @cython.returns(cython.complex) # <<<<<<<<<<<<<<
  10653. * @cython.locals(
  10654. * t=cython.double,
  10655. */
  10656. /* Python wrapper */
  10657. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_38splitCubicIntoTwoAtTC(PyObject *__pyx_self,
  10658. #if CYTHON_METH_FASTCALL
  10659. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  10660. #else
  10661. PyObject *__pyx_args, PyObject *__pyx_kwds
  10662. #endif
  10663. ); /*proto*/
  10664. 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).");
  10665. 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};
  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. ) {
  10673. __pyx_t_double_complex __pyx_v_pt1;
  10674. __pyx_t_double_complex __pyx_v_pt2;
  10675. __pyx_t_double_complex __pyx_v_pt3;
  10676. __pyx_t_double_complex __pyx_v_pt4;
  10677. double __pyx_v_t;
  10678. #if !CYTHON_METH_FASTCALL
  10679. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  10680. #endif
  10681. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  10682. PyObject* values[5] = {0,0,0,0,0};
  10683. int __pyx_lineno = 0;
  10684. const char *__pyx_filename = NULL;
  10685. int __pyx_clineno = 0;
  10686. PyObject *__pyx_r = 0;
  10687. __Pyx_RefNannyDeclarations
  10688. __Pyx_RefNannySetupContext("splitCubicIntoTwoAtTC (wrapper)", 0);
  10689. #if !CYTHON_METH_FASTCALL
  10690. #if CYTHON_ASSUME_SAFE_SIZE
  10691. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  10692. #else
  10693. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  10694. #endif
  10695. #endif
  10696. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  10697. {
  10698. 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};
  10699. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  10700. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 668, __pyx_L3_error)
  10701. if (__pyx_kwds_len > 0) {
  10702. switch (__pyx_nargs) {
  10703. case 5:
  10704. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  10705. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 668, __pyx_L3_error)
  10706. CYTHON_FALLTHROUGH;
  10707. case 4:
  10708. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  10709. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 668, __pyx_L3_error)
  10710. CYTHON_FALLTHROUGH;
  10711. case 3:
  10712. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  10713. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 668, __pyx_L3_error)
  10714. CYTHON_FALLTHROUGH;
  10715. case 2:
  10716. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  10717. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 668, __pyx_L3_error)
  10718. CYTHON_FALLTHROUGH;
  10719. case 1:
  10720. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  10721. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 668, __pyx_L3_error)
  10722. CYTHON_FALLTHROUGH;
  10723. case 0: break;
  10724. default: goto __pyx_L5_argtuple_error;
  10725. }
  10726. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  10727. 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)
  10728. for (Py_ssize_t i = __pyx_nargs; i < 5; i++) {
  10729. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("splitCubicIntoTwoAtTC", 1, 5, 5, i); __PYX_ERR(0, 668, __pyx_L3_error) }
  10730. }
  10731. } else if (unlikely(__pyx_nargs != 5)) {
  10732. goto __pyx_L5_argtuple_error;
  10733. } else {
  10734. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  10735. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 668, __pyx_L3_error)
  10736. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  10737. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 668, __pyx_L3_error)
  10738. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  10739. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 668, __pyx_L3_error)
  10740. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  10741. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 668, __pyx_L3_error)
  10742. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  10743. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 668, __pyx_L3_error)
  10744. }
  10745. __pyx_v_pt1 = __Pyx_PyComplex_As___pyx_t_double_complex(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 682, __pyx_L3_error)
  10746. __pyx_v_pt2 = __Pyx_PyComplex_As___pyx_t_double_complex(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 682, __pyx_L3_error)
  10747. __pyx_v_pt3 = __Pyx_PyComplex_As___pyx_t_double_complex(values[2]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 682, __pyx_L3_error)
  10748. __pyx_v_pt4 = __Pyx_PyComplex_As___pyx_t_double_complex(values[3]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 682, __pyx_L3_error)
  10749. __pyx_v_t = __Pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 682, __pyx_L3_error)
  10750. }
  10751. goto __pyx_L6_skip;
  10752. __pyx_L5_argtuple_error:;
  10753. __Pyx_RaiseArgtupleInvalid("splitCubicIntoTwoAtTC", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 668, __pyx_L3_error)
  10754. __pyx_L6_skip:;
  10755. goto __pyx_L4_argument_unpacking_done;
  10756. __pyx_L3_error:;
  10757. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  10758. Py_XDECREF(values[__pyx_temp]);
  10759. }
  10760. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitCubicIntoTwoAtTC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10761. __Pyx_RefNannyFinishContext();
  10762. return NULL;
  10763. __pyx_L4_argument_unpacking_done:;
  10764. __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);
  10765. /* function exit code */
  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_RefNannyFinishContext();
  10770. return __pyx_r;
  10771. }
  10772. 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) {
  10773. double __pyx_v_t2;
  10774. double __pyx_v__1_t;
  10775. double __pyx_v__1_t_2;
  10776. double __pyx_v__2_t_1_t;
  10777. __pyx_t_double_complex __pyx_v_pointAtT;
  10778. __pyx_t_double_complex __pyx_v_off1;
  10779. __pyx_t_double_complex __pyx_v_off2;
  10780. PyObject *__pyx_r = NULL;
  10781. __Pyx_RefNannyDeclarations
  10782. PyObject *__pyx_t_1 = NULL;
  10783. PyObject *__pyx_t_2 = NULL;
  10784. PyObject *__pyx_t_3 = NULL;
  10785. PyObject *__pyx_t_4 = NULL;
  10786. PyObject *__pyx_t_5 = NULL;
  10787. PyObject *__pyx_t_6 = NULL;
  10788. int __pyx_lineno = 0;
  10789. const char *__pyx_filename = NULL;
  10790. int __pyx_clineno = 0;
  10791. __Pyx_RefNannySetupContext("splitCubicIntoTwoAtTC", 0);
  10792. /* "fontTools/misc/bezierTools.py":692
  10793. * A tuple of two curve segments (each curve segment being four complex numbers).
  10794. * """
  10795. * t2 = t * t # <<<<<<<<<<<<<<
  10796. * _1_t = 1 - t
  10797. * _1_t_2 = _1_t * _1_t
  10798. */
  10799. __pyx_v_t2 = (__pyx_v_t * __pyx_v_t);
  10800. /* "fontTools/misc/bezierTools.py":693
  10801. * """
  10802. * t2 = t * t
  10803. * _1_t = 1 - t # <<<<<<<<<<<<<<
  10804. * _1_t_2 = _1_t * _1_t
  10805. * _2_t_1_t = 2 * t * _1_t
  10806. */
  10807. __pyx_v__1_t = (1.0 - __pyx_v_t);
  10808. /* "fontTools/misc/bezierTools.py":694
  10809. * t2 = t * t
  10810. * _1_t = 1 - t
  10811. * _1_t_2 = _1_t * _1_t # <<<<<<<<<<<<<<
  10812. * _2_t_1_t = 2 * t * _1_t
  10813. * pointAtT = (
  10814. */
  10815. __pyx_v__1_t_2 = (__pyx_v__1_t * __pyx_v__1_t);
  10816. /* "fontTools/misc/bezierTools.py":695
  10817. * _1_t = 1 - t
  10818. * _1_t_2 = _1_t * _1_t
  10819. * _2_t_1_t = 2 * t * _1_t # <<<<<<<<<<<<<<
  10820. * pointAtT = (
  10821. * _1_t_2 * _1_t * pt1 + 3 * (_1_t_2 * t * pt2 + _1_t * t2 * pt3) + t2 * t * pt4
  10822. */
  10823. __pyx_v__2_t_1_t = ((2.0 * __pyx_v_t) * __pyx_v__1_t);
  10824. /* "fontTools/misc/bezierTools.py":697
  10825. * _2_t_1_t = 2 * t * _1_t
  10826. * pointAtT = (
  10827. * _1_t_2 * _1_t * pt1 + 3 * (_1_t_2 * t * pt2 + _1_t * t2 * pt3) + t2 * t * pt4 # <<<<<<<<<<<<<<
  10828. * )
  10829. * off1 = _1_t_2 * pt1 + _2_t_1_t * pt2 + t2 * pt3
  10830. */
  10831. __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));
  10832. /* "fontTools/misc/bezierTools.py":699
  10833. * _1_t_2 * _1_t * pt1 + 3 * (_1_t_2 * t * pt2 + _1_t * t2 * pt3) + t2 * t * pt4
  10834. * )
  10835. * off1 = _1_t_2 * pt1 + _2_t_1_t * pt2 + t2 * pt3 # <<<<<<<<<<<<<<
  10836. * off2 = _1_t_2 * pt2 + _2_t_1_t * pt3 + t2 * pt4
  10837. *
  10838. */
  10839. __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));
  10840. /* "fontTools/misc/bezierTools.py":700
  10841. * )
  10842. * off1 = _1_t_2 * pt1 + _2_t_1_t * pt2 + t2 * pt3
  10843. * off2 = _1_t_2 * pt2 + _2_t_1_t * pt3 + t2 * pt4 # <<<<<<<<<<<<<<
  10844. *
  10845. * pt2 = pt1 + (pt2 - pt1) * t
  10846. */
  10847. __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));
  10848. /* "fontTools/misc/bezierTools.py":702
  10849. * off2 = _1_t_2 * pt2 + _2_t_1_t * pt3 + t2 * pt4
  10850. *
  10851. * pt2 = pt1 + (pt2 - pt1) * t # <<<<<<<<<<<<<<
  10852. * pt3 = pt4 + (pt3 - pt4) * _1_t
  10853. *
  10854. */
  10855. __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)));
  10856. /* "fontTools/misc/bezierTools.py":703
  10857. *
  10858. * pt2 = pt1 + (pt2 - pt1) * t
  10859. * pt3 = pt4 + (pt3 - pt4) * _1_t # <<<<<<<<<<<<<<
  10860. *
  10861. * return ((pt1, pt2, off1, pointAtT), (pointAtT, off2, pt3, pt4))
  10862. */
  10863. __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)));
  10864. /* "fontTools/misc/bezierTools.py":705
  10865. * pt3 = pt4 + (pt3 - pt4) * _1_t
  10866. *
  10867. * return ((pt1, pt2, off1, pointAtT), (pointAtT, off2, pt3, pt4)) # <<<<<<<<<<<<<<
  10868. *
  10869. *
  10870. */
  10871. __Pyx_XDECREF(__pyx_r);
  10872. __pyx_t_1 = __pyx_PyComplex_FromComplex(__pyx_v_pt1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L1_error)
  10873. __Pyx_GOTREF(__pyx_t_1);
  10874. __pyx_t_2 = __pyx_PyComplex_FromComplex(__pyx_v_pt2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 705, __pyx_L1_error)
  10875. __Pyx_GOTREF(__pyx_t_2);
  10876. __pyx_t_3 = __pyx_PyComplex_FromComplex(__pyx_v_off1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 705, __pyx_L1_error)
  10877. __Pyx_GOTREF(__pyx_t_3);
  10878. __pyx_t_4 = __pyx_PyComplex_FromComplex(__pyx_v_pointAtT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 705, __pyx_L1_error)
  10879. __Pyx_GOTREF(__pyx_t_4);
  10880. __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 705, __pyx_L1_error)
  10881. __Pyx_GOTREF(__pyx_t_5);
  10882. __Pyx_GIVEREF(__pyx_t_1);
  10883. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 705, __pyx_L1_error);
  10884. __Pyx_GIVEREF(__pyx_t_2);
  10885. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 705, __pyx_L1_error);
  10886. __Pyx_GIVEREF(__pyx_t_3);
  10887. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 705, __pyx_L1_error);
  10888. __Pyx_GIVEREF(__pyx_t_4);
  10889. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4) != (0)) __PYX_ERR(0, 705, __pyx_L1_error);
  10890. __pyx_t_1 = 0;
  10891. __pyx_t_2 = 0;
  10892. __pyx_t_3 = 0;
  10893. __pyx_t_4 = 0;
  10894. __pyx_t_4 = __pyx_PyComplex_FromComplex(__pyx_v_pointAtT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 705, __pyx_L1_error)
  10895. __Pyx_GOTREF(__pyx_t_4);
  10896. __pyx_t_3 = __pyx_PyComplex_FromComplex(__pyx_v_off2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 705, __pyx_L1_error)
  10897. __Pyx_GOTREF(__pyx_t_3);
  10898. __pyx_t_2 = __pyx_PyComplex_FromComplex(__pyx_v_pt3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 705, __pyx_L1_error)
  10899. __Pyx_GOTREF(__pyx_t_2);
  10900. __pyx_t_1 = __pyx_PyComplex_FromComplex(__pyx_v_pt4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L1_error)
  10901. __Pyx_GOTREF(__pyx_t_1);
  10902. __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 705, __pyx_L1_error)
  10903. __Pyx_GOTREF(__pyx_t_6);
  10904. __Pyx_GIVEREF(__pyx_t_4);
  10905. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4) != (0)) __PYX_ERR(0, 705, __pyx_L1_error);
  10906. __Pyx_GIVEREF(__pyx_t_3);
  10907. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 705, __pyx_L1_error);
  10908. __Pyx_GIVEREF(__pyx_t_2);
  10909. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_2) != (0)) __PYX_ERR(0, 705, __pyx_L1_error);
  10910. __Pyx_GIVEREF(__pyx_t_1);
  10911. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_1) != (0)) __PYX_ERR(0, 705, __pyx_L1_error);
  10912. __pyx_t_4 = 0;
  10913. __pyx_t_3 = 0;
  10914. __pyx_t_2 = 0;
  10915. __pyx_t_1 = 0;
  10916. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 705, __pyx_L1_error)
  10917. __Pyx_GOTREF(__pyx_t_1);
  10918. __Pyx_GIVEREF(__pyx_t_5);
  10919. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5) != (0)) __PYX_ERR(0, 705, __pyx_L1_error);
  10920. __Pyx_GIVEREF(__pyx_t_6);
  10921. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6) != (0)) __PYX_ERR(0, 705, __pyx_L1_error);
  10922. __pyx_t_5 = 0;
  10923. __pyx_t_6 = 0;
  10924. __pyx_r = __pyx_t_1;
  10925. __pyx_t_1 = 0;
  10926. goto __pyx_L0;
  10927. /* "fontTools/misc/bezierTools.py":668
  10928. *
  10929. *
  10930. * @cython.returns(cython.complex) # <<<<<<<<<<<<<<
  10931. * @cython.locals(
  10932. * t=cython.double,
  10933. */
  10934. /* function exit code */
  10935. __pyx_L1_error:;
  10936. __Pyx_XDECREF(__pyx_t_1);
  10937. __Pyx_XDECREF(__pyx_t_2);
  10938. __Pyx_XDECREF(__pyx_t_3);
  10939. __Pyx_XDECREF(__pyx_t_4);
  10940. __Pyx_XDECREF(__pyx_t_5);
  10941. __Pyx_XDECREF(__pyx_t_6);
  10942. __Pyx_AddTraceback("fontTools.misc.bezierTools.splitCubicIntoTwoAtTC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10943. __pyx_r = NULL;
  10944. __pyx_L0:;
  10945. __Pyx_XGIVEREF(__pyx_r);
  10946. __Pyx_RefNannyFinishContext();
  10947. return __pyx_r;
  10948. }
  10949. /* "fontTools/misc/bezierTools.py":708
  10950. *
  10951. *
  10952. * def _splitQuadraticAtT(a, b, c, *ts): # <<<<<<<<<<<<<<
  10953. * ts = list(ts)
  10954. * segments = []
  10955. */
  10956. /* Python wrapper */
  10957. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_40_splitQuadraticAtT(PyObject *__pyx_self,
  10958. #if CYTHON_METH_FASTCALL
  10959. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  10960. #else
  10961. PyObject *__pyx_args, PyObject *__pyx_kwds
  10962. #endif
  10963. ); /*proto*/
  10964. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_39_splitQuadraticAtT, "_splitQuadraticAtT(a, b, c, *ts)");
  10965. 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};
  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. ) {
  10973. PyObject *__pyx_v_a = 0;
  10974. PyObject *__pyx_v_b = 0;
  10975. PyObject *__pyx_v_c = 0;
  10976. PyObject *__pyx_v_ts = 0;
  10977. #if !CYTHON_METH_FASTCALL
  10978. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  10979. #endif
  10980. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  10981. PyObject* values[3] = {0,0,0};
  10982. int __pyx_lineno = 0;
  10983. const char *__pyx_filename = NULL;
  10984. int __pyx_clineno = 0;
  10985. PyObject *__pyx_r = 0;
  10986. __Pyx_RefNannyDeclarations
  10987. __Pyx_RefNannySetupContext("_splitQuadraticAtT (wrapper)", 0);
  10988. #if !CYTHON_METH_FASTCALL
  10989. #if CYTHON_ASSUME_SAFE_SIZE
  10990. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  10991. #else
  10992. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  10993. #endif
  10994. #endif
  10995. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  10996. __pyx_v_ts = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 3, __pyx_nargs);
  10997. if (unlikely(!__pyx_v_ts)) {
  10998. __Pyx_RefNannyFinishContext();
  10999. return NULL;
  11000. }
  11001. __Pyx_GOTREF(__pyx_v_ts);
  11002. {
  11003. 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};
  11004. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  11005. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 708, __pyx_L3_error)
  11006. if (__pyx_kwds_len > 0) {
  11007. switch (__pyx_nargs) {
  11008. default:
  11009. case 3:
  11010. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  11011. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 708, __pyx_L3_error)
  11012. CYTHON_FALLTHROUGH;
  11013. case 2:
  11014. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  11015. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 708, __pyx_L3_error)
  11016. CYTHON_FALLTHROUGH;
  11017. case 1:
  11018. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  11019. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 708, __pyx_L3_error)
  11020. CYTHON_FALLTHROUGH;
  11021. case 0: break;
  11022. }
  11023. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  11024. const Py_ssize_t used_pos_args = (kwd_pos_args < 3) ? kwd_pos_args : 3;
  11025. 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)
  11026. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  11027. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_splitQuadraticAtT", 0, 3, 3, i); __PYX_ERR(0, 708, __pyx_L3_error) }
  11028. }
  11029. } else if (unlikely(__pyx_nargs < 3)) {
  11030. goto __pyx_L5_argtuple_error;
  11031. } else {
  11032. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  11033. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 708, __pyx_L3_error)
  11034. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  11035. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 708, __pyx_L3_error)
  11036. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  11037. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 708, __pyx_L3_error)
  11038. }
  11039. __pyx_v_a = values[0];
  11040. __pyx_v_b = values[1];
  11041. __pyx_v_c = values[2];
  11042. }
  11043. goto __pyx_L6_skip;
  11044. __pyx_L5_argtuple_error:;
  11045. __Pyx_RaiseArgtupleInvalid("_splitQuadraticAtT", 0, 3, 3, __pyx_nargs); __PYX_ERR(0, 708, __pyx_L3_error)
  11046. __pyx_L6_skip:;
  11047. goto __pyx_L4_argument_unpacking_done;
  11048. __pyx_L3_error:;
  11049. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  11050. Py_XDECREF(values[__pyx_temp]);
  11051. }
  11052. __Pyx_DECREF(__pyx_v_ts); __pyx_v_ts = 0;
  11053. __Pyx_AddTraceback("fontTools.misc.bezierTools._splitQuadraticAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11054. __Pyx_RefNannyFinishContext();
  11055. return NULL;
  11056. __pyx_L4_argument_unpacking_done:;
  11057. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_39_splitQuadraticAtT(__pyx_self, __pyx_v_a, __pyx_v_b, __pyx_v_c, __pyx_v_ts);
  11058. /* function exit code */
  11059. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  11060. Py_XDECREF(values[__pyx_temp]);
  11061. }
  11062. __Pyx_DECREF(__pyx_v_ts);
  11063. __Pyx_RefNannyFinishContext();
  11064. return __pyx_r;
  11065. }
  11066. 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) {
  11067. PyObject *__pyx_v_segments = NULL;
  11068. PyObject *__pyx_v_ax = NULL;
  11069. PyObject *__pyx_v_ay = NULL;
  11070. PyObject *__pyx_v_bx = NULL;
  11071. PyObject *__pyx_v_by = NULL;
  11072. PyObject *__pyx_v_cx = NULL;
  11073. PyObject *__pyx_v_cy = NULL;
  11074. PyObject *__pyx_v_i = NULL;
  11075. PyObject *__pyx_v_t1 = NULL;
  11076. PyObject *__pyx_v_t2 = NULL;
  11077. PyObject *__pyx_v_delta = NULL;
  11078. PyObject *__pyx_v_delta_2 = NULL;
  11079. PyObject *__pyx_v_a1x = NULL;
  11080. PyObject *__pyx_v_a1y = NULL;
  11081. PyObject *__pyx_v_b1x = NULL;
  11082. PyObject *__pyx_v_b1y = NULL;
  11083. PyObject *__pyx_v_t1_2 = NULL;
  11084. PyObject *__pyx_v_c1x = NULL;
  11085. PyObject *__pyx_v_c1y = NULL;
  11086. PyObject *__pyx_v_pt1 = NULL;
  11087. PyObject *__pyx_v_pt2 = NULL;
  11088. PyObject *__pyx_v_pt3 = NULL;
  11089. PyObject *__pyx_r = NULL;
  11090. __Pyx_RefNannyDeclarations
  11091. PyObject *__pyx_t_1 = NULL;
  11092. PyObject *__pyx_t_2 = NULL;
  11093. int __pyx_t_3;
  11094. PyObject *__pyx_t_4 = NULL;
  11095. PyObject *(*__pyx_t_5)(PyObject *);
  11096. Py_ssize_t __pyx_t_6;
  11097. size_t __pyx_t_7;
  11098. PyObject *(*__pyx_t_8)(PyObject *);
  11099. PyObject *__pyx_t_9 = NULL;
  11100. PyObject *__pyx_t_10 = NULL;
  11101. PyObject *__pyx_t_11 = NULL;
  11102. PyObject *__pyx_t_12 = NULL;
  11103. int __pyx_lineno = 0;
  11104. const char *__pyx_filename = NULL;
  11105. int __pyx_clineno = 0;
  11106. __Pyx_RefNannySetupContext("_splitQuadraticAtT", 0);
  11107. __Pyx_INCREF(__pyx_v_ts);
  11108. /* "fontTools/misc/bezierTools.py":709
  11109. *
  11110. * def _splitQuadraticAtT(a, b, c, *ts):
  11111. * ts = list(ts) # <<<<<<<<<<<<<<
  11112. * segments = []
  11113. * ts.insert(0, 0.0)
  11114. */
  11115. __pyx_t_1 = PySequence_List(__pyx_v_ts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 709, __pyx_L1_error)
  11116. __Pyx_GOTREF(__pyx_t_1);
  11117. __Pyx_DECREF_SET(__pyx_v_ts, __pyx_t_1);
  11118. __pyx_t_1 = 0;
  11119. /* "fontTools/misc/bezierTools.py":710
  11120. * def _splitQuadraticAtT(a, b, c, *ts):
  11121. * ts = list(ts)
  11122. * segments = [] # <<<<<<<<<<<<<<
  11123. * ts.insert(0, 0.0)
  11124. * ts.append(1.0)
  11125. */
  11126. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 710, __pyx_L1_error)
  11127. __Pyx_GOTREF(__pyx_t_1);
  11128. __pyx_v_segments = ((PyObject*)__pyx_t_1);
  11129. __pyx_t_1 = 0;
  11130. /* "fontTools/misc/bezierTools.py":711
  11131. * ts = list(ts)
  11132. * segments = []
  11133. * ts.insert(0, 0.0) # <<<<<<<<<<<<<<
  11134. * ts.append(1.0)
  11135. * ax, ay = a
  11136. */
  11137. __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)
  11138. __Pyx_GOTREF(__pyx_t_1);
  11139. __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)
  11140. __Pyx_GOTREF(__pyx_t_2);
  11141. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11142. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  11143. /* "fontTools/misc/bezierTools.py":712
  11144. * segments = []
  11145. * ts.insert(0, 0.0)
  11146. * ts.append(1.0) # <<<<<<<<<<<<<<
  11147. * ax, ay = a
  11148. * bx, by = b
  11149. */
  11150. __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)
  11151. /* "fontTools/misc/bezierTools.py":713
  11152. * ts.insert(0, 0.0)
  11153. * ts.append(1.0)
  11154. * ax, ay = a # <<<<<<<<<<<<<<
  11155. * bx, by = b
  11156. * cx, cy = c
  11157. */
  11158. if ((likely(PyTuple_CheckExact(__pyx_v_a))) || (PyList_CheckExact(__pyx_v_a))) {
  11159. PyObject* sequence = __pyx_v_a;
  11160. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  11161. if (unlikely(size != 2)) {
  11162. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  11163. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  11164. __PYX_ERR(0, 713, __pyx_L1_error)
  11165. }
  11166. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  11167. if (likely(PyTuple_CheckExact(sequence))) {
  11168. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  11169. __Pyx_INCREF(__pyx_t_2);
  11170. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  11171. __Pyx_INCREF(__pyx_t_1);
  11172. } else {
  11173. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  11174. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 713, __pyx_L1_error)
  11175. __Pyx_XGOTREF(__pyx_t_2);
  11176. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  11177. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 713, __pyx_L1_error)
  11178. __Pyx_XGOTREF(__pyx_t_1);
  11179. }
  11180. #else
  11181. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 713, __pyx_L1_error)
  11182. __Pyx_GOTREF(__pyx_t_2);
  11183. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 713, __pyx_L1_error)
  11184. __Pyx_GOTREF(__pyx_t_1);
  11185. #endif
  11186. } else {
  11187. Py_ssize_t index = -1;
  11188. __pyx_t_4 = PyObject_GetIter(__pyx_v_a); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 713, __pyx_L1_error)
  11189. __Pyx_GOTREF(__pyx_t_4);
  11190. __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
  11191. index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  11192. __Pyx_GOTREF(__pyx_t_2);
  11193. index = 1; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
  11194. __Pyx_GOTREF(__pyx_t_1);
  11195. if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < (0)) __PYX_ERR(0, 713, __pyx_L1_error)
  11196. __pyx_t_5 = NULL;
  11197. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  11198. goto __pyx_L4_unpacking_done;
  11199. __pyx_L3_unpacking_failed:;
  11200. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  11201. __pyx_t_5 = NULL;
  11202. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  11203. __PYX_ERR(0, 713, __pyx_L1_error)
  11204. __pyx_L4_unpacking_done:;
  11205. }
  11206. __pyx_v_ax = __pyx_t_2;
  11207. __pyx_t_2 = 0;
  11208. __pyx_v_ay = __pyx_t_1;
  11209. __pyx_t_1 = 0;
  11210. /* "fontTools/misc/bezierTools.py":714
  11211. * ts.append(1.0)
  11212. * ax, ay = a
  11213. * bx, by = b # <<<<<<<<<<<<<<
  11214. * cx, cy = c
  11215. * for i in range(len(ts) - 1):
  11216. */
  11217. if ((likely(PyTuple_CheckExact(__pyx_v_b))) || (PyList_CheckExact(__pyx_v_b))) {
  11218. PyObject* sequence = __pyx_v_b;
  11219. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  11220. if (unlikely(size != 2)) {
  11221. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  11222. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  11223. __PYX_ERR(0, 714, __pyx_L1_error)
  11224. }
  11225. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  11226. if (likely(PyTuple_CheckExact(sequence))) {
  11227. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  11228. __Pyx_INCREF(__pyx_t_1);
  11229. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  11230. __Pyx_INCREF(__pyx_t_2);
  11231. } else {
  11232. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  11233. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 714, __pyx_L1_error)
  11234. __Pyx_XGOTREF(__pyx_t_1);
  11235. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  11236. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 714, __pyx_L1_error)
  11237. __Pyx_XGOTREF(__pyx_t_2);
  11238. }
  11239. #else
  11240. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 714, __pyx_L1_error)
  11241. __Pyx_GOTREF(__pyx_t_1);
  11242. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 714, __pyx_L1_error)
  11243. __Pyx_GOTREF(__pyx_t_2);
  11244. #endif
  11245. } else {
  11246. Py_ssize_t index = -1;
  11247. __pyx_t_4 = PyObject_GetIter(__pyx_v_b); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 714, __pyx_L1_error)
  11248. __Pyx_GOTREF(__pyx_t_4);
  11249. __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
  11250. index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
  11251. __Pyx_GOTREF(__pyx_t_1);
  11252. index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
  11253. __Pyx_GOTREF(__pyx_t_2);
  11254. if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < (0)) __PYX_ERR(0, 714, __pyx_L1_error)
  11255. __pyx_t_5 = NULL;
  11256. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  11257. goto __pyx_L6_unpacking_done;
  11258. __pyx_L5_unpacking_failed:;
  11259. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  11260. __pyx_t_5 = NULL;
  11261. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  11262. __PYX_ERR(0, 714, __pyx_L1_error)
  11263. __pyx_L6_unpacking_done:;
  11264. }
  11265. __pyx_v_bx = __pyx_t_1;
  11266. __pyx_t_1 = 0;
  11267. __pyx_v_by = __pyx_t_2;
  11268. __pyx_t_2 = 0;
  11269. /* "fontTools/misc/bezierTools.py":715
  11270. * ax, ay = a
  11271. * bx, by = b
  11272. * cx, cy = c # <<<<<<<<<<<<<<
  11273. * for i in range(len(ts) - 1):
  11274. * t1 = ts[i]
  11275. */
  11276. if ((likely(PyTuple_CheckExact(__pyx_v_c))) || (PyList_CheckExact(__pyx_v_c))) {
  11277. PyObject* sequence = __pyx_v_c;
  11278. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  11279. if (unlikely(size != 2)) {
  11280. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  11281. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  11282. __PYX_ERR(0, 715, __pyx_L1_error)
  11283. }
  11284. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  11285. if (likely(PyTuple_CheckExact(sequence))) {
  11286. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  11287. __Pyx_INCREF(__pyx_t_2);
  11288. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  11289. __Pyx_INCREF(__pyx_t_1);
  11290. } else {
  11291. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  11292. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 715, __pyx_L1_error)
  11293. __Pyx_XGOTREF(__pyx_t_2);
  11294. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  11295. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 715, __pyx_L1_error)
  11296. __Pyx_XGOTREF(__pyx_t_1);
  11297. }
  11298. #else
  11299. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 715, __pyx_L1_error)
  11300. __Pyx_GOTREF(__pyx_t_2);
  11301. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 715, __pyx_L1_error)
  11302. __Pyx_GOTREF(__pyx_t_1);
  11303. #endif
  11304. } else {
  11305. Py_ssize_t index = -1;
  11306. __pyx_t_4 = PyObject_GetIter(__pyx_v_c); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 715, __pyx_L1_error)
  11307. __Pyx_GOTREF(__pyx_t_4);
  11308. __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
  11309. index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
  11310. __Pyx_GOTREF(__pyx_t_2);
  11311. index = 1; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
  11312. __Pyx_GOTREF(__pyx_t_1);
  11313. if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < (0)) __PYX_ERR(0, 715, __pyx_L1_error)
  11314. __pyx_t_5 = NULL;
  11315. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  11316. goto __pyx_L8_unpacking_done;
  11317. __pyx_L7_unpacking_failed:;
  11318. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  11319. __pyx_t_5 = NULL;
  11320. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  11321. __PYX_ERR(0, 715, __pyx_L1_error)
  11322. __pyx_L8_unpacking_done:;
  11323. }
  11324. __pyx_v_cx = __pyx_t_2;
  11325. __pyx_t_2 = 0;
  11326. __pyx_v_cy = __pyx_t_1;
  11327. __pyx_t_1 = 0;
  11328. /* "fontTools/misc/bezierTools.py":716
  11329. * bx, by = b
  11330. * cx, cy = c
  11331. * for i in range(len(ts) - 1): # <<<<<<<<<<<<<<
  11332. * t1 = ts[i]
  11333. * t2 = ts[i + 1]
  11334. */
  11335. __pyx_t_2 = NULL;
  11336. __pyx_t_6 = PyObject_Length(__pyx_v_ts); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 716, __pyx_L1_error)
  11337. __pyx_t_4 = PyLong_FromSsize_t((__pyx_t_6 - 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 716, __pyx_L1_error)
  11338. __Pyx_GOTREF(__pyx_t_4);
  11339. __pyx_t_7 = 1;
  11340. {
  11341. PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
  11342. __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));
  11343. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  11344. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  11345. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 716, __pyx_L1_error)
  11346. __Pyx_GOTREF(__pyx_t_1);
  11347. }
  11348. __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 716, __pyx_L1_error)
  11349. __Pyx_GOTREF(__pyx_t_4);
  11350. __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)
  11351. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11352. for (;;) {
  11353. {
  11354. __pyx_t_1 = __pyx_t_8(__pyx_t_4);
  11355. if (unlikely(!__pyx_t_1)) {
  11356. PyObject* exc_type = PyErr_Occurred();
  11357. if (exc_type) {
  11358. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 716, __pyx_L1_error)
  11359. PyErr_Clear();
  11360. }
  11361. break;
  11362. }
  11363. }
  11364. __Pyx_GOTREF(__pyx_t_1);
  11365. __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
  11366. __pyx_t_1 = 0;
  11367. /* "fontTools/misc/bezierTools.py":717
  11368. * cx, cy = c
  11369. * for i in range(len(ts) - 1):
  11370. * t1 = ts[i] # <<<<<<<<<<<<<<
  11371. * t2 = ts[i + 1]
  11372. * delta = t2 - t1
  11373. */
  11374. __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_ts, __pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 717, __pyx_L1_error)
  11375. __Pyx_GOTREF(__pyx_t_1);
  11376. __Pyx_XDECREF_SET(__pyx_v_t1, __pyx_t_1);
  11377. __pyx_t_1 = 0;
  11378. /* "fontTools/misc/bezierTools.py":718
  11379. * for i in range(len(ts) - 1):
  11380. * t1 = ts[i]
  11381. * t2 = ts[i + 1] # <<<<<<<<<<<<<<
  11382. * delta = t2 - t1
  11383. * # calc new a, b and c
  11384. */
  11385. __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)
  11386. __Pyx_GOTREF(__pyx_t_1);
  11387. __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_ts, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 718, __pyx_L1_error)
  11388. __Pyx_GOTREF(__pyx_t_2);
  11389. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11390. __Pyx_XDECREF_SET(__pyx_v_t2, __pyx_t_2);
  11391. __pyx_t_2 = 0;
  11392. /* "fontTools/misc/bezierTools.py":719
  11393. * t1 = ts[i]
  11394. * t2 = ts[i + 1]
  11395. * delta = t2 - t1 # <<<<<<<<<<<<<<
  11396. * # calc new a, b and c
  11397. * delta_2 = delta * delta
  11398. */
  11399. __pyx_t_2 = PyNumber_Subtract(__pyx_v_t2, __pyx_v_t1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 719, __pyx_L1_error)
  11400. __Pyx_GOTREF(__pyx_t_2);
  11401. __Pyx_XDECREF_SET(__pyx_v_delta, __pyx_t_2);
  11402. __pyx_t_2 = 0;
  11403. /* "fontTools/misc/bezierTools.py":721
  11404. * delta = t2 - t1
  11405. * # calc new a, b and c
  11406. * delta_2 = delta * delta # <<<<<<<<<<<<<<
  11407. * a1x = ax * delta_2
  11408. * a1y = ay * delta_2
  11409. */
  11410. __pyx_t_2 = PyNumber_Multiply(__pyx_v_delta, __pyx_v_delta); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 721, __pyx_L1_error)
  11411. __Pyx_GOTREF(__pyx_t_2);
  11412. __Pyx_XDECREF_SET(__pyx_v_delta_2, __pyx_t_2);
  11413. __pyx_t_2 = 0;
  11414. /* "fontTools/misc/bezierTools.py":722
  11415. * # calc new a, b and c
  11416. * delta_2 = delta * delta
  11417. * a1x = ax * delta_2 # <<<<<<<<<<<<<<
  11418. * a1y = ay * delta_2
  11419. * b1x = (2 * ax * t1 + bx) * delta
  11420. */
  11421. __pyx_t_2 = PyNumber_Multiply(__pyx_v_ax, __pyx_v_delta_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 722, __pyx_L1_error)
  11422. __Pyx_GOTREF(__pyx_t_2);
  11423. __Pyx_XDECREF_SET(__pyx_v_a1x, __pyx_t_2);
  11424. __pyx_t_2 = 0;
  11425. /* "fontTools/misc/bezierTools.py":723
  11426. * delta_2 = delta * delta
  11427. * a1x = ax * delta_2
  11428. * a1y = ay * delta_2 # <<<<<<<<<<<<<<
  11429. * b1x = (2 * ax * t1 + bx) * delta
  11430. * b1y = (2 * ay * t1 + by) * delta
  11431. */
  11432. __pyx_t_2 = PyNumber_Multiply(__pyx_v_ay, __pyx_v_delta_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 723, __pyx_L1_error)
  11433. __Pyx_GOTREF(__pyx_t_2);
  11434. __Pyx_XDECREF_SET(__pyx_v_a1y, __pyx_t_2);
  11435. __pyx_t_2 = 0;
  11436. /* "fontTools/misc/bezierTools.py":724
  11437. * a1x = ax * delta_2
  11438. * a1y = ay * delta_2
  11439. * b1x = (2 * ax * t1 + bx) * delta # <<<<<<<<<<<<<<
  11440. * b1y = (2 * ay * t1 + by) * delta
  11441. * t1_2 = t1 * t1
  11442. */
  11443. __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)
  11444. __Pyx_GOTREF(__pyx_t_2);
  11445. __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_v_t1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error)
  11446. __Pyx_GOTREF(__pyx_t_1);
  11447. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  11448. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_bx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error)
  11449. __Pyx_GOTREF(__pyx_t_2);
  11450. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11451. __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_v_delta); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error)
  11452. __Pyx_GOTREF(__pyx_t_1);
  11453. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  11454. __Pyx_XDECREF_SET(__pyx_v_b1x, __pyx_t_1);
  11455. __pyx_t_1 = 0;
  11456. /* "fontTools/misc/bezierTools.py":725
  11457. * a1y = ay * delta_2
  11458. * b1x = (2 * ax * t1 + bx) * delta
  11459. * b1y = (2 * ay * t1 + by) * delta # <<<<<<<<<<<<<<
  11460. * t1_2 = t1 * t1
  11461. * c1x = ax * t1_2 + bx * t1 + cx
  11462. */
  11463. __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)
  11464. __Pyx_GOTREF(__pyx_t_1);
  11465. __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_t1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 725, __pyx_L1_error)
  11466. __Pyx_GOTREF(__pyx_t_2);
  11467. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11468. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_by); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 725, __pyx_L1_error)
  11469. __Pyx_GOTREF(__pyx_t_1);
  11470. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  11471. __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_delta); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 725, __pyx_L1_error)
  11472. __Pyx_GOTREF(__pyx_t_2);
  11473. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11474. __Pyx_XDECREF_SET(__pyx_v_b1y, __pyx_t_2);
  11475. __pyx_t_2 = 0;
  11476. /* "fontTools/misc/bezierTools.py":726
  11477. * b1x = (2 * ax * t1 + bx) * delta
  11478. * b1y = (2 * ay * t1 + by) * delta
  11479. * t1_2 = t1 * t1 # <<<<<<<<<<<<<<
  11480. * c1x = ax * t1_2 + bx * t1 + cx
  11481. * c1y = ay * t1_2 + by * t1 + cy
  11482. */
  11483. __pyx_t_2 = PyNumber_Multiply(__pyx_v_t1, __pyx_v_t1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 726, __pyx_L1_error)
  11484. __Pyx_GOTREF(__pyx_t_2);
  11485. __Pyx_XDECREF_SET(__pyx_v_t1_2, __pyx_t_2);
  11486. __pyx_t_2 = 0;
  11487. /* "fontTools/misc/bezierTools.py":727
  11488. * b1y = (2 * ay * t1 + by) * delta
  11489. * t1_2 = t1 * t1
  11490. * c1x = ax * t1_2 + bx * t1 + cx # <<<<<<<<<<<<<<
  11491. * c1y = ay * t1_2 + by * t1 + cy
  11492. *
  11493. */
  11494. __pyx_t_2 = PyNumber_Multiply(__pyx_v_ax, __pyx_v_t1_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 727, __pyx_L1_error)
  11495. __Pyx_GOTREF(__pyx_t_2);
  11496. __pyx_t_1 = PyNumber_Multiply(__pyx_v_bx, __pyx_v_t1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 727, __pyx_L1_error)
  11497. __Pyx_GOTREF(__pyx_t_1);
  11498. __pyx_t_9 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 727, __pyx_L1_error)
  11499. __Pyx_GOTREF(__pyx_t_9);
  11500. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  11501. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11502. __pyx_t_1 = PyNumber_Add(__pyx_t_9, __pyx_v_cx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 727, __pyx_L1_error)
  11503. __Pyx_GOTREF(__pyx_t_1);
  11504. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  11505. __Pyx_XDECREF_SET(__pyx_v_c1x, __pyx_t_1);
  11506. __pyx_t_1 = 0;
  11507. /* "fontTools/misc/bezierTools.py":728
  11508. * t1_2 = t1 * t1
  11509. * c1x = ax * t1_2 + bx * t1 + cx
  11510. * c1y = ay * t1_2 + by * t1 + cy # <<<<<<<<<<<<<<
  11511. *
  11512. * pt1, pt2, pt3 = calcQuadraticPoints((a1x, a1y), (b1x, b1y), (c1x, c1y))
  11513. */
  11514. __pyx_t_1 = PyNumber_Multiply(__pyx_v_ay, __pyx_v_t1_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 728, __pyx_L1_error)
  11515. __Pyx_GOTREF(__pyx_t_1);
  11516. __pyx_t_9 = PyNumber_Multiply(__pyx_v_by, __pyx_v_t1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 728, __pyx_L1_error)
  11517. __Pyx_GOTREF(__pyx_t_9);
  11518. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 728, __pyx_L1_error)
  11519. __Pyx_GOTREF(__pyx_t_2);
  11520. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11521. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  11522. __pyx_t_9 = PyNumber_Add(__pyx_t_2, __pyx_v_cy); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 728, __pyx_L1_error)
  11523. __Pyx_GOTREF(__pyx_t_9);
  11524. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  11525. __Pyx_XDECREF_SET(__pyx_v_c1y, __pyx_t_9);
  11526. __pyx_t_9 = 0;
  11527. /* "fontTools/misc/bezierTools.py":730
  11528. * c1y = ay * t1_2 + by * t1 + cy
  11529. *
  11530. * pt1, pt2, pt3 = calcQuadraticPoints((a1x, a1y), (b1x, b1y), (c1x, c1y)) # <<<<<<<<<<<<<<
  11531. * segments.append((pt1, pt2, pt3))
  11532. * return segments
  11533. */
  11534. __pyx_t_2 = NULL;
  11535. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_calcQuadraticPoints); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 730, __pyx_L1_error)
  11536. __Pyx_GOTREF(__pyx_t_1);
  11537. __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 730, __pyx_L1_error)
  11538. __Pyx_GOTREF(__pyx_t_10);
  11539. __Pyx_INCREF(__pyx_v_a1x);
  11540. __Pyx_GIVEREF(__pyx_v_a1x);
  11541. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_a1x) != (0)) __PYX_ERR(0, 730, __pyx_L1_error);
  11542. __Pyx_INCREF(__pyx_v_a1y);
  11543. __Pyx_GIVEREF(__pyx_v_a1y);
  11544. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_a1y) != (0)) __PYX_ERR(0, 730, __pyx_L1_error);
  11545. __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 730, __pyx_L1_error)
  11546. __Pyx_GOTREF(__pyx_t_11);
  11547. __Pyx_INCREF(__pyx_v_b1x);
  11548. __Pyx_GIVEREF(__pyx_v_b1x);
  11549. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_b1x) != (0)) __PYX_ERR(0, 730, __pyx_L1_error);
  11550. __Pyx_INCREF(__pyx_v_b1y);
  11551. __Pyx_GIVEREF(__pyx_v_b1y);
  11552. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_b1y) != (0)) __PYX_ERR(0, 730, __pyx_L1_error);
  11553. __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 730, __pyx_L1_error)
  11554. __Pyx_GOTREF(__pyx_t_12);
  11555. __Pyx_INCREF(__pyx_v_c1x);
  11556. __Pyx_GIVEREF(__pyx_v_c1x);
  11557. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_c1x) != (0)) __PYX_ERR(0, 730, __pyx_L1_error);
  11558. __Pyx_INCREF(__pyx_v_c1y);
  11559. __Pyx_GIVEREF(__pyx_v_c1y);
  11560. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_c1y) != (0)) __PYX_ERR(0, 730, __pyx_L1_error);
  11561. __pyx_t_7 = 1;
  11562. #if CYTHON_UNPACK_METHODS
  11563. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  11564. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
  11565. assert(__pyx_t_2);
  11566. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  11567. __Pyx_INCREF(__pyx_t_2);
  11568. __Pyx_INCREF(__pyx__function);
  11569. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  11570. __pyx_t_7 = 0;
  11571. }
  11572. #endif
  11573. {
  11574. PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_t_10, __pyx_t_11, __pyx_t_12};
  11575. __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));
  11576. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  11577. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  11578. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  11579. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  11580. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11581. if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 730, __pyx_L1_error)
  11582. __Pyx_GOTREF(__pyx_t_9);
  11583. }
  11584. if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
  11585. PyObject* sequence = __pyx_t_9;
  11586. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  11587. if (unlikely(size != 3)) {
  11588. if (size > 3) __Pyx_RaiseTooManyValuesError(3);
  11589. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  11590. __PYX_ERR(0, 730, __pyx_L1_error)
  11591. }
  11592. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  11593. if (likely(PyTuple_CheckExact(sequence))) {
  11594. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  11595. __Pyx_INCREF(__pyx_t_1);
  11596. __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1);
  11597. __Pyx_INCREF(__pyx_t_12);
  11598. __pyx_t_11 = PyTuple_GET_ITEM(sequence, 2);
  11599. __Pyx_INCREF(__pyx_t_11);
  11600. } else {
  11601. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  11602. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 730, __pyx_L1_error)
  11603. __Pyx_XGOTREF(__pyx_t_1);
  11604. __pyx_t_12 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  11605. if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 730, __pyx_L1_error)
  11606. __Pyx_XGOTREF(__pyx_t_12);
  11607. __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  11608. if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 730, __pyx_L1_error)
  11609. __Pyx_XGOTREF(__pyx_t_11);
  11610. }
  11611. #else
  11612. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 730, __pyx_L1_error)
  11613. __Pyx_GOTREF(__pyx_t_1);
  11614. __pyx_t_12 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 730, __pyx_L1_error)
  11615. __Pyx_GOTREF(__pyx_t_12);
  11616. __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 730, __pyx_L1_error)
  11617. __Pyx_GOTREF(__pyx_t_11);
  11618. #endif
  11619. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  11620. } else {
  11621. Py_ssize_t index = -1;
  11622. __pyx_t_10 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 730, __pyx_L1_error)
  11623. __Pyx_GOTREF(__pyx_t_10);
  11624. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  11625. __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
  11626. index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_10); if (unlikely(!__pyx_t_1)) goto __pyx_L11_unpacking_failed;
  11627. __Pyx_GOTREF(__pyx_t_1);
  11628. index = 1; __pyx_t_12 = __pyx_t_5(__pyx_t_10); if (unlikely(!__pyx_t_12)) goto __pyx_L11_unpacking_failed;
  11629. __Pyx_GOTREF(__pyx_t_12);
  11630. index = 2; __pyx_t_11 = __pyx_t_5(__pyx_t_10); if (unlikely(!__pyx_t_11)) goto __pyx_L11_unpacking_failed;
  11631. __Pyx_GOTREF(__pyx_t_11);
  11632. if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_10), 3) < (0)) __PYX_ERR(0, 730, __pyx_L1_error)
  11633. __pyx_t_5 = NULL;
  11634. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  11635. goto __pyx_L12_unpacking_done;
  11636. __pyx_L11_unpacking_failed:;
  11637. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  11638. __pyx_t_5 = NULL;
  11639. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  11640. __PYX_ERR(0, 730, __pyx_L1_error)
  11641. __pyx_L12_unpacking_done:;
  11642. }
  11643. __Pyx_XDECREF_SET(__pyx_v_pt1, __pyx_t_1);
  11644. __pyx_t_1 = 0;
  11645. __Pyx_XDECREF_SET(__pyx_v_pt2, __pyx_t_12);
  11646. __pyx_t_12 = 0;
  11647. __Pyx_XDECREF_SET(__pyx_v_pt3, __pyx_t_11);
  11648. __pyx_t_11 = 0;
  11649. /* "fontTools/misc/bezierTools.py":731
  11650. *
  11651. * pt1, pt2, pt3 = calcQuadraticPoints((a1x, a1y), (b1x, b1y), (c1x, c1y))
  11652. * segments.append((pt1, pt2, pt3)) # <<<<<<<<<<<<<<
  11653. * return segments
  11654. *
  11655. */
  11656. __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 731, __pyx_L1_error)
  11657. __Pyx_GOTREF(__pyx_t_9);
  11658. __Pyx_INCREF(__pyx_v_pt1);
  11659. __Pyx_GIVEREF(__pyx_v_pt1);
  11660. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_pt1) != (0)) __PYX_ERR(0, 731, __pyx_L1_error);
  11661. __Pyx_INCREF(__pyx_v_pt2);
  11662. __Pyx_GIVEREF(__pyx_v_pt2);
  11663. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_pt2) != (0)) __PYX_ERR(0, 731, __pyx_L1_error);
  11664. __Pyx_INCREF(__pyx_v_pt3);
  11665. __Pyx_GIVEREF(__pyx_v_pt3);
  11666. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_v_pt3) != (0)) __PYX_ERR(0, 731, __pyx_L1_error);
  11667. __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)
  11668. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  11669. /* "fontTools/misc/bezierTools.py":716
  11670. * bx, by = b
  11671. * cx, cy = c
  11672. * for i in range(len(ts) - 1): # <<<<<<<<<<<<<<
  11673. * t1 = ts[i]
  11674. * t2 = ts[i + 1]
  11675. */
  11676. }
  11677. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  11678. /* "fontTools/misc/bezierTools.py":732
  11679. * pt1, pt2, pt3 = calcQuadraticPoints((a1x, a1y), (b1x, b1y), (c1x, c1y))
  11680. * segments.append((pt1, pt2, pt3))
  11681. * return segments # <<<<<<<<<<<<<<
  11682. *
  11683. *
  11684. */
  11685. __Pyx_XDECREF(__pyx_r);
  11686. __Pyx_INCREF(__pyx_v_segments);
  11687. __pyx_r = __pyx_v_segments;
  11688. goto __pyx_L0;
  11689. /* "fontTools/misc/bezierTools.py":708
  11690. *
  11691. *
  11692. * def _splitQuadraticAtT(a, b, c, *ts): # <<<<<<<<<<<<<<
  11693. * ts = list(ts)
  11694. * segments = []
  11695. */
  11696. /* function exit code */
  11697. __pyx_L1_error:;
  11698. __Pyx_XDECREF(__pyx_t_1);
  11699. __Pyx_XDECREF(__pyx_t_2);
  11700. __Pyx_XDECREF(__pyx_t_4);
  11701. __Pyx_XDECREF(__pyx_t_9);
  11702. __Pyx_XDECREF(__pyx_t_10);
  11703. __Pyx_XDECREF(__pyx_t_11);
  11704. __Pyx_XDECREF(__pyx_t_12);
  11705. __Pyx_AddTraceback("fontTools.misc.bezierTools._splitQuadraticAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11706. __pyx_r = NULL;
  11707. __pyx_L0:;
  11708. __Pyx_XDECREF(__pyx_v_ts);
  11709. __Pyx_XDECREF(__pyx_v_segments);
  11710. __Pyx_XDECREF(__pyx_v_ax);
  11711. __Pyx_XDECREF(__pyx_v_ay);
  11712. __Pyx_XDECREF(__pyx_v_bx);
  11713. __Pyx_XDECREF(__pyx_v_by);
  11714. __Pyx_XDECREF(__pyx_v_cx);
  11715. __Pyx_XDECREF(__pyx_v_cy);
  11716. __Pyx_XDECREF(__pyx_v_i);
  11717. __Pyx_XDECREF(__pyx_v_t1);
  11718. __Pyx_XDECREF(__pyx_v_t2);
  11719. __Pyx_XDECREF(__pyx_v_delta);
  11720. __Pyx_XDECREF(__pyx_v_delta_2);
  11721. __Pyx_XDECREF(__pyx_v_a1x);
  11722. __Pyx_XDECREF(__pyx_v_a1y);
  11723. __Pyx_XDECREF(__pyx_v_b1x);
  11724. __Pyx_XDECREF(__pyx_v_b1y);
  11725. __Pyx_XDECREF(__pyx_v_t1_2);
  11726. __Pyx_XDECREF(__pyx_v_c1x);
  11727. __Pyx_XDECREF(__pyx_v_c1y);
  11728. __Pyx_XDECREF(__pyx_v_pt1);
  11729. __Pyx_XDECREF(__pyx_v_pt2);
  11730. __Pyx_XDECREF(__pyx_v_pt3);
  11731. __Pyx_XGIVEREF(__pyx_r);
  11732. __Pyx_RefNannyFinishContext();
  11733. return __pyx_r;
  11734. }
  11735. /* "fontTools/misc/bezierTools.py":735
  11736. *
  11737. *
  11738. * def _splitCubicAtT(a, b, c, d, *ts): # <<<<<<<<<<<<<<
  11739. * ts = list(ts)
  11740. * ts.insert(0, 0.0)
  11741. */
  11742. /* Python wrapper */
  11743. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_42_splitCubicAtT(PyObject *__pyx_self,
  11744. #if CYTHON_METH_FASTCALL
  11745. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  11746. #else
  11747. PyObject *__pyx_args, PyObject *__pyx_kwds
  11748. #endif
  11749. ); /*proto*/
  11750. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_41_splitCubicAtT, "_splitCubicAtT(a, b, c, d, *ts)");
  11751. 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};
  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. ) {
  11759. PyObject *__pyx_v_a = 0;
  11760. PyObject *__pyx_v_b = 0;
  11761. PyObject *__pyx_v_c = 0;
  11762. PyObject *__pyx_v_d = 0;
  11763. PyObject *__pyx_v_ts = 0;
  11764. #if !CYTHON_METH_FASTCALL
  11765. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  11766. #endif
  11767. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  11768. PyObject* values[4] = {0,0,0,0};
  11769. int __pyx_lineno = 0;
  11770. const char *__pyx_filename = NULL;
  11771. int __pyx_clineno = 0;
  11772. PyObject *__pyx_r = 0;
  11773. __Pyx_RefNannyDeclarations
  11774. __Pyx_RefNannySetupContext("_splitCubicAtT (wrapper)", 0);
  11775. #if !CYTHON_METH_FASTCALL
  11776. #if CYTHON_ASSUME_SAFE_SIZE
  11777. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  11778. #else
  11779. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  11780. #endif
  11781. #endif
  11782. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  11783. __pyx_v_ts = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 4, __pyx_nargs);
  11784. if (unlikely(!__pyx_v_ts)) {
  11785. __Pyx_RefNannyFinishContext();
  11786. return NULL;
  11787. }
  11788. __Pyx_GOTREF(__pyx_v_ts);
  11789. {
  11790. 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};
  11791. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  11792. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 735, __pyx_L3_error)
  11793. if (__pyx_kwds_len > 0) {
  11794. switch (__pyx_nargs) {
  11795. default:
  11796. case 4:
  11797. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  11798. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 735, __pyx_L3_error)
  11799. CYTHON_FALLTHROUGH;
  11800. case 3:
  11801. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  11802. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 735, __pyx_L3_error)
  11803. CYTHON_FALLTHROUGH;
  11804. case 2:
  11805. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  11806. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 735, __pyx_L3_error)
  11807. CYTHON_FALLTHROUGH;
  11808. case 1:
  11809. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  11810. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 735, __pyx_L3_error)
  11811. CYTHON_FALLTHROUGH;
  11812. case 0: break;
  11813. }
  11814. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  11815. const Py_ssize_t used_pos_args = (kwd_pos_args < 4) ? kwd_pos_args : 4;
  11816. 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)
  11817. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  11818. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_splitCubicAtT", 0, 4, 4, i); __PYX_ERR(0, 735, __pyx_L3_error) }
  11819. }
  11820. } else if (unlikely(__pyx_nargs < 4)) {
  11821. goto __pyx_L5_argtuple_error;
  11822. } else {
  11823. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  11824. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 735, __pyx_L3_error)
  11825. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  11826. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 735, __pyx_L3_error)
  11827. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  11828. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 735, __pyx_L3_error)
  11829. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  11830. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 735, __pyx_L3_error)
  11831. }
  11832. __pyx_v_a = values[0];
  11833. __pyx_v_b = values[1];
  11834. __pyx_v_c = values[2];
  11835. __pyx_v_d = values[3];
  11836. }
  11837. goto __pyx_L6_skip;
  11838. __pyx_L5_argtuple_error:;
  11839. __Pyx_RaiseArgtupleInvalid("_splitCubicAtT", 0, 4, 4, __pyx_nargs); __PYX_ERR(0, 735, __pyx_L3_error)
  11840. __pyx_L6_skip:;
  11841. goto __pyx_L4_argument_unpacking_done;
  11842. __pyx_L3_error:;
  11843. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  11844. Py_XDECREF(values[__pyx_temp]);
  11845. }
  11846. __Pyx_DECREF(__pyx_v_ts); __pyx_v_ts = 0;
  11847. __Pyx_AddTraceback("fontTools.misc.bezierTools._splitCubicAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11848. __Pyx_RefNannyFinishContext();
  11849. return NULL;
  11850. __pyx_L4_argument_unpacking_done:;
  11851. __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);
  11852. /* function exit code */
  11853. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  11854. Py_XDECREF(values[__pyx_temp]);
  11855. }
  11856. __Pyx_DECREF(__pyx_v_ts);
  11857. __Pyx_RefNannyFinishContext();
  11858. return __pyx_r;
  11859. }
  11860. 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) {
  11861. PyObject *__pyx_v_segments = NULL;
  11862. PyObject *__pyx_v_ax = NULL;
  11863. PyObject *__pyx_v_ay = NULL;
  11864. PyObject *__pyx_v_bx = NULL;
  11865. PyObject *__pyx_v_by = NULL;
  11866. PyObject *__pyx_v_cx = NULL;
  11867. PyObject *__pyx_v_cy = NULL;
  11868. PyObject *__pyx_v_dx = NULL;
  11869. PyObject *__pyx_v_dy = NULL;
  11870. PyObject *__pyx_v_i = NULL;
  11871. PyObject *__pyx_v_t1 = NULL;
  11872. PyObject *__pyx_v_t2 = NULL;
  11873. PyObject *__pyx_v_delta = NULL;
  11874. PyObject *__pyx_v_delta_2 = NULL;
  11875. PyObject *__pyx_v_delta_3 = NULL;
  11876. PyObject *__pyx_v_t1_2 = NULL;
  11877. PyObject *__pyx_v_t1_3 = NULL;
  11878. PyObject *__pyx_v_a1x = NULL;
  11879. PyObject *__pyx_v_a1y = NULL;
  11880. PyObject *__pyx_v_b1x = NULL;
  11881. PyObject *__pyx_v_b1y = NULL;
  11882. PyObject *__pyx_v_c1x = NULL;
  11883. PyObject *__pyx_v_c1y = NULL;
  11884. PyObject *__pyx_v_d1x = NULL;
  11885. PyObject *__pyx_v_d1y = NULL;
  11886. PyObject *__pyx_v_pt1 = NULL;
  11887. PyObject *__pyx_v_pt2 = NULL;
  11888. PyObject *__pyx_v_pt3 = NULL;
  11889. PyObject *__pyx_v_pt4 = NULL;
  11890. PyObject *__pyx_r = NULL;
  11891. __Pyx_RefNannyDeclarations
  11892. PyObject *__pyx_t_1 = NULL;
  11893. PyObject *__pyx_t_2 = NULL;
  11894. int __pyx_t_3;
  11895. PyObject *__pyx_t_4 = NULL;
  11896. PyObject *(*__pyx_t_5)(PyObject *);
  11897. Py_ssize_t __pyx_t_6;
  11898. size_t __pyx_t_7;
  11899. PyObject *(*__pyx_t_8)(PyObject *);
  11900. PyObject *__pyx_t_9 = NULL;
  11901. PyObject *__pyx_t_10 = NULL;
  11902. PyObject *__pyx_t_11 = NULL;
  11903. PyObject *__pyx_t_12 = NULL;
  11904. PyObject *__pyx_t_13 = NULL;
  11905. int __pyx_lineno = 0;
  11906. const char *__pyx_filename = NULL;
  11907. int __pyx_clineno = 0;
  11908. __Pyx_RefNannySetupContext("_splitCubicAtT", 0);
  11909. __Pyx_INCREF(__pyx_v_ts);
  11910. /* "fontTools/misc/bezierTools.py":736
  11911. *
  11912. * def _splitCubicAtT(a, b, c, d, *ts):
  11913. * ts = list(ts) # <<<<<<<<<<<<<<
  11914. * ts.insert(0, 0.0)
  11915. * ts.append(1.0)
  11916. */
  11917. __pyx_t_1 = PySequence_List(__pyx_v_ts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 736, __pyx_L1_error)
  11918. __Pyx_GOTREF(__pyx_t_1);
  11919. __Pyx_DECREF_SET(__pyx_v_ts, __pyx_t_1);
  11920. __pyx_t_1 = 0;
  11921. /* "fontTools/misc/bezierTools.py":737
  11922. * def _splitCubicAtT(a, b, c, d, *ts):
  11923. * ts = list(ts)
  11924. * ts.insert(0, 0.0) # <<<<<<<<<<<<<<
  11925. * ts.append(1.0)
  11926. * segments = []
  11927. */
  11928. __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)
  11929. __Pyx_GOTREF(__pyx_t_1);
  11930. __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)
  11931. __Pyx_GOTREF(__pyx_t_2);
  11932. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11933. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  11934. /* "fontTools/misc/bezierTools.py":738
  11935. * ts = list(ts)
  11936. * ts.insert(0, 0.0)
  11937. * ts.append(1.0) # <<<<<<<<<<<<<<
  11938. * segments = []
  11939. * ax, ay = a
  11940. */
  11941. __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)
  11942. /* "fontTools/misc/bezierTools.py":739
  11943. * ts.insert(0, 0.0)
  11944. * ts.append(1.0)
  11945. * segments = [] # <<<<<<<<<<<<<<
  11946. * ax, ay = a
  11947. * bx, by = b
  11948. */
  11949. __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 739, __pyx_L1_error)
  11950. __Pyx_GOTREF(__pyx_t_2);
  11951. __pyx_v_segments = ((PyObject*)__pyx_t_2);
  11952. __pyx_t_2 = 0;
  11953. /* "fontTools/misc/bezierTools.py":740
  11954. * ts.append(1.0)
  11955. * segments = []
  11956. * ax, ay = a # <<<<<<<<<<<<<<
  11957. * bx, by = b
  11958. * cx, cy = c
  11959. */
  11960. if ((likely(PyTuple_CheckExact(__pyx_v_a))) || (PyList_CheckExact(__pyx_v_a))) {
  11961. PyObject* sequence = __pyx_v_a;
  11962. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  11963. if (unlikely(size != 2)) {
  11964. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  11965. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  11966. __PYX_ERR(0, 740, __pyx_L1_error)
  11967. }
  11968. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  11969. if (likely(PyTuple_CheckExact(sequence))) {
  11970. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  11971. __Pyx_INCREF(__pyx_t_2);
  11972. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  11973. __Pyx_INCREF(__pyx_t_1);
  11974. } else {
  11975. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  11976. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __pyx_L1_error)
  11977. __Pyx_XGOTREF(__pyx_t_2);
  11978. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  11979. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error)
  11980. __Pyx_XGOTREF(__pyx_t_1);
  11981. }
  11982. #else
  11983. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __pyx_L1_error)
  11984. __Pyx_GOTREF(__pyx_t_2);
  11985. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error)
  11986. __Pyx_GOTREF(__pyx_t_1);
  11987. #endif
  11988. } else {
  11989. Py_ssize_t index = -1;
  11990. __pyx_t_4 = PyObject_GetIter(__pyx_v_a); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 740, __pyx_L1_error)
  11991. __Pyx_GOTREF(__pyx_t_4);
  11992. __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
  11993. index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  11994. __Pyx_GOTREF(__pyx_t_2);
  11995. index = 1; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
  11996. __Pyx_GOTREF(__pyx_t_1);
  11997. if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < (0)) __PYX_ERR(0, 740, __pyx_L1_error)
  11998. __pyx_t_5 = NULL;
  11999. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  12000. goto __pyx_L4_unpacking_done;
  12001. __pyx_L3_unpacking_failed:;
  12002. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  12003. __pyx_t_5 = NULL;
  12004. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  12005. __PYX_ERR(0, 740, __pyx_L1_error)
  12006. __pyx_L4_unpacking_done:;
  12007. }
  12008. __pyx_v_ax = __pyx_t_2;
  12009. __pyx_t_2 = 0;
  12010. __pyx_v_ay = __pyx_t_1;
  12011. __pyx_t_1 = 0;
  12012. /* "fontTools/misc/bezierTools.py":741
  12013. * segments = []
  12014. * ax, ay = a
  12015. * bx, by = b # <<<<<<<<<<<<<<
  12016. * cx, cy = c
  12017. * dx, dy = d
  12018. */
  12019. if ((likely(PyTuple_CheckExact(__pyx_v_b))) || (PyList_CheckExact(__pyx_v_b))) {
  12020. PyObject* sequence = __pyx_v_b;
  12021. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  12022. if (unlikely(size != 2)) {
  12023. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  12024. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  12025. __PYX_ERR(0, 741, __pyx_L1_error)
  12026. }
  12027. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  12028. if (likely(PyTuple_CheckExact(sequence))) {
  12029. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  12030. __Pyx_INCREF(__pyx_t_1);
  12031. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  12032. __Pyx_INCREF(__pyx_t_2);
  12033. } else {
  12034. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  12035. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 741, __pyx_L1_error)
  12036. __Pyx_XGOTREF(__pyx_t_1);
  12037. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  12038. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 741, __pyx_L1_error)
  12039. __Pyx_XGOTREF(__pyx_t_2);
  12040. }
  12041. #else
  12042. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 741, __pyx_L1_error)
  12043. __Pyx_GOTREF(__pyx_t_1);
  12044. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 741, __pyx_L1_error)
  12045. __Pyx_GOTREF(__pyx_t_2);
  12046. #endif
  12047. } else {
  12048. Py_ssize_t index = -1;
  12049. __pyx_t_4 = PyObject_GetIter(__pyx_v_b); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 741, __pyx_L1_error)
  12050. __Pyx_GOTREF(__pyx_t_4);
  12051. __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
  12052. index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
  12053. __Pyx_GOTREF(__pyx_t_1);
  12054. index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
  12055. __Pyx_GOTREF(__pyx_t_2);
  12056. if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < (0)) __PYX_ERR(0, 741, __pyx_L1_error)
  12057. __pyx_t_5 = NULL;
  12058. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  12059. goto __pyx_L6_unpacking_done;
  12060. __pyx_L5_unpacking_failed:;
  12061. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  12062. __pyx_t_5 = NULL;
  12063. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  12064. __PYX_ERR(0, 741, __pyx_L1_error)
  12065. __pyx_L6_unpacking_done:;
  12066. }
  12067. __pyx_v_bx = __pyx_t_1;
  12068. __pyx_t_1 = 0;
  12069. __pyx_v_by = __pyx_t_2;
  12070. __pyx_t_2 = 0;
  12071. /* "fontTools/misc/bezierTools.py":742
  12072. * ax, ay = a
  12073. * bx, by = b
  12074. * cx, cy = c # <<<<<<<<<<<<<<
  12075. * dx, dy = d
  12076. * for i in range(len(ts) - 1):
  12077. */
  12078. if ((likely(PyTuple_CheckExact(__pyx_v_c))) || (PyList_CheckExact(__pyx_v_c))) {
  12079. PyObject* sequence = __pyx_v_c;
  12080. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  12081. if (unlikely(size != 2)) {
  12082. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  12083. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  12084. __PYX_ERR(0, 742, __pyx_L1_error)
  12085. }
  12086. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  12087. if (likely(PyTuple_CheckExact(sequence))) {
  12088. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  12089. __Pyx_INCREF(__pyx_t_2);
  12090. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  12091. __Pyx_INCREF(__pyx_t_1);
  12092. } else {
  12093. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  12094. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 742, __pyx_L1_error)
  12095. __Pyx_XGOTREF(__pyx_t_2);
  12096. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  12097. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 742, __pyx_L1_error)
  12098. __Pyx_XGOTREF(__pyx_t_1);
  12099. }
  12100. #else
  12101. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 742, __pyx_L1_error)
  12102. __Pyx_GOTREF(__pyx_t_2);
  12103. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 742, __pyx_L1_error)
  12104. __Pyx_GOTREF(__pyx_t_1);
  12105. #endif
  12106. } else {
  12107. Py_ssize_t index = -1;
  12108. __pyx_t_4 = PyObject_GetIter(__pyx_v_c); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 742, __pyx_L1_error)
  12109. __Pyx_GOTREF(__pyx_t_4);
  12110. __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
  12111. index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
  12112. __Pyx_GOTREF(__pyx_t_2);
  12113. index = 1; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
  12114. __Pyx_GOTREF(__pyx_t_1);
  12115. if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < (0)) __PYX_ERR(0, 742, __pyx_L1_error)
  12116. __pyx_t_5 = NULL;
  12117. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  12118. goto __pyx_L8_unpacking_done;
  12119. __pyx_L7_unpacking_failed:;
  12120. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  12121. __pyx_t_5 = NULL;
  12122. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  12123. __PYX_ERR(0, 742, __pyx_L1_error)
  12124. __pyx_L8_unpacking_done:;
  12125. }
  12126. __pyx_v_cx = __pyx_t_2;
  12127. __pyx_t_2 = 0;
  12128. __pyx_v_cy = __pyx_t_1;
  12129. __pyx_t_1 = 0;
  12130. /* "fontTools/misc/bezierTools.py":743
  12131. * bx, by = b
  12132. * cx, cy = c
  12133. * dx, dy = d # <<<<<<<<<<<<<<
  12134. * for i in range(len(ts) - 1):
  12135. * t1 = ts[i]
  12136. */
  12137. if ((likely(PyTuple_CheckExact(__pyx_v_d))) || (PyList_CheckExact(__pyx_v_d))) {
  12138. PyObject* sequence = __pyx_v_d;
  12139. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  12140. if (unlikely(size != 2)) {
  12141. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  12142. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  12143. __PYX_ERR(0, 743, __pyx_L1_error)
  12144. }
  12145. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  12146. if (likely(PyTuple_CheckExact(sequence))) {
  12147. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  12148. __Pyx_INCREF(__pyx_t_1);
  12149. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  12150. __Pyx_INCREF(__pyx_t_2);
  12151. } else {
  12152. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  12153. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 743, __pyx_L1_error)
  12154. __Pyx_XGOTREF(__pyx_t_1);
  12155. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  12156. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 743, __pyx_L1_error)
  12157. __Pyx_XGOTREF(__pyx_t_2);
  12158. }
  12159. #else
  12160. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 743, __pyx_L1_error)
  12161. __Pyx_GOTREF(__pyx_t_1);
  12162. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 743, __pyx_L1_error)
  12163. __Pyx_GOTREF(__pyx_t_2);
  12164. #endif
  12165. } else {
  12166. Py_ssize_t index = -1;
  12167. __pyx_t_4 = PyObject_GetIter(__pyx_v_d); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 743, __pyx_L1_error)
  12168. __Pyx_GOTREF(__pyx_t_4);
  12169. __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
  12170. index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L9_unpacking_failed;
  12171. __Pyx_GOTREF(__pyx_t_1);
  12172. index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L9_unpacking_failed;
  12173. __Pyx_GOTREF(__pyx_t_2);
  12174. if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < (0)) __PYX_ERR(0, 743, __pyx_L1_error)
  12175. __pyx_t_5 = NULL;
  12176. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  12177. goto __pyx_L10_unpacking_done;
  12178. __pyx_L9_unpacking_failed:;
  12179. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  12180. __pyx_t_5 = NULL;
  12181. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  12182. __PYX_ERR(0, 743, __pyx_L1_error)
  12183. __pyx_L10_unpacking_done:;
  12184. }
  12185. __pyx_v_dx = __pyx_t_1;
  12186. __pyx_t_1 = 0;
  12187. __pyx_v_dy = __pyx_t_2;
  12188. __pyx_t_2 = 0;
  12189. /* "fontTools/misc/bezierTools.py":744
  12190. * cx, cy = c
  12191. * dx, dy = d
  12192. * for i in range(len(ts) - 1): # <<<<<<<<<<<<<<
  12193. * t1 = ts[i]
  12194. * t2 = ts[i + 1]
  12195. */
  12196. __pyx_t_1 = NULL;
  12197. __pyx_t_6 = PyObject_Length(__pyx_v_ts); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 744, __pyx_L1_error)
  12198. __pyx_t_4 = PyLong_FromSsize_t((__pyx_t_6 - 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 744, __pyx_L1_error)
  12199. __Pyx_GOTREF(__pyx_t_4);
  12200. __pyx_t_7 = 1;
  12201. {
  12202. PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_4};
  12203. __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));
  12204. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  12205. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  12206. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 744, __pyx_L1_error)
  12207. __Pyx_GOTREF(__pyx_t_2);
  12208. }
  12209. __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 744, __pyx_L1_error)
  12210. __Pyx_GOTREF(__pyx_t_4);
  12211. __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)
  12212. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12213. for (;;) {
  12214. {
  12215. __pyx_t_2 = __pyx_t_8(__pyx_t_4);
  12216. if (unlikely(!__pyx_t_2)) {
  12217. PyObject* exc_type = PyErr_Occurred();
  12218. if (exc_type) {
  12219. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 744, __pyx_L1_error)
  12220. PyErr_Clear();
  12221. }
  12222. break;
  12223. }
  12224. }
  12225. __Pyx_GOTREF(__pyx_t_2);
  12226. __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
  12227. __pyx_t_2 = 0;
  12228. /* "fontTools/misc/bezierTools.py":745
  12229. * dx, dy = d
  12230. * for i in range(len(ts) - 1):
  12231. * t1 = ts[i] # <<<<<<<<<<<<<<
  12232. * t2 = ts[i + 1]
  12233. * delta = t2 - t1
  12234. */
  12235. __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_ts, __pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 745, __pyx_L1_error)
  12236. __Pyx_GOTREF(__pyx_t_2);
  12237. __Pyx_XDECREF_SET(__pyx_v_t1, __pyx_t_2);
  12238. __pyx_t_2 = 0;
  12239. /* "fontTools/misc/bezierTools.py":746
  12240. * for i in range(len(ts) - 1):
  12241. * t1 = ts[i]
  12242. * t2 = ts[i + 1] # <<<<<<<<<<<<<<
  12243. * delta = t2 - t1
  12244. *
  12245. */
  12246. __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)
  12247. __Pyx_GOTREF(__pyx_t_2);
  12248. __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_ts, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 746, __pyx_L1_error)
  12249. __Pyx_GOTREF(__pyx_t_1);
  12250. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12251. __Pyx_XDECREF_SET(__pyx_v_t2, __pyx_t_1);
  12252. __pyx_t_1 = 0;
  12253. /* "fontTools/misc/bezierTools.py":747
  12254. * t1 = ts[i]
  12255. * t2 = ts[i + 1]
  12256. * delta = t2 - t1 # <<<<<<<<<<<<<<
  12257. *
  12258. * delta_2 = delta * delta
  12259. */
  12260. __pyx_t_1 = PyNumber_Subtract(__pyx_v_t2, __pyx_v_t1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 747, __pyx_L1_error)
  12261. __Pyx_GOTREF(__pyx_t_1);
  12262. __Pyx_XDECREF_SET(__pyx_v_delta, __pyx_t_1);
  12263. __pyx_t_1 = 0;
  12264. /* "fontTools/misc/bezierTools.py":749
  12265. * delta = t2 - t1
  12266. *
  12267. * delta_2 = delta * delta # <<<<<<<<<<<<<<
  12268. * delta_3 = delta * delta_2
  12269. * t1_2 = t1 * t1
  12270. */
  12271. __pyx_t_1 = PyNumber_Multiply(__pyx_v_delta, __pyx_v_delta); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 749, __pyx_L1_error)
  12272. __Pyx_GOTREF(__pyx_t_1);
  12273. __Pyx_XDECREF_SET(__pyx_v_delta_2, __pyx_t_1);
  12274. __pyx_t_1 = 0;
  12275. /* "fontTools/misc/bezierTools.py":750
  12276. *
  12277. * delta_2 = delta * delta
  12278. * delta_3 = delta * delta_2 # <<<<<<<<<<<<<<
  12279. * t1_2 = t1 * t1
  12280. * t1_3 = t1 * t1_2
  12281. */
  12282. __pyx_t_1 = PyNumber_Multiply(__pyx_v_delta, __pyx_v_delta_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 750, __pyx_L1_error)
  12283. __Pyx_GOTREF(__pyx_t_1);
  12284. __Pyx_XDECREF_SET(__pyx_v_delta_3, __pyx_t_1);
  12285. __pyx_t_1 = 0;
  12286. /* "fontTools/misc/bezierTools.py":751
  12287. * delta_2 = delta * delta
  12288. * delta_3 = delta * delta_2
  12289. * t1_2 = t1 * t1 # <<<<<<<<<<<<<<
  12290. * t1_3 = t1 * t1_2
  12291. *
  12292. */
  12293. __pyx_t_1 = PyNumber_Multiply(__pyx_v_t1, __pyx_v_t1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 751, __pyx_L1_error)
  12294. __Pyx_GOTREF(__pyx_t_1);
  12295. __Pyx_XDECREF_SET(__pyx_v_t1_2, __pyx_t_1);
  12296. __pyx_t_1 = 0;
  12297. /* "fontTools/misc/bezierTools.py":752
  12298. * delta_3 = delta * delta_2
  12299. * t1_2 = t1 * t1
  12300. * t1_3 = t1 * t1_2 # <<<<<<<<<<<<<<
  12301. *
  12302. * # calc new a, b, c and d
  12303. */
  12304. __pyx_t_1 = PyNumber_Multiply(__pyx_v_t1, __pyx_v_t1_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 752, __pyx_L1_error)
  12305. __Pyx_GOTREF(__pyx_t_1);
  12306. __Pyx_XDECREF_SET(__pyx_v_t1_3, __pyx_t_1);
  12307. __pyx_t_1 = 0;
  12308. /* "fontTools/misc/bezierTools.py":755
  12309. *
  12310. * # calc new a, b, c and d
  12311. * a1x = ax * delta_3 # <<<<<<<<<<<<<<
  12312. * a1y = ay * delta_3
  12313. * b1x = (3 * ax * t1 + bx) * delta_2
  12314. */
  12315. __pyx_t_1 = PyNumber_Multiply(__pyx_v_ax, __pyx_v_delta_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 755, __pyx_L1_error)
  12316. __Pyx_GOTREF(__pyx_t_1);
  12317. __Pyx_XDECREF_SET(__pyx_v_a1x, __pyx_t_1);
  12318. __pyx_t_1 = 0;
  12319. /* "fontTools/misc/bezierTools.py":756
  12320. * # calc new a, b, c and d
  12321. * a1x = ax * delta_3
  12322. * a1y = ay * delta_3 # <<<<<<<<<<<<<<
  12323. * b1x = (3 * ax * t1 + bx) * delta_2
  12324. * b1y = (3 * ay * t1 + by) * delta_2
  12325. */
  12326. __pyx_t_1 = PyNumber_Multiply(__pyx_v_ay, __pyx_v_delta_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 756, __pyx_L1_error)
  12327. __Pyx_GOTREF(__pyx_t_1);
  12328. __Pyx_XDECREF_SET(__pyx_v_a1y, __pyx_t_1);
  12329. __pyx_t_1 = 0;
  12330. /* "fontTools/misc/bezierTools.py":757
  12331. * a1x = ax * delta_3
  12332. * a1y = ay * delta_3
  12333. * b1x = (3 * ax * t1 + bx) * delta_2 # <<<<<<<<<<<<<<
  12334. * b1y = (3 * ay * t1 + by) * delta_2
  12335. * c1x = (2 * bx * t1 + cx + 3 * ax * t1_2) * delta
  12336. */
  12337. __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)
  12338. __Pyx_GOTREF(__pyx_t_1);
  12339. __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_t1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 757, __pyx_L1_error)
  12340. __Pyx_GOTREF(__pyx_t_2);
  12341. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12342. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_bx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 757, __pyx_L1_error)
  12343. __Pyx_GOTREF(__pyx_t_1);
  12344. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12345. __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_delta_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 757, __pyx_L1_error)
  12346. __Pyx_GOTREF(__pyx_t_2);
  12347. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12348. __Pyx_XDECREF_SET(__pyx_v_b1x, __pyx_t_2);
  12349. __pyx_t_2 = 0;
  12350. /* "fontTools/misc/bezierTools.py":758
  12351. * a1y = ay * delta_3
  12352. * b1x = (3 * ax * t1 + bx) * delta_2
  12353. * b1y = (3 * ay * t1 + by) * delta_2 # <<<<<<<<<<<<<<
  12354. * c1x = (2 * bx * t1 + cx + 3 * ax * t1_2) * delta
  12355. * c1y = (2 * by * t1 + cy + 3 * ay * t1_2) * delta
  12356. */
  12357. __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)
  12358. __Pyx_GOTREF(__pyx_t_2);
  12359. __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_v_t1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 758, __pyx_L1_error)
  12360. __Pyx_GOTREF(__pyx_t_1);
  12361. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12362. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_by); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 758, __pyx_L1_error)
  12363. __Pyx_GOTREF(__pyx_t_2);
  12364. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12365. __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_v_delta_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 758, __pyx_L1_error)
  12366. __Pyx_GOTREF(__pyx_t_1);
  12367. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12368. __Pyx_XDECREF_SET(__pyx_v_b1y, __pyx_t_1);
  12369. __pyx_t_1 = 0;
  12370. /* "fontTools/misc/bezierTools.py":759
  12371. * b1x = (3 * ax * t1 + bx) * delta_2
  12372. * b1y = (3 * ay * t1 + by) * delta_2
  12373. * c1x = (2 * bx * t1 + cx + 3 * ax * t1_2) * delta # <<<<<<<<<<<<<<
  12374. * c1y = (2 * by * t1 + cy + 3 * ay * t1_2) * delta
  12375. * d1x = ax * t1_3 + bx * t1_2 + cx * t1 + dx
  12376. */
  12377. __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)
  12378. __Pyx_GOTREF(__pyx_t_1);
  12379. __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_t1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 759, __pyx_L1_error)
  12380. __Pyx_GOTREF(__pyx_t_2);
  12381. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12382. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_cx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 759, __pyx_L1_error)
  12383. __Pyx_GOTREF(__pyx_t_1);
  12384. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12385. __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)
  12386. __Pyx_GOTREF(__pyx_t_2);
  12387. __pyx_t_9 = PyNumber_Multiply(__pyx_t_2, __pyx_v_t1_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 759, __pyx_L1_error)
  12388. __Pyx_GOTREF(__pyx_t_9);
  12389. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12390. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 759, __pyx_L1_error)
  12391. __Pyx_GOTREF(__pyx_t_2);
  12392. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12393. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  12394. __pyx_t_9 = PyNumber_Multiply(__pyx_t_2, __pyx_v_delta); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 759, __pyx_L1_error)
  12395. __Pyx_GOTREF(__pyx_t_9);
  12396. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12397. __Pyx_XDECREF_SET(__pyx_v_c1x, __pyx_t_9);
  12398. __pyx_t_9 = 0;
  12399. /* "fontTools/misc/bezierTools.py":760
  12400. * b1y = (3 * ay * t1 + by) * delta_2
  12401. * c1x = (2 * bx * t1 + cx + 3 * ax * t1_2) * delta
  12402. * c1y = (2 * by * t1 + cy + 3 * ay * t1_2) * delta # <<<<<<<<<<<<<<
  12403. * d1x = ax * t1_3 + bx * t1_2 + cx * t1 + dx
  12404. * d1y = ay * t1_3 + by * t1_2 + cy * t1 + dy
  12405. */
  12406. __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)
  12407. __Pyx_GOTREF(__pyx_t_9);
  12408. __pyx_t_2 = PyNumber_Multiply(__pyx_t_9, __pyx_v_t1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 760, __pyx_L1_error)
  12409. __Pyx_GOTREF(__pyx_t_2);
  12410. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  12411. __pyx_t_9 = PyNumber_Add(__pyx_t_2, __pyx_v_cy); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 760, __pyx_L1_error)
  12412. __Pyx_GOTREF(__pyx_t_9);
  12413. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12414. __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)
  12415. __Pyx_GOTREF(__pyx_t_2);
  12416. __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_v_t1_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 760, __pyx_L1_error)
  12417. __Pyx_GOTREF(__pyx_t_1);
  12418. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12419. __pyx_t_2 = PyNumber_Add(__pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 760, __pyx_L1_error)
  12420. __Pyx_GOTREF(__pyx_t_2);
  12421. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  12422. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12423. __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_v_delta); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 760, __pyx_L1_error)
  12424. __Pyx_GOTREF(__pyx_t_1);
  12425. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12426. __Pyx_XDECREF_SET(__pyx_v_c1y, __pyx_t_1);
  12427. __pyx_t_1 = 0;
  12428. /* "fontTools/misc/bezierTools.py":761
  12429. * c1x = (2 * bx * t1 + cx + 3 * ax * t1_2) * delta
  12430. * c1y = (2 * by * t1 + cy + 3 * ay * t1_2) * delta
  12431. * d1x = ax * t1_3 + bx * t1_2 + cx * t1 + dx # <<<<<<<<<<<<<<
  12432. * d1y = ay * t1_3 + by * t1_2 + cy * t1 + dy
  12433. * pt1, pt2, pt3, pt4 = calcCubicPoints(
  12434. */
  12435. __pyx_t_1 = PyNumber_Multiply(__pyx_v_ax, __pyx_v_t1_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 761, __pyx_L1_error)
  12436. __Pyx_GOTREF(__pyx_t_1);
  12437. __pyx_t_2 = PyNumber_Multiply(__pyx_v_bx, __pyx_v_t1_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 761, __pyx_L1_error)
  12438. __Pyx_GOTREF(__pyx_t_2);
  12439. __pyx_t_9 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 761, __pyx_L1_error)
  12440. __Pyx_GOTREF(__pyx_t_9);
  12441. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12442. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12443. __pyx_t_2 = PyNumber_Multiply(__pyx_v_cx, __pyx_v_t1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 761, __pyx_L1_error)
  12444. __Pyx_GOTREF(__pyx_t_2);
  12445. __pyx_t_1 = PyNumber_Add(__pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 761, __pyx_L1_error)
  12446. __Pyx_GOTREF(__pyx_t_1);
  12447. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  12448. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12449. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_dx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 761, __pyx_L1_error)
  12450. __Pyx_GOTREF(__pyx_t_2);
  12451. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12452. __Pyx_XDECREF_SET(__pyx_v_d1x, __pyx_t_2);
  12453. __pyx_t_2 = 0;
  12454. /* "fontTools/misc/bezierTools.py":762
  12455. * c1y = (2 * by * t1 + cy + 3 * ay * t1_2) * delta
  12456. * d1x = ax * t1_3 + bx * t1_2 + cx * t1 + dx
  12457. * d1y = ay * t1_3 + by * t1_2 + cy * t1 + dy # <<<<<<<<<<<<<<
  12458. * pt1, pt2, pt3, pt4 = calcCubicPoints(
  12459. * (a1x, a1y), (b1x, b1y), (c1x, c1y), (d1x, d1y)
  12460. */
  12461. __pyx_t_2 = PyNumber_Multiply(__pyx_v_ay, __pyx_v_t1_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 762, __pyx_L1_error)
  12462. __Pyx_GOTREF(__pyx_t_2);
  12463. __pyx_t_1 = PyNumber_Multiply(__pyx_v_by, __pyx_v_t1_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 762, __pyx_L1_error)
  12464. __Pyx_GOTREF(__pyx_t_1);
  12465. __pyx_t_9 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 762, __pyx_L1_error)
  12466. __Pyx_GOTREF(__pyx_t_9);
  12467. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12468. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12469. __pyx_t_1 = PyNumber_Multiply(__pyx_v_cy, __pyx_v_t1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 762, __pyx_L1_error)
  12470. __Pyx_GOTREF(__pyx_t_1);
  12471. __pyx_t_2 = PyNumber_Add(__pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 762, __pyx_L1_error)
  12472. __Pyx_GOTREF(__pyx_t_2);
  12473. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  12474. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12475. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_dy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 762, __pyx_L1_error)
  12476. __Pyx_GOTREF(__pyx_t_1);
  12477. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12478. __Pyx_XDECREF_SET(__pyx_v_d1y, __pyx_t_1);
  12479. __pyx_t_1 = 0;
  12480. /* "fontTools/misc/bezierTools.py":763
  12481. * d1x = ax * t1_3 + bx * t1_2 + cx * t1 + dx
  12482. * d1y = ay * t1_3 + by * t1_2 + cy * t1 + dy
  12483. * pt1, pt2, pt3, pt4 = calcCubicPoints( # <<<<<<<<<<<<<<
  12484. * (a1x, a1y), (b1x, b1y), (c1x, c1y), (d1x, d1y)
  12485. * )
  12486. */
  12487. __pyx_t_2 = NULL;
  12488. __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_calcCubicPoints); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 763, __pyx_L1_error)
  12489. __Pyx_GOTREF(__pyx_t_9);
  12490. /* "fontTools/misc/bezierTools.py":764
  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. * segments.append((pt1, pt2, pt3, pt4))
  12496. */
  12497. __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 764, __pyx_L1_error)
  12498. __Pyx_GOTREF(__pyx_t_10);
  12499. __Pyx_INCREF(__pyx_v_a1x);
  12500. __Pyx_GIVEREF(__pyx_v_a1x);
  12501. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_a1x) != (0)) __PYX_ERR(0, 764, __pyx_L1_error);
  12502. __Pyx_INCREF(__pyx_v_a1y);
  12503. __Pyx_GIVEREF(__pyx_v_a1y);
  12504. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_a1y) != (0)) __PYX_ERR(0, 764, __pyx_L1_error);
  12505. __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 764, __pyx_L1_error)
  12506. __Pyx_GOTREF(__pyx_t_11);
  12507. __Pyx_INCREF(__pyx_v_b1x);
  12508. __Pyx_GIVEREF(__pyx_v_b1x);
  12509. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_b1x) != (0)) __PYX_ERR(0, 764, __pyx_L1_error);
  12510. __Pyx_INCREF(__pyx_v_b1y);
  12511. __Pyx_GIVEREF(__pyx_v_b1y);
  12512. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_b1y) != (0)) __PYX_ERR(0, 764, __pyx_L1_error);
  12513. __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 764, __pyx_L1_error)
  12514. __Pyx_GOTREF(__pyx_t_12);
  12515. __Pyx_INCREF(__pyx_v_c1x);
  12516. __Pyx_GIVEREF(__pyx_v_c1x);
  12517. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_c1x) != (0)) __PYX_ERR(0, 764, __pyx_L1_error);
  12518. __Pyx_INCREF(__pyx_v_c1y);
  12519. __Pyx_GIVEREF(__pyx_v_c1y);
  12520. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_c1y) != (0)) __PYX_ERR(0, 764, __pyx_L1_error);
  12521. __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 764, __pyx_L1_error)
  12522. __Pyx_GOTREF(__pyx_t_13);
  12523. __Pyx_INCREF(__pyx_v_d1x);
  12524. __Pyx_GIVEREF(__pyx_v_d1x);
  12525. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_d1x) != (0)) __PYX_ERR(0, 764, __pyx_L1_error);
  12526. __Pyx_INCREF(__pyx_v_d1y);
  12527. __Pyx_GIVEREF(__pyx_v_d1y);
  12528. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_d1y) != (0)) __PYX_ERR(0, 764, __pyx_L1_error);
  12529. __pyx_t_7 = 1;
  12530. #if CYTHON_UNPACK_METHODS
  12531. if (unlikely(PyMethod_Check(__pyx_t_9))) {
  12532. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9);
  12533. assert(__pyx_t_2);
  12534. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9);
  12535. __Pyx_INCREF(__pyx_t_2);
  12536. __Pyx_INCREF(__pyx__function);
  12537. __Pyx_DECREF_SET(__pyx_t_9, __pyx__function);
  12538. __pyx_t_7 = 0;
  12539. }
  12540. #endif
  12541. {
  12542. PyObject *__pyx_callargs[5] = {__pyx_t_2, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13};
  12543. __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));
  12544. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  12545. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  12546. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  12547. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  12548. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  12549. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  12550. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 763, __pyx_L1_error)
  12551. __Pyx_GOTREF(__pyx_t_1);
  12552. }
  12553. if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
  12554. PyObject* sequence = __pyx_t_1;
  12555. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  12556. if (unlikely(size != 4)) {
  12557. if (size > 4) __Pyx_RaiseTooManyValuesError(4);
  12558. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  12559. __PYX_ERR(0, 763, __pyx_L1_error)
  12560. }
  12561. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  12562. if (likely(PyTuple_CheckExact(sequence))) {
  12563. __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0);
  12564. __Pyx_INCREF(__pyx_t_9);
  12565. __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1);
  12566. __Pyx_INCREF(__pyx_t_13);
  12567. __pyx_t_12 = PyTuple_GET_ITEM(sequence, 2);
  12568. __Pyx_INCREF(__pyx_t_12);
  12569. __pyx_t_11 = PyTuple_GET_ITEM(sequence, 3);
  12570. __Pyx_INCREF(__pyx_t_11);
  12571. } else {
  12572. __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  12573. if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 763, __pyx_L1_error)
  12574. __Pyx_XGOTREF(__pyx_t_9);
  12575. __pyx_t_13 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  12576. if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 763, __pyx_L1_error)
  12577. __Pyx_XGOTREF(__pyx_t_13);
  12578. __pyx_t_12 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  12579. if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 763, __pyx_L1_error)
  12580. __Pyx_XGOTREF(__pyx_t_12);
  12581. __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 3, __Pyx_ReferenceSharing_SharedReference);
  12582. if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 763, __pyx_L1_error)
  12583. __Pyx_XGOTREF(__pyx_t_11);
  12584. }
  12585. #else
  12586. {
  12587. Py_ssize_t i;
  12588. PyObject** temps[4] = {&__pyx_t_9,&__pyx_t_13,&__pyx_t_12,&__pyx_t_11};
  12589. for (i=0; i < 4; i++) {
  12590. PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 763, __pyx_L1_error)
  12591. __Pyx_GOTREF(item);
  12592. *(temps[i]) = item;
  12593. }
  12594. }
  12595. #endif
  12596. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12597. } else {
  12598. Py_ssize_t index = -1;
  12599. PyObject** temps[4] = {&__pyx_t_9,&__pyx_t_13,&__pyx_t_12,&__pyx_t_11};
  12600. __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 763, __pyx_L1_error)
  12601. __Pyx_GOTREF(__pyx_t_10);
  12602. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12603. __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10);
  12604. for (index=0; index < 4; index++) {
  12605. PyObject* item = __pyx_t_5(__pyx_t_10); if (unlikely(!item)) goto __pyx_L13_unpacking_failed;
  12606. __Pyx_GOTREF(item);
  12607. *(temps[index]) = item;
  12608. }
  12609. if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_10), 4) < (0)) __PYX_ERR(0, 763, __pyx_L1_error)
  12610. __pyx_t_5 = NULL;
  12611. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  12612. goto __pyx_L14_unpacking_done;
  12613. __pyx_L13_unpacking_failed:;
  12614. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  12615. __pyx_t_5 = NULL;
  12616. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  12617. __PYX_ERR(0, 763, __pyx_L1_error)
  12618. __pyx_L14_unpacking_done:;
  12619. }
  12620. /* "fontTools/misc/bezierTools.py":763
  12621. * d1x = ax * t1_3 + bx * t1_2 + cx * t1 + dx
  12622. * d1y = ay * t1_3 + by * t1_2 + cy * t1 + dy
  12623. * pt1, pt2, pt3, pt4 = calcCubicPoints( # <<<<<<<<<<<<<<
  12624. * (a1x, a1y), (b1x, b1y), (c1x, c1y), (d1x, d1y)
  12625. * )
  12626. */
  12627. __Pyx_XDECREF_SET(__pyx_v_pt1, __pyx_t_9);
  12628. __pyx_t_9 = 0;
  12629. __Pyx_XDECREF_SET(__pyx_v_pt2, __pyx_t_13);
  12630. __pyx_t_13 = 0;
  12631. __Pyx_XDECREF_SET(__pyx_v_pt3, __pyx_t_12);
  12632. __pyx_t_12 = 0;
  12633. __Pyx_XDECREF_SET(__pyx_v_pt4, __pyx_t_11);
  12634. __pyx_t_11 = 0;
  12635. /* "fontTools/misc/bezierTools.py":766
  12636. * (a1x, a1y), (b1x, b1y), (c1x, c1y), (d1x, d1y)
  12637. * )
  12638. * segments.append((pt1, pt2, pt3, pt4)) # <<<<<<<<<<<<<<
  12639. * return segments
  12640. *
  12641. */
  12642. __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 766, __pyx_L1_error)
  12643. __Pyx_GOTREF(__pyx_t_1);
  12644. __Pyx_INCREF(__pyx_v_pt1);
  12645. __Pyx_GIVEREF(__pyx_v_pt1);
  12646. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pt1) != (0)) __PYX_ERR(0, 766, __pyx_L1_error);
  12647. __Pyx_INCREF(__pyx_v_pt2);
  12648. __Pyx_GIVEREF(__pyx_v_pt2);
  12649. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_pt2) != (0)) __PYX_ERR(0, 766, __pyx_L1_error);
  12650. __Pyx_INCREF(__pyx_v_pt3);
  12651. __Pyx_GIVEREF(__pyx_v_pt3);
  12652. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_pt3) != (0)) __PYX_ERR(0, 766, __pyx_L1_error);
  12653. __Pyx_INCREF(__pyx_v_pt4);
  12654. __Pyx_GIVEREF(__pyx_v_pt4);
  12655. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_pt4) != (0)) __PYX_ERR(0, 766, __pyx_L1_error);
  12656. __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)
  12657. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12658. /* "fontTools/misc/bezierTools.py":744
  12659. * cx, cy = c
  12660. * dx, dy = d
  12661. * for i in range(len(ts) - 1): # <<<<<<<<<<<<<<
  12662. * t1 = ts[i]
  12663. * t2 = ts[i + 1]
  12664. */
  12665. }
  12666. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  12667. /* "fontTools/misc/bezierTools.py":767
  12668. * )
  12669. * segments.append((pt1, pt2, pt3, pt4))
  12670. * return segments # <<<<<<<<<<<<<<
  12671. *
  12672. *
  12673. */
  12674. __Pyx_XDECREF(__pyx_r);
  12675. __Pyx_INCREF(__pyx_v_segments);
  12676. __pyx_r = __pyx_v_segments;
  12677. goto __pyx_L0;
  12678. /* "fontTools/misc/bezierTools.py":735
  12679. *
  12680. *
  12681. * def _splitCubicAtT(a, b, c, d, *ts): # <<<<<<<<<<<<<<
  12682. * ts = list(ts)
  12683. * ts.insert(0, 0.0)
  12684. */
  12685. /* function exit code */
  12686. __pyx_L1_error:;
  12687. __Pyx_XDECREF(__pyx_t_1);
  12688. __Pyx_XDECREF(__pyx_t_2);
  12689. __Pyx_XDECREF(__pyx_t_4);
  12690. __Pyx_XDECREF(__pyx_t_9);
  12691. __Pyx_XDECREF(__pyx_t_10);
  12692. __Pyx_XDECREF(__pyx_t_11);
  12693. __Pyx_XDECREF(__pyx_t_12);
  12694. __Pyx_XDECREF(__pyx_t_13);
  12695. __Pyx_AddTraceback("fontTools.misc.bezierTools._splitCubicAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12696. __pyx_r = NULL;
  12697. __pyx_L0:;
  12698. __Pyx_XDECREF(__pyx_v_ts);
  12699. __Pyx_XDECREF(__pyx_v_segments);
  12700. __Pyx_XDECREF(__pyx_v_ax);
  12701. __Pyx_XDECREF(__pyx_v_ay);
  12702. __Pyx_XDECREF(__pyx_v_bx);
  12703. __Pyx_XDECREF(__pyx_v_by);
  12704. __Pyx_XDECREF(__pyx_v_cx);
  12705. __Pyx_XDECREF(__pyx_v_cy);
  12706. __Pyx_XDECREF(__pyx_v_dx);
  12707. __Pyx_XDECREF(__pyx_v_dy);
  12708. __Pyx_XDECREF(__pyx_v_i);
  12709. __Pyx_XDECREF(__pyx_v_t1);
  12710. __Pyx_XDECREF(__pyx_v_t2);
  12711. __Pyx_XDECREF(__pyx_v_delta);
  12712. __Pyx_XDECREF(__pyx_v_delta_2);
  12713. __Pyx_XDECREF(__pyx_v_delta_3);
  12714. __Pyx_XDECREF(__pyx_v_t1_2);
  12715. __Pyx_XDECREF(__pyx_v_t1_3);
  12716. __Pyx_XDECREF(__pyx_v_a1x);
  12717. __Pyx_XDECREF(__pyx_v_a1y);
  12718. __Pyx_XDECREF(__pyx_v_b1x);
  12719. __Pyx_XDECREF(__pyx_v_b1y);
  12720. __Pyx_XDECREF(__pyx_v_c1x);
  12721. __Pyx_XDECREF(__pyx_v_c1y);
  12722. __Pyx_XDECREF(__pyx_v_d1x);
  12723. __Pyx_XDECREF(__pyx_v_d1y);
  12724. __Pyx_XDECREF(__pyx_v_pt1);
  12725. __Pyx_XDECREF(__pyx_v_pt2);
  12726. __Pyx_XDECREF(__pyx_v_pt3);
  12727. __Pyx_XDECREF(__pyx_v_pt4);
  12728. __Pyx_XGIVEREF(__pyx_r);
  12729. __Pyx_RefNannyFinishContext();
  12730. return __pyx_r;
  12731. }
  12732. static PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_45generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
  12733. /* "fontTools/misc/bezierTools.py":770
  12734. *
  12735. *
  12736. * @cython.locals( # <<<<<<<<<<<<<<
  12737. * a=cython.complex,
  12738. * b=cython.complex,
  12739. */
  12740. /* Python wrapper */
  12741. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_44_splitCubicAtTC(PyObject *__pyx_self,
  12742. #if CYTHON_METH_FASTCALL
  12743. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  12744. #else
  12745. PyObject *__pyx_args, PyObject *__pyx_kwds
  12746. #endif
  12747. ); /*proto*/
  12748. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_43_splitCubicAtTC, "_splitCubicAtTC(double complex a, double complex b, double complex c, double complex d, *ts)");
  12749. 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};
  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. ) {
  12757. __pyx_t_double_complex __pyx_v_a;
  12758. __pyx_t_double_complex __pyx_v_b;
  12759. __pyx_t_double_complex __pyx_v_c;
  12760. __pyx_t_double_complex __pyx_v_d;
  12761. PyObject *__pyx_v_ts = 0;
  12762. #if !CYTHON_METH_FASTCALL
  12763. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  12764. #endif
  12765. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  12766. PyObject* values[4] = {0,0,0,0};
  12767. int __pyx_lineno = 0;
  12768. const char *__pyx_filename = NULL;
  12769. int __pyx_clineno = 0;
  12770. PyObject *__pyx_r = 0;
  12771. __Pyx_RefNannyDeclarations
  12772. __Pyx_RefNannySetupContext("_splitCubicAtTC (wrapper)", 0);
  12773. #if !CYTHON_METH_FASTCALL
  12774. #if CYTHON_ASSUME_SAFE_SIZE
  12775. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  12776. #else
  12777. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  12778. #endif
  12779. #endif
  12780. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  12781. __pyx_v_ts = __Pyx_ArgsSlice_FASTCALL(__pyx_args, 4, __pyx_nargs);
  12782. if (unlikely(!__pyx_v_ts)) {
  12783. __Pyx_RefNannyFinishContext();
  12784. return NULL;
  12785. }
  12786. __Pyx_GOTREF(__pyx_v_ts);
  12787. {
  12788. 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};
  12789. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  12790. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 770, __pyx_L3_error)
  12791. if (__pyx_kwds_len > 0) {
  12792. switch (__pyx_nargs) {
  12793. default:
  12794. case 4:
  12795. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  12796. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 770, __pyx_L3_error)
  12797. CYTHON_FALLTHROUGH;
  12798. case 3:
  12799. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  12800. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 770, __pyx_L3_error)
  12801. CYTHON_FALLTHROUGH;
  12802. case 2:
  12803. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  12804. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 770, __pyx_L3_error)
  12805. CYTHON_FALLTHROUGH;
  12806. case 1:
  12807. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  12808. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 770, __pyx_L3_error)
  12809. CYTHON_FALLTHROUGH;
  12810. case 0: break;
  12811. }
  12812. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  12813. const Py_ssize_t used_pos_args = (kwd_pos_args < 4) ? kwd_pos_args : 4;
  12814. 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)
  12815. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  12816. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_splitCubicAtTC", 0, 4, 4, i); __PYX_ERR(0, 770, __pyx_L3_error) }
  12817. }
  12818. } else if (unlikely(__pyx_nargs < 4)) {
  12819. goto __pyx_L5_argtuple_error;
  12820. } else {
  12821. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  12822. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 770, __pyx_L3_error)
  12823. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  12824. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 770, __pyx_L3_error)
  12825. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  12826. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 770, __pyx_L3_error)
  12827. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  12828. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 770, __pyx_L3_error)
  12829. }
  12830. __pyx_v_a = __Pyx_PyComplex_As___pyx_t_double_complex(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 785, __pyx_L3_error)
  12831. __pyx_v_b = __Pyx_PyComplex_As___pyx_t_double_complex(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 785, __pyx_L3_error)
  12832. __pyx_v_c = __Pyx_PyComplex_As___pyx_t_double_complex(values[2]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 785, __pyx_L3_error)
  12833. __pyx_v_d = __Pyx_PyComplex_As___pyx_t_double_complex(values[3]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 785, __pyx_L3_error)
  12834. }
  12835. goto __pyx_L6_skip;
  12836. __pyx_L5_argtuple_error:;
  12837. __Pyx_RaiseArgtupleInvalid("_splitCubicAtTC", 0, 4, 4, __pyx_nargs); __PYX_ERR(0, 770, __pyx_L3_error)
  12838. __pyx_L6_skip:;
  12839. goto __pyx_L4_argument_unpacking_done;
  12840. __pyx_L3_error:;
  12841. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  12842. Py_XDECREF(values[__pyx_temp]);
  12843. }
  12844. __Pyx_CLEAR(__pyx_v_ts);
  12845. __Pyx_AddTraceback("fontTools.misc.bezierTools._splitCubicAtTC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12846. __Pyx_RefNannyFinishContext();
  12847. return NULL;
  12848. __pyx_L4_argument_unpacking_done:;
  12849. __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);
  12850. /* function exit code */
  12851. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  12852. Py_XDECREF(values[__pyx_temp]);
  12853. }
  12854. __Pyx_DECREF(__pyx_v_ts);
  12855. __Pyx_RefNannyFinishContext();
  12856. return __pyx_r;
  12857. }
  12858. 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) {
  12859. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC *__pyx_cur_scope;
  12860. PyObject *__pyx_r = NULL;
  12861. __Pyx_RefNannyDeclarations
  12862. int __pyx_lineno = 0;
  12863. const char *__pyx_filename = NULL;
  12864. int __pyx_clineno = 0;
  12865. __Pyx_RefNannySetupContext("_splitCubicAtTC", 0);
  12866. __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);
  12867. if (unlikely(!__pyx_cur_scope)) {
  12868. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC *)Py_None);
  12869. __Pyx_INCREF(Py_None);
  12870. __PYX_ERR(0, 770, __pyx_L1_error)
  12871. } else {
  12872. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  12873. }
  12874. __pyx_cur_scope->__pyx_v_a = __pyx_v_a;
  12875. __pyx_cur_scope->__pyx_v_b = __pyx_v_b;
  12876. __pyx_cur_scope->__pyx_v_c = __pyx_v_c;
  12877. __pyx_cur_scope->__pyx_v_d = __pyx_v_d;
  12878. __pyx_cur_scope->__pyx_v_ts = __pyx_v_ts;
  12879. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_ts);
  12880. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_ts);
  12881. {
  12882. __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)
  12883. __Pyx_DECREF(__pyx_cur_scope);
  12884. __Pyx_RefNannyFinishContext();
  12885. return (PyObject *) gen;
  12886. }
  12887. /* function exit code */
  12888. __pyx_L1_error:;
  12889. __Pyx_AddTraceback("fontTools.misc.bezierTools._splitCubicAtTC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12890. __pyx_r = NULL;
  12891. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  12892. __Pyx_XGIVEREF(__pyx_r);
  12893. __Pyx_RefNannyFinishContext();
  12894. return __pyx_r;
  12895. }
  12896. static PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_45generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
  12897. {
  12898. 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);
  12899. PyObject *__pyx_r = NULL;
  12900. PyObject *__pyx_t_1 = NULL;
  12901. PyObject *__pyx_t_2 = NULL;
  12902. int __pyx_t_3;
  12903. Py_ssize_t __pyx_t_4;
  12904. PyObject *__pyx_t_5 = NULL;
  12905. size_t __pyx_t_6;
  12906. PyObject *(*__pyx_t_7)(PyObject *);
  12907. double __pyx_t_8;
  12908. PyObject *__pyx_t_9 = NULL;
  12909. PyObject *__pyx_t_10 = NULL;
  12910. PyObject *__pyx_t_11 = NULL;
  12911. PyObject *__pyx_t_12 = NULL;
  12912. PyObject *(*__pyx_t_13)(PyObject *);
  12913. int __pyx_lineno = 0;
  12914. const char *__pyx_filename = NULL;
  12915. int __pyx_clineno = 0;
  12916. __Pyx_RefNannyDeclarations
  12917. __Pyx_RefNannySetupContext("_splitCubicAtTC", 0);
  12918. switch (__pyx_generator->resume_label) {
  12919. case 0: goto __pyx_L3_first_run;
  12920. case 1: goto __pyx_L8_resume_from_yield;
  12921. default: /* CPython raises the right error here */
  12922. __Pyx_RefNannyFinishContext();
  12923. return NULL;
  12924. }
  12925. __pyx_L3_first_run:;
  12926. if (unlikely(__pyx_sent_value != Py_None)) {
  12927. if (unlikely(__pyx_sent_value)) PyErr_SetString(PyExc_TypeError, "can't send non-None value to a just-started generator");
  12928. __PYX_ERR(0, 770, __pyx_L1_error)
  12929. }
  12930. /* "fontTools/misc/bezierTools.py":786
  12931. * )
  12932. * def _splitCubicAtTC(a, b, c, d, *ts):
  12933. * ts = list(ts) # <<<<<<<<<<<<<<
  12934. * ts.insert(0, 0.0)
  12935. * ts.append(1.0)
  12936. */
  12937. __pyx_t_1 = PySequence_List(__pyx_cur_scope->__pyx_v_ts); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error)
  12938. __Pyx_GOTREF(__pyx_t_1);
  12939. __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_ts);
  12940. __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_ts, __pyx_t_1);
  12941. __Pyx_GIVEREF(__pyx_t_1);
  12942. __pyx_t_1 = 0;
  12943. /* "fontTools/misc/bezierTools.py":787
  12944. * def _splitCubicAtTC(a, b, c, d, *ts):
  12945. * ts = list(ts)
  12946. * ts.insert(0, 0.0) # <<<<<<<<<<<<<<
  12947. * ts.append(1.0)
  12948. * for i in range(len(ts) - 1):
  12949. */
  12950. __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)
  12951. __Pyx_GOTREF(__pyx_t_1);
  12952. __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)
  12953. __Pyx_GOTREF(__pyx_t_2);
  12954. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  12955. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12956. /* "fontTools/misc/bezierTools.py":788
  12957. * ts = list(ts)
  12958. * ts.insert(0, 0.0)
  12959. * ts.append(1.0) # <<<<<<<<<<<<<<
  12960. * for i in range(len(ts) - 1):
  12961. * t1 = ts[i]
  12962. */
  12963. __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)
  12964. /* "fontTools/misc/bezierTools.py":789
  12965. * ts.insert(0, 0.0)
  12966. * ts.append(1.0)
  12967. * for i in range(len(ts) - 1): # <<<<<<<<<<<<<<
  12968. * t1 = ts[i]
  12969. * t2 = ts[i + 1]
  12970. */
  12971. __pyx_t_1 = NULL;
  12972. __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)
  12973. __pyx_t_5 = PyLong_FromSsize_t((__pyx_t_4 - 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 789, __pyx_L1_error)
  12974. __Pyx_GOTREF(__pyx_t_5);
  12975. __pyx_t_6 = 1;
  12976. {
  12977. PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_5};
  12978. __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));
  12979. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  12980. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  12981. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 789, __pyx_L1_error)
  12982. __Pyx_GOTREF(__pyx_t_2);
  12983. }
  12984. __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 789, __pyx_L1_error)
  12985. __Pyx_GOTREF(__pyx_t_5);
  12986. __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)
  12987. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  12988. for (;;) {
  12989. {
  12990. __pyx_t_2 = __pyx_t_7(__pyx_t_5);
  12991. if (unlikely(!__pyx_t_2)) {
  12992. PyObject* exc_type = PyErr_Occurred();
  12993. if (exc_type) {
  12994. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 789, __pyx_L1_error)
  12995. PyErr_Clear();
  12996. }
  12997. break;
  12998. }
  12999. }
  13000. __Pyx_GOTREF(__pyx_t_2);
  13001. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i);
  13002. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_i, __pyx_t_2);
  13003. __Pyx_GIVEREF(__pyx_t_2);
  13004. __pyx_t_2 = 0;
  13005. /* "fontTools/misc/bezierTools.py":790
  13006. * ts.append(1.0)
  13007. * for i in range(len(ts) - 1):
  13008. * t1 = ts[i] # <<<<<<<<<<<<<<
  13009. * t2 = ts[i + 1]
  13010. * delta = t2 - t1
  13011. */
  13012. __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)
  13013. __Pyx_GOTREF(__pyx_t_2);
  13014. __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)
  13015. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13016. __pyx_cur_scope->__pyx_v_t1 = __pyx_t_8;
  13017. /* "fontTools/misc/bezierTools.py":791
  13018. * for i in range(len(ts) - 1):
  13019. * t1 = ts[i]
  13020. * t2 = ts[i + 1] # <<<<<<<<<<<<<<
  13021. * delta = t2 - t1
  13022. *
  13023. */
  13024. __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)
  13025. __Pyx_GOTREF(__pyx_t_2);
  13026. __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)
  13027. __Pyx_GOTREF(__pyx_t_1);
  13028. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13029. __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)
  13030. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13031. __pyx_cur_scope->__pyx_v_t2 = __pyx_t_8;
  13032. /* "fontTools/misc/bezierTools.py":792
  13033. * t1 = ts[i]
  13034. * t2 = ts[i + 1]
  13035. * delta = t2 - t1 # <<<<<<<<<<<<<<
  13036. *
  13037. * delta_2 = delta * delta
  13038. */
  13039. __pyx_cur_scope->__pyx_v_delta = (__pyx_cur_scope->__pyx_v_t2 - __pyx_cur_scope->__pyx_v_t1);
  13040. /* "fontTools/misc/bezierTools.py":794
  13041. * delta = t2 - t1
  13042. *
  13043. * delta_2 = delta * delta # <<<<<<<<<<<<<<
  13044. * delta_3 = delta * delta_2
  13045. * t1_2 = t1 * t1
  13046. */
  13047. __pyx_cur_scope->__pyx_v_delta_2 = (__pyx_cur_scope->__pyx_v_delta * __pyx_cur_scope->__pyx_v_delta);
  13048. /* "fontTools/misc/bezierTools.py":795
  13049. *
  13050. * delta_2 = delta * delta
  13051. * delta_3 = delta * delta_2 # <<<<<<<<<<<<<<
  13052. * t1_2 = t1 * t1
  13053. * t1_3 = t1 * t1_2
  13054. */
  13055. __pyx_cur_scope->__pyx_v_delta_3 = (__pyx_cur_scope->__pyx_v_delta * __pyx_cur_scope->__pyx_v_delta_2);
  13056. /* "fontTools/misc/bezierTools.py":796
  13057. * delta_2 = delta * delta
  13058. * delta_3 = delta * delta_2
  13059. * t1_2 = t1 * t1 # <<<<<<<<<<<<<<
  13060. * t1_3 = t1 * t1_2
  13061. *
  13062. */
  13063. __pyx_cur_scope->__pyx_v_t1_2 = (__pyx_cur_scope->__pyx_v_t1 * __pyx_cur_scope->__pyx_v_t1);
  13064. /* "fontTools/misc/bezierTools.py":797
  13065. * delta_3 = delta * delta_2
  13066. * t1_2 = t1 * t1
  13067. * t1_3 = t1 * t1_2 # <<<<<<<<<<<<<<
  13068. *
  13069. * # calc new a, b, c and d
  13070. */
  13071. __pyx_cur_scope->__pyx_v_t1_3 = (__pyx_cur_scope->__pyx_v_t1 * __pyx_cur_scope->__pyx_v_t1_2);
  13072. /* "fontTools/misc/bezierTools.py":800
  13073. *
  13074. * # calc new a, b, c and d
  13075. * a1 = a * delta_3 # <<<<<<<<<<<<<<
  13076. * b1 = (3 * a * t1 + b) * delta_2
  13077. * c1 = (2 * b * t1 + c + 3 * a * t1_2) * delta
  13078. */
  13079. __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));
  13080. /* "fontTools/misc/bezierTools.py":801
  13081. * # calc new a, b, c and d
  13082. * a1 = a * delta_3
  13083. * b1 = (3 * a * t1 + b) * delta_2 # <<<<<<<<<<<<<<
  13084. * c1 = (2 * b * t1 + c + 3 * a * t1_2) * delta
  13085. * d1 = a * t1_3 + b * t1_2 + c * t1 + d
  13086. */
  13087. __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));
  13088. /* "fontTools/misc/bezierTools.py":802
  13089. * a1 = a * delta_3
  13090. * b1 = (3 * a * t1 + b) * delta_2
  13091. * c1 = (2 * b * t1 + c + 3 * a * t1_2) * delta # <<<<<<<<<<<<<<
  13092. * d1 = a * t1_3 + b * t1_2 + c * t1 + d
  13093. * pt1, pt2, pt3, pt4 = calcCubicPointsC(a1, b1, c1, d1)
  13094. */
  13095. __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));
  13096. /* "fontTools/misc/bezierTools.py":803
  13097. * b1 = (3 * a * t1 + b) * delta_2
  13098. * c1 = (2 * b * t1 + c + 3 * a * t1_2) * delta
  13099. * d1 = a * t1_3 + b * t1_2 + c * t1 + d # <<<<<<<<<<<<<<
  13100. * pt1, pt2, pt3, pt4 = calcCubicPointsC(a1, b1, c1, d1)
  13101. * yield (pt1, pt2, pt3, pt4)
  13102. */
  13103. __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);
  13104. /* "fontTools/misc/bezierTools.py":804
  13105. * c1 = (2 * b * t1 + c + 3 * a * t1_2) * delta
  13106. * d1 = a * t1_3 + b * t1_2 + c * t1 + d
  13107. * pt1, pt2, pt3, pt4 = calcCubicPointsC(a1, b1, c1, d1) # <<<<<<<<<<<<<<
  13108. * yield (pt1, pt2, pt3, pt4)
  13109. *
  13110. */
  13111. __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)
  13112. __Pyx_GOTREF(__pyx_t_1);
  13113. if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
  13114. PyObject* sequence = __pyx_t_1;
  13115. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  13116. if (unlikely(size != 4)) {
  13117. if (size > 4) __Pyx_RaiseTooManyValuesError(4);
  13118. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  13119. __PYX_ERR(0, 804, __pyx_L1_error)
  13120. }
  13121. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  13122. if (likely(PyTuple_CheckExact(sequence))) {
  13123. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  13124. __Pyx_INCREF(__pyx_t_2);
  13125. __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
  13126. __Pyx_INCREF(__pyx_t_9);
  13127. __pyx_t_10 = PyTuple_GET_ITEM(sequence, 2);
  13128. __Pyx_INCREF(__pyx_t_10);
  13129. __pyx_t_11 = PyTuple_GET_ITEM(sequence, 3);
  13130. __Pyx_INCREF(__pyx_t_11);
  13131. } else {
  13132. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  13133. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 804, __pyx_L1_error)
  13134. __Pyx_XGOTREF(__pyx_t_2);
  13135. __pyx_t_9 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  13136. if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 804, __pyx_L1_error)
  13137. __Pyx_XGOTREF(__pyx_t_9);
  13138. __pyx_t_10 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  13139. if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 804, __pyx_L1_error)
  13140. __Pyx_XGOTREF(__pyx_t_10);
  13141. __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 3, __Pyx_ReferenceSharing_SharedReference);
  13142. if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 804, __pyx_L1_error)
  13143. __Pyx_XGOTREF(__pyx_t_11);
  13144. }
  13145. #else
  13146. {
  13147. Py_ssize_t i;
  13148. PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_9,&__pyx_t_10,&__pyx_t_11};
  13149. for (i=0; i < 4; i++) {
  13150. PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 804, __pyx_L1_error)
  13151. __Pyx_GOTREF(item);
  13152. *(temps[i]) = item;
  13153. }
  13154. }
  13155. #endif
  13156. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13157. } else {
  13158. Py_ssize_t index = -1;
  13159. PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_9,&__pyx_t_10,&__pyx_t_11};
  13160. __pyx_t_12 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 804, __pyx_L1_error)
  13161. __Pyx_GOTREF(__pyx_t_12);
  13162. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13163. __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_12);
  13164. for (index=0; index < 4; index++) {
  13165. PyObject* item = __pyx_t_13(__pyx_t_12); if (unlikely(!item)) goto __pyx_L6_unpacking_failed;
  13166. __Pyx_GOTREF(item);
  13167. *(temps[index]) = item;
  13168. }
  13169. if (__Pyx_IternextUnpackEndCheck(__pyx_t_13(__pyx_t_12), 4) < (0)) __PYX_ERR(0, 804, __pyx_L1_error)
  13170. __pyx_t_13 = NULL;
  13171. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  13172. goto __pyx_L7_unpacking_done;
  13173. __pyx_L6_unpacking_failed:;
  13174. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  13175. __pyx_t_13 = NULL;
  13176. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  13177. __PYX_ERR(0, 804, __pyx_L1_error)
  13178. __pyx_L7_unpacking_done:;
  13179. }
  13180. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_pt1);
  13181. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pt1, __pyx_t_2);
  13182. __Pyx_GIVEREF(__pyx_t_2);
  13183. __pyx_t_2 = 0;
  13184. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_pt2);
  13185. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pt2, __pyx_t_9);
  13186. __Pyx_GIVEREF(__pyx_t_9);
  13187. __pyx_t_9 = 0;
  13188. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_pt3);
  13189. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pt3, __pyx_t_10);
  13190. __Pyx_GIVEREF(__pyx_t_10);
  13191. __pyx_t_10 = 0;
  13192. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_pt4);
  13193. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_pt4, __pyx_t_11);
  13194. __Pyx_GIVEREF(__pyx_t_11);
  13195. __pyx_t_11 = 0;
  13196. /* "fontTools/misc/bezierTools.py":805
  13197. * d1 = a * t1_3 + b * t1_2 + c * t1 + d
  13198. * pt1, pt2, pt3, pt4 = calcCubicPointsC(a1, b1, c1, d1)
  13199. * yield (pt1, pt2, pt3, pt4) # <<<<<<<<<<<<<<
  13200. *
  13201. *
  13202. */
  13203. __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 805, __pyx_L1_error)
  13204. __Pyx_GOTREF(__pyx_t_1);
  13205. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pt1);
  13206. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_pt1);
  13207. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_pt1) != (0)) __PYX_ERR(0, 805, __pyx_L1_error);
  13208. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pt2);
  13209. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_pt2);
  13210. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_cur_scope->__pyx_v_pt2) != (0)) __PYX_ERR(0, 805, __pyx_L1_error);
  13211. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pt3);
  13212. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_pt3);
  13213. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_cur_scope->__pyx_v_pt3) != (0)) __PYX_ERR(0, 805, __pyx_L1_error);
  13214. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_pt4);
  13215. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_pt4);
  13216. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_cur_scope->__pyx_v_pt4) != (0)) __PYX_ERR(0, 805, __pyx_L1_error);
  13217. __pyx_r = __pyx_t_1;
  13218. __pyx_t_1 = 0;
  13219. __Pyx_XGIVEREF(__pyx_t_5);
  13220. __pyx_cur_scope->__pyx_t_0 = __pyx_t_5;
  13221. __pyx_cur_scope->__pyx_t_1 = __pyx_t_7;
  13222. __Pyx_XGIVEREF(__pyx_r);
  13223. __Pyx_RefNannyFinishContext();
  13224. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  13225. /* return from generator, yielding value */
  13226. __pyx_generator->resume_label = 1;
  13227. return __pyx_r;
  13228. __pyx_L8_resume_from_yield:;
  13229. __pyx_t_5 = __pyx_cur_scope->__pyx_t_0;
  13230. __pyx_cur_scope->__pyx_t_0 = 0;
  13231. __Pyx_XGOTREF(__pyx_t_5);
  13232. __pyx_t_7 = __pyx_cur_scope->__pyx_t_1;
  13233. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 805, __pyx_L1_error)
  13234. /* "fontTools/misc/bezierTools.py":789
  13235. * ts.insert(0, 0.0)
  13236. * ts.append(1.0)
  13237. * for i in range(len(ts) - 1): # <<<<<<<<<<<<<<
  13238. * t1 = ts[i]
  13239. * t2 = ts[i + 1]
  13240. */
  13241. }
  13242. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  13243. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  13244. /* "fontTools/misc/bezierTools.py":770
  13245. *
  13246. *
  13247. * @cython.locals( # <<<<<<<<<<<<<<
  13248. * a=cython.complex,
  13249. * b=cython.complex,
  13250. */
  13251. /* function exit code */
  13252. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  13253. goto __pyx_L0;
  13254. __pyx_L1_error:;
  13255. __Pyx_XDECREF(__pyx_t_1);
  13256. __Pyx_XDECREF(__pyx_t_2);
  13257. __Pyx_XDECREF(__pyx_t_5);
  13258. __Pyx_XDECREF(__pyx_t_9);
  13259. __Pyx_XDECREF(__pyx_t_10);
  13260. __Pyx_XDECREF(__pyx_t_11);
  13261. __Pyx_XDECREF(__pyx_t_12);
  13262. if (__Pyx_PyErr_Occurred()) {
  13263. __Pyx_Generator_Replace_StopIteration(0);
  13264. __Pyx_AddTraceback("_splitCubicAtTC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  13265. }
  13266. __pyx_L0:;
  13267. __Pyx_XGIVEREF(__pyx_r);
  13268. #if !CYTHON_USE_EXC_INFO_STACK
  13269. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  13270. #endif
  13271. __pyx_generator->resume_label = -1;
  13272. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  13273. __Pyx_RefNannyFinishContext();
  13274. return __pyx_r;
  13275. }
  13276. /* "fontTools/misc/bezierTools.py":815
  13277. *
  13278. *
  13279. * def solveQuadratic(a, b, c, sqrt=sqrt): # <<<<<<<<<<<<<<
  13280. * """Solve a quadratic equation.
  13281. *
  13282. */
  13283. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_96__defaults__(CYTHON_UNUSED PyObject *__pyx_self) {
  13284. PyObject *__pyx_r = NULL;
  13285. __Pyx_RefNannyDeclarations
  13286. PyObject *__pyx_t_1 = NULL;
  13287. PyObject *__pyx_t_2 = NULL;
  13288. int __pyx_lineno = 0;
  13289. const char *__pyx_filename = NULL;
  13290. int __pyx_clineno = 0;
  13291. __Pyx_RefNannySetupContext("__defaults__", 0);
  13292. __Pyx_XDECREF(__pyx_r);
  13293. __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 815, __pyx_L1_error)
  13294. __Pyx_GOTREF(__pyx_t_1);
  13295. __Pyx_INCREF(__Pyx_CyFunction_Defaults(struct __pyx_defaults, __pyx_self)->arg0);
  13296. __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(struct __pyx_defaults, __pyx_self)->arg0);
  13297. 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);
  13298. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 815, __pyx_L1_error)
  13299. __Pyx_GOTREF(__pyx_t_2);
  13300. __Pyx_GIVEREF(__pyx_t_1);
  13301. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 815, __pyx_L1_error);
  13302. __Pyx_INCREF(Py_None);
  13303. __Pyx_GIVEREF(Py_None);
  13304. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None) != (0)) __PYX_ERR(0, 815, __pyx_L1_error);
  13305. __pyx_t_1 = 0;
  13306. __pyx_r = __pyx_t_2;
  13307. __pyx_t_2 = 0;
  13308. goto __pyx_L0;
  13309. /* function exit code */
  13310. __pyx_L1_error:;
  13311. __Pyx_XDECREF(__pyx_t_1);
  13312. __Pyx_XDECREF(__pyx_t_2);
  13313. __Pyx_AddTraceback("fontTools.misc.bezierTools.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  13314. __pyx_r = NULL;
  13315. __pyx_L0:;
  13316. __Pyx_XGIVEREF(__pyx_r);
  13317. __Pyx_RefNannyFinishContext();
  13318. return __pyx_r;
  13319. }
  13320. /* Python wrapper */
  13321. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_47solveQuadratic(PyObject *__pyx_self,
  13322. #if CYTHON_METH_FASTCALL
  13323. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  13324. #else
  13325. PyObject *__pyx_args, PyObject *__pyx_kwds
  13326. #endif
  13327. ); /*proto*/
  13328. 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!");
  13329. 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};
  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. ) {
  13337. PyObject *__pyx_v_a = 0;
  13338. PyObject *__pyx_v_b = 0;
  13339. PyObject *__pyx_v_c = 0;
  13340. PyObject *__pyx_v_sqrt = 0;
  13341. #if !CYTHON_METH_FASTCALL
  13342. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  13343. #endif
  13344. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  13345. PyObject* values[4] = {0,0,0,0};
  13346. int __pyx_lineno = 0;
  13347. const char *__pyx_filename = NULL;
  13348. int __pyx_clineno = 0;
  13349. PyObject *__pyx_r = 0;
  13350. __Pyx_RefNannyDeclarations
  13351. __Pyx_RefNannySetupContext("solveQuadratic (wrapper)", 0);
  13352. #if !CYTHON_METH_FASTCALL
  13353. #if CYTHON_ASSUME_SAFE_SIZE
  13354. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  13355. #else
  13356. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  13357. #endif
  13358. #endif
  13359. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  13360. {
  13361. 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};
  13362. struct __pyx_defaults *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(struct __pyx_defaults, __pyx_self);
  13363. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  13364. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 815, __pyx_L3_error)
  13365. if (__pyx_kwds_len > 0) {
  13366. switch (__pyx_nargs) {
  13367. case 4:
  13368. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  13369. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 815, __pyx_L3_error)
  13370. CYTHON_FALLTHROUGH;
  13371. case 3:
  13372. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  13373. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 815, __pyx_L3_error)
  13374. CYTHON_FALLTHROUGH;
  13375. case 2:
  13376. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  13377. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 815, __pyx_L3_error)
  13378. CYTHON_FALLTHROUGH;
  13379. case 1:
  13380. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  13381. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 815, __pyx_L3_error)
  13382. CYTHON_FALLTHROUGH;
  13383. case 0: break;
  13384. default: goto __pyx_L5_argtuple_error;
  13385. }
  13386. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  13387. 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)
  13388. if (!values[3]) values[3] = __Pyx_NewRef(__pyx_dynamic_args->arg0);
  13389. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  13390. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("solveQuadratic", 0, 3, 4, i); __PYX_ERR(0, 815, __pyx_L3_error) }
  13391. }
  13392. } else {
  13393. switch (__pyx_nargs) {
  13394. case 4:
  13395. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  13396. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 815, __pyx_L3_error)
  13397. CYTHON_FALLTHROUGH;
  13398. case 3:
  13399. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  13400. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 815, __pyx_L3_error)
  13401. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  13402. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 815, __pyx_L3_error)
  13403. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  13404. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 815, __pyx_L3_error)
  13405. break;
  13406. default: goto __pyx_L5_argtuple_error;
  13407. }
  13408. if (!values[3]) values[3] = __Pyx_NewRef(__pyx_dynamic_args->arg0);
  13409. }
  13410. __pyx_v_a = values[0];
  13411. __pyx_v_b = values[1];
  13412. __pyx_v_c = values[2];
  13413. __pyx_v_sqrt = values[3];
  13414. }
  13415. goto __pyx_L6_skip;
  13416. __pyx_L5_argtuple_error:;
  13417. __Pyx_RaiseArgtupleInvalid("solveQuadratic", 0, 3, 4, __pyx_nargs); __PYX_ERR(0, 815, __pyx_L3_error)
  13418. __pyx_L6_skip:;
  13419. goto __pyx_L4_argument_unpacking_done;
  13420. __pyx_L3_error:;
  13421. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  13422. Py_XDECREF(values[__pyx_temp]);
  13423. }
  13424. __Pyx_AddTraceback("fontTools.misc.bezierTools.solveQuadratic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  13425. __Pyx_RefNannyFinishContext();
  13426. return NULL;
  13427. __pyx_L4_argument_unpacking_done:;
  13428. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_46solveQuadratic(__pyx_self, __pyx_v_a, __pyx_v_b, __pyx_v_c, __pyx_v_sqrt);
  13429. /* function exit code */
  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_RefNannyFinishContext();
  13434. return __pyx_r;
  13435. }
  13436. 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) {
  13437. PyObject *__pyx_v_roots = NULL;
  13438. PyObject *__pyx_v_DD = NULL;
  13439. PyObject *__pyx_v_rDD = NULL;
  13440. PyObject *__pyx_r = NULL;
  13441. __Pyx_RefNannyDeclarations
  13442. PyObject *__pyx_t_1 = NULL;
  13443. PyObject *__pyx_t_2 = NULL;
  13444. PyObject *__pyx_t_3 = NULL;
  13445. int __pyx_t_4;
  13446. size_t __pyx_t_5;
  13447. int __pyx_lineno = 0;
  13448. const char *__pyx_filename = NULL;
  13449. int __pyx_clineno = 0;
  13450. __Pyx_RefNannySetupContext("solveQuadratic", 0);
  13451. /* "fontTools/misc/bezierTools.py":829
  13452. * be sorted nor to contain unique values!
  13453. * """
  13454. * if abs(a) < epsilon: # <<<<<<<<<<<<<<
  13455. * if abs(b) < epsilon:
  13456. * # We have a non-equation; therefore, we have no valid solution
  13457. */
  13458. __pyx_t_1 = __Pyx_PyNumber_Absolute(__pyx_v_a); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 829, __pyx_L1_error)
  13459. __Pyx_GOTREF(__pyx_t_1);
  13460. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 829, __pyx_L1_error)
  13461. __Pyx_GOTREF(__pyx_t_2);
  13462. __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)
  13463. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13464. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13465. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 829, __pyx_L1_error)
  13466. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13467. if (__pyx_t_4) {
  13468. /* "fontTools/misc/bezierTools.py":830
  13469. * """
  13470. * if abs(a) < epsilon:
  13471. * if abs(b) < epsilon: # <<<<<<<<<<<<<<
  13472. * # We have a non-equation; therefore, we have no valid solution
  13473. * roots = []
  13474. */
  13475. __pyx_t_3 = __Pyx_PyNumber_Absolute(__pyx_v_b); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 830, __pyx_L1_error)
  13476. __Pyx_GOTREF(__pyx_t_3);
  13477. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 830, __pyx_L1_error)
  13478. __Pyx_GOTREF(__pyx_t_2);
  13479. __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)
  13480. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13481. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13482. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 830, __pyx_L1_error)
  13483. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13484. if (__pyx_t_4) {
  13485. /* "fontTools/misc/bezierTools.py":832
  13486. * if abs(b) < epsilon:
  13487. * # We have a non-equation; therefore, we have no valid solution
  13488. * roots = [] # <<<<<<<<<<<<<<
  13489. * else:
  13490. * # We have a linear equation with 1 root.
  13491. */
  13492. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 832, __pyx_L1_error)
  13493. __Pyx_GOTREF(__pyx_t_1);
  13494. __pyx_v_roots = ((PyObject*)__pyx_t_1);
  13495. __pyx_t_1 = 0;
  13496. /* "fontTools/misc/bezierTools.py":830
  13497. * """
  13498. * if abs(a) < epsilon:
  13499. * if abs(b) < epsilon: # <<<<<<<<<<<<<<
  13500. * # We have a non-equation; therefore, we have no valid solution
  13501. * roots = []
  13502. */
  13503. goto __pyx_L4;
  13504. }
  13505. /* "fontTools/misc/bezierTools.py":835
  13506. * else:
  13507. * # We have a linear equation with 1 root.
  13508. * roots = [-c / b] # <<<<<<<<<<<<<<
  13509. * else:
  13510. * # We have a true quadratic equation. Apply the quadratic formula to find two roots.
  13511. */
  13512. /*else*/ {
  13513. __pyx_t_1 = PyNumber_Negative(__pyx_v_c); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 835, __pyx_L1_error)
  13514. __Pyx_GOTREF(__pyx_t_1);
  13515. __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 835, __pyx_L1_error)
  13516. __Pyx_GOTREF(__pyx_t_2);
  13517. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13518. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 835, __pyx_L1_error)
  13519. __Pyx_GOTREF(__pyx_t_1);
  13520. __Pyx_GIVEREF(__pyx_t_2);
  13521. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 835, __pyx_L1_error);
  13522. __pyx_t_2 = 0;
  13523. __pyx_v_roots = ((PyObject*)__pyx_t_1);
  13524. __pyx_t_1 = 0;
  13525. }
  13526. __pyx_L4:;
  13527. /* "fontTools/misc/bezierTools.py":829
  13528. * be sorted nor to contain unique values!
  13529. * """
  13530. * if abs(a) < epsilon: # <<<<<<<<<<<<<<
  13531. * if abs(b) < epsilon:
  13532. * # We have a non-equation; therefore, we have no valid solution
  13533. */
  13534. goto __pyx_L3;
  13535. }
  13536. /* "fontTools/misc/bezierTools.py":838
  13537. * else:
  13538. * # We have a true quadratic equation. Apply the quadratic formula to find two roots.
  13539. * DD = b * b - 4.0 * a * c # <<<<<<<<<<<<<<
  13540. * if DD >= 0.0:
  13541. * rDD = sqrt(DD)
  13542. */
  13543. /*else*/ {
  13544. __pyx_t_1 = PyNumber_Multiply(__pyx_v_b, __pyx_v_b); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 838, __pyx_L1_error)
  13545. __Pyx_GOTREF(__pyx_t_1);
  13546. __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)
  13547. __Pyx_GOTREF(__pyx_t_2);
  13548. __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_v_c); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 838, __pyx_L1_error)
  13549. __Pyx_GOTREF(__pyx_t_3);
  13550. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13551. __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 838, __pyx_L1_error)
  13552. __Pyx_GOTREF(__pyx_t_2);
  13553. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13554. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13555. __pyx_v_DD = __pyx_t_2;
  13556. __pyx_t_2 = 0;
  13557. /* "fontTools/misc/bezierTools.py":839
  13558. * # We have a true quadratic equation. Apply the quadratic formula to find two roots.
  13559. * DD = b * b - 4.0 * a * c
  13560. * if DD >= 0.0: # <<<<<<<<<<<<<<
  13561. * rDD = sqrt(DD)
  13562. * roots = [(-b + rDD) / 2.0 / a, (-b - rDD) / 2.0 / a]
  13563. */
  13564. __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)
  13565. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 839, __pyx_L1_error)
  13566. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13567. if (__pyx_t_4) {
  13568. /* "fontTools/misc/bezierTools.py":840
  13569. * DD = b * b - 4.0 * a * c
  13570. * if DD >= 0.0:
  13571. * rDD = sqrt(DD) # <<<<<<<<<<<<<<
  13572. * roots = [(-b + rDD) / 2.0 / a, (-b - rDD) / 2.0 / a]
  13573. * else:
  13574. */
  13575. __pyx_t_3 = NULL;
  13576. __Pyx_INCREF(__pyx_v_sqrt);
  13577. __pyx_t_1 = __pyx_v_sqrt;
  13578. __pyx_t_5 = 1;
  13579. #if CYTHON_UNPACK_METHODS
  13580. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  13581. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
  13582. assert(__pyx_t_3);
  13583. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  13584. __Pyx_INCREF(__pyx_t_3);
  13585. __Pyx_INCREF(__pyx__function);
  13586. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  13587. __pyx_t_5 = 0;
  13588. }
  13589. #endif
  13590. {
  13591. PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_DD};
  13592. __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));
  13593. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  13594. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13595. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 840, __pyx_L1_error)
  13596. __Pyx_GOTREF(__pyx_t_2);
  13597. }
  13598. __pyx_v_rDD = __pyx_t_2;
  13599. __pyx_t_2 = 0;
  13600. /* "fontTools/misc/bezierTools.py":841
  13601. * if DD >= 0.0:
  13602. * rDD = sqrt(DD)
  13603. * roots = [(-b + rDD) / 2.0 / a, (-b - rDD) / 2.0 / a] # <<<<<<<<<<<<<<
  13604. * else:
  13605. * # complex roots, ignore
  13606. */
  13607. __pyx_t_2 = PyNumber_Negative(__pyx_v_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 841, __pyx_L1_error)
  13608. __Pyx_GOTREF(__pyx_t_2);
  13609. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_rDD); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 841, __pyx_L1_error)
  13610. __Pyx_GOTREF(__pyx_t_1);
  13611. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13612. __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)
  13613. __Pyx_GOTREF(__pyx_t_2);
  13614. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13615. __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_v_a); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 841, __pyx_L1_error)
  13616. __Pyx_GOTREF(__pyx_t_1);
  13617. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13618. __pyx_t_2 = PyNumber_Negative(__pyx_v_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 841, __pyx_L1_error)
  13619. __Pyx_GOTREF(__pyx_t_2);
  13620. __pyx_t_3 = PyNumber_Subtract(__pyx_t_2, __pyx_v_rDD); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 841, __pyx_L1_error)
  13621. __Pyx_GOTREF(__pyx_t_3);
  13622. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13623. __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)
  13624. __Pyx_GOTREF(__pyx_t_2);
  13625. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13626. __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_v_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 841, __pyx_L1_error)
  13627. __Pyx_GOTREF(__pyx_t_3);
  13628. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13629. __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 841, __pyx_L1_error)
  13630. __Pyx_GOTREF(__pyx_t_2);
  13631. __Pyx_GIVEREF(__pyx_t_1);
  13632. if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 841, __pyx_L1_error);
  13633. __Pyx_GIVEREF(__pyx_t_3);
  13634. if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 841, __pyx_L1_error);
  13635. __pyx_t_1 = 0;
  13636. __pyx_t_3 = 0;
  13637. __pyx_v_roots = ((PyObject*)__pyx_t_2);
  13638. __pyx_t_2 = 0;
  13639. /* "fontTools/misc/bezierTools.py":839
  13640. * # We have a true quadratic equation. Apply the quadratic formula to find two roots.
  13641. * DD = b * b - 4.0 * a * c
  13642. * if DD >= 0.0: # <<<<<<<<<<<<<<
  13643. * rDD = sqrt(DD)
  13644. * roots = [(-b + rDD) / 2.0 / a, (-b - rDD) / 2.0 / a]
  13645. */
  13646. goto __pyx_L5;
  13647. }
  13648. /* "fontTools/misc/bezierTools.py":844
  13649. * else:
  13650. * # complex roots, ignore
  13651. * roots = [] # <<<<<<<<<<<<<<
  13652. * return roots
  13653. *
  13654. */
  13655. /*else*/ {
  13656. __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 844, __pyx_L1_error)
  13657. __Pyx_GOTREF(__pyx_t_2);
  13658. __pyx_v_roots = ((PyObject*)__pyx_t_2);
  13659. __pyx_t_2 = 0;
  13660. }
  13661. __pyx_L5:;
  13662. }
  13663. __pyx_L3:;
  13664. /* "fontTools/misc/bezierTools.py":845
  13665. * # complex roots, ignore
  13666. * roots = []
  13667. * return roots # <<<<<<<<<<<<<<
  13668. *
  13669. *
  13670. */
  13671. __Pyx_XDECREF(__pyx_r);
  13672. __Pyx_INCREF(__pyx_v_roots);
  13673. __pyx_r = __pyx_v_roots;
  13674. goto __pyx_L0;
  13675. /* "fontTools/misc/bezierTools.py":815
  13676. *
  13677. *
  13678. * def solveQuadratic(a, b, c, sqrt=sqrt): # <<<<<<<<<<<<<<
  13679. * """Solve a quadratic equation.
  13680. *
  13681. */
  13682. /* function exit code */
  13683. __pyx_L1_error:;
  13684. __Pyx_XDECREF(__pyx_t_1);
  13685. __Pyx_XDECREF(__pyx_t_2);
  13686. __Pyx_XDECREF(__pyx_t_3);
  13687. __Pyx_AddTraceback("fontTools.misc.bezierTools.solveQuadratic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  13688. __pyx_r = NULL;
  13689. __pyx_L0:;
  13690. __Pyx_XDECREF(__pyx_v_roots);
  13691. __Pyx_XDECREF(__pyx_v_DD);
  13692. __Pyx_XDECREF(__pyx_v_rDD);
  13693. __Pyx_XGIVEREF(__pyx_r);
  13694. __Pyx_RefNannyFinishContext();
  13695. return __pyx_r;
  13696. }
  13697. /* "fontTools/misc/bezierTools.py":848
  13698. *
  13699. *
  13700. * def solveCubic(a, b, c, d): # <<<<<<<<<<<<<<
  13701. * """Solve a cubic equation.
  13702. *
  13703. */
  13704. /* Python wrapper */
  13705. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_49solveCubic(PyObject *__pyx_self,
  13706. #if CYTHON_METH_FASTCALL
  13707. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  13708. #else
  13709. PyObject *__pyx_args, PyObject *__pyx_kwds
  13710. #endif
  13711. ); /*proto*/
  13712. 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");
  13713. 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};
  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. ) {
  13721. PyObject *__pyx_v_a = 0;
  13722. PyObject *__pyx_v_b = 0;
  13723. PyObject *__pyx_v_c = 0;
  13724. PyObject *__pyx_v_d = 0;
  13725. #if !CYTHON_METH_FASTCALL
  13726. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  13727. #endif
  13728. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  13729. PyObject* values[4] = {0,0,0,0};
  13730. int __pyx_lineno = 0;
  13731. const char *__pyx_filename = NULL;
  13732. int __pyx_clineno = 0;
  13733. PyObject *__pyx_r = 0;
  13734. __Pyx_RefNannyDeclarations
  13735. __Pyx_RefNannySetupContext("solveCubic (wrapper)", 0);
  13736. #if !CYTHON_METH_FASTCALL
  13737. #if CYTHON_ASSUME_SAFE_SIZE
  13738. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  13739. #else
  13740. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  13741. #endif
  13742. #endif
  13743. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  13744. {
  13745. 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};
  13746. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  13747. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 848, __pyx_L3_error)
  13748. if (__pyx_kwds_len > 0) {
  13749. switch (__pyx_nargs) {
  13750. case 4:
  13751. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  13752. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 848, __pyx_L3_error)
  13753. CYTHON_FALLTHROUGH;
  13754. case 3:
  13755. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  13756. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 848, __pyx_L3_error)
  13757. CYTHON_FALLTHROUGH;
  13758. case 2:
  13759. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  13760. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 848, __pyx_L3_error)
  13761. CYTHON_FALLTHROUGH;
  13762. case 1:
  13763. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  13764. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 848, __pyx_L3_error)
  13765. CYTHON_FALLTHROUGH;
  13766. case 0: break;
  13767. default: goto __pyx_L5_argtuple_error;
  13768. }
  13769. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  13770. 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)
  13771. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  13772. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("solveCubic", 1, 4, 4, i); __PYX_ERR(0, 848, __pyx_L3_error) }
  13773. }
  13774. } else if (unlikely(__pyx_nargs != 4)) {
  13775. goto __pyx_L5_argtuple_error;
  13776. } else {
  13777. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  13778. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 848, __pyx_L3_error)
  13779. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  13780. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 848, __pyx_L3_error)
  13781. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  13782. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 848, __pyx_L3_error)
  13783. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  13784. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 848, __pyx_L3_error)
  13785. }
  13786. __pyx_v_a = values[0];
  13787. __pyx_v_b = values[1];
  13788. __pyx_v_c = values[2];
  13789. __pyx_v_d = values[3];
  13790. }
  13791. goto __pyx_L6_skip;
  13792. __pyx_L5_argtuple_error:;
  13793. __Pyx_RaiseArgtupleInvalid("solveCubic", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 848, __pyx_L3_error)
  13794. __pyx_L6_skip:;
  13795. goto __pyx_L4_argument_unpacking_done;
  13796. __pyx_L3_error:;
  13797. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  13798. Py_XDECREF(values[__pyx_temp]);
  13799. }
  13800. __Pyx_AddTraceback("fontTools.misc.bezierTools.solveCubic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  13801. __Pyx_RefNannyFinishContext();
  13802. return NULL;
  13803. __pyx_L4_argument_unpacking_done:;
  13804. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_48solveCubic(__pyx_self, __pyx_v_a, __pyx_v_b, __pyx_v_c, __pyx_v_d);
  13805. /* function exit code */
  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_RefNannyFinishContext();
  13810. return __pyx_r;
  13811. }
  13812. 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) {
  13813. PyObject *__pyx_v_a1 = NULL;
  13814. PyObject *__pyx_v_a2 = NULL;
  13815. PyObject *__pyx_v_a3 = NULL;
  13816. PyObject *__pyx_v_Q = NULL;
  13817. PyObject *__pyx_v_R = NULL;
  13818. PyObject *__pyx_v_R2 = NULL;
  13819. PyObject *__pyx_v_Q3 = NULL;
  13820. PyObject *__pyx_v_R2_Q3 = NULL;
  13821. PyObject *__pyx_v_x = NULL;
  13822. PyObject *__pyx_v_theta = NULL;
  13823. PyObject *__pyx_v_rQ2 = NULL;
  13824. PyObject *__pyx_v_a1_3 = NULL;
  13825. PyObject *__pyx_v_x0 = NULL;
  13826. PyObject *__pyx_v_x1 = NULL;
  13827. PyObject *__pyx_v_x2 = NULL;
  13828. PyObject *__pyx_r = NULL;
  13829. __Pyx_RefNannyDeclarations
  13830. PyObject *__pyx_t_1 = NULL;
  13831. PyObject *__pyx_t_2 = NULL;
  13832. PyObject *__pyx_t_3 = NULL;
  13833. int __pyx_t_4;
  13834. size_t __pyx_t_5;
  13835. PyObject *__pyx_t_6 = NULL;
  13836. int __pyx_t_7;
  13837. double __pyx_t_8;
  13838. double __pyx_t_9;
  13839. PyObject *__pyx_t_10 = NULL;
  13840. PyObject *__pyx_t_11 = NULL;
  13841. PyObject *__pyx_t_12 = NULL;
  13842. int __pyx_lineno = 0;
  13843. const char *__pyx_filename = NULL;
  13844. int __pyx_clineno = 0;
  13845. __Pyx_RefNannySetupContext("solveCubic", 0);
  13846. __Pyx_INCREF(__pyx_v_a);
  13847. /* "fontTools/misc/bezierTools.py":886
  13848. * # found at: http://www.strangecreations.com/library/snippets/Cubic.C
  13849. * #
  13850. * if abs(a) < epsilon: # <<<<<<<<<<<<<<
  13851. * # don't just test for zero; for very small values of 'a' solveCubic()
  13852. * # returns unreliable results, so we fall back to quad.
  13853. */
  13854. __pyx_t_1 = __Pyx_PyNumber_Absolute(__pyx_v_a); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 886, __pyx_L1_error)
  13855. __Pyx_GOTREF(__pyx_t_1);
  13856. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 886, __pyx_L1_error)
  13857. __Pyx_GOTREF(__pyx_t_2);
  13858. __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)
  13859. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13860. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13861. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 886, __pyx_L1_error)
  13862. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13863. if (__pyx_t_4) {
  13864. /* "fontTools/misc/bezierTools.py":889
  13865. * # don't just test for zero; for very small values of 'a' solveCubic()
  13866. * # returns unreliable results, so we fall back to quad.
  13867. * return solveQuadratic(b, c, d) # <<<<<<<<<<<<<<
  13868. * a = float(a)
  13869. * a1 = b / a
  13870. */
  13871. __Pyx_XDECREF(__pyx_r);
  13872. __pyx_t_2 = NULL;
  13873. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_solveQuadratic); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 889, __pyx_L1_error)
  13874. __Pyx_GOTREF(__pyx_t_1);
  13875. __pyx_t_5 = 1;
  13876. #if CYTHON_UNPACK_METHODS
  13877. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  13878. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
  13879. assert(__pyx_t_2);
  13880. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  13881. __Pyx_INCREF(__pyx_t_2);
  13882. __Pyx_INCREF(__pyx__function);
  13883. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  13884. __pyx_t_5 = 0;
  13885. }
  13886. #endif
  13887. {
  13888. PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_b, __pyx_v_c, __pyx_v_d};
  13889. __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));
  13890. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  13891. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13892. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 889, __pyx_L1_error)
  13893. __Pyx_GOTREF(__pyx_t_3);
  13894. }
  13895. __pyx_r = __pyx_t_3;
  13896. __pyx_t_3 = 0;
  13897. goto __pyx_L0;
  13898. /* "fontTools/misc/bezierTools.py":886
  13899. * # found at: http://www.strangecreations.com/library/snippets/Cubic.C
  13900. * #
  13901. * if abs(a) < epsilon: # <<<<<<<<<<<<<<
  13902. * # don't just test for zero; for very small values of 'a' solveCubic()
  13903. * # returns unreliable results, so we fall back to quad.
  13904. */
  13905. }
  13906. /* "fontTools/misc/bezierTools.py":890
  13907. * # returns unreliable results, so we fall back to quad.
  13908. * return solveQuadratic(b, c, d)
  13909. * a = float(a) # <<<<<<<<<<<<<<
  13910. * a1 = b / a
  13911. * a2 = c / a
  13912. */
  13913. __pyx_t_3 = __Pyx_PyNumber_Float(__pyx_v_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 890, __pyx_L1_error)
  13914. __Pyx_GOTREF(__pyx_t_3);
  13915. __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_3);
  13916. __pyx_t_3 = 0;
  13917. /* "fontTools/misc/bezierTools.py":891
  13918. * return solveQuadratic(b, c, d)
  13919. * a = float(a)
  13920. * a1 = b / a # <<<<<<<<<<<<<<
  13921. * a2 = c / a
  13922. * a3 = d / a
  13923. */
  13924. __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_v_b, __pyx_v_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 891, __pyx_L1_error)
  13925. __Pyx_GOTREF(__pyx_t_3);
  13926. __pyx_v_a1 = __pyx_t_3;
  13927. __pyx_t_3 = 0;
  13928. /* "fontTools/misc/bezierTools.py":892
  13929. * a = float(a)
  13930. * a1 = b / a
  13931. * a2 = c / a # <<<<<<<<<<<<<<
  13932. * a3 = d / a
  13933. *
  13934. */
  13935. __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_v_c, __pyx_v_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 892, __pyx_L1_error)
  13936. __Pyx_GOTREF(__pyx_t_3);
  13937. __pyx_v_a2 = __pyx_t_3;
  13938. __pyx_t_3 = 0;
  13939. /* "fontTools/misc/bezierTools.py":893
  13940. * a1 = b / a
  13941. * a2 = c / a
  13942. * a3 = d / a # <<<<<<<<<<<<<<
  13943. *
  13944. * Q = (a1 * a1 - 3.0 * a2) / 9.0
  13945. */
  13946. __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_v_d, __pyx_v_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 893, __pyx_L1_error)
  13947. __Pyx_GOTREF(__pyx_t_3);
  13948. __pyx_v_a3 = __pyx_t_3;
  13949. __pyx_t_3 = 0;
  13950. /* "fontTools/misc/bezierTools.py":895
  13951. * a3 = d / a
  13952. *
  13953. * Q = (a1 * a1 - 3.0 * a2) / 9.0 # <<<<<<<<<<<<<<
  13954. * R = (2.0 * a1 * a1 * a1 - 9.0 * a1 * a2 + 27.0 * a3) / 54.0
  13955. *
  13956. */
  13957. __pyx_t_3 = PyNumber_Multiply(__pyx_v_a1, __pyx_v_a1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 895, __pyx_L1_error)
  13958. __Pyx_GOTREF(__pyx_t_3);
  13959. __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)
  13960. __Pyx_GOTREF(__pyx_t_1);
  13961. __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 895, __pyx_L1_error)
  13962. __Pyx_GOTREF(__pyx_t_2);
  13963. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13964. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13965. __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)
  13966. __Pyx_GOTREF(__pyx_t_1);
  13967. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13968. __pyx_v_Q = __pyx_t_1;
  13969. __pyx_t_1 = 0;
  13970. /* "fontTools/misc/bezierTools.py":896
  13971. *
  13972. * Q = (a1 * a1 - 3.0 * a2) / 9.0
  13973. * R = (2.0 * a1 * a1 * a1 - 9.0 * a1 * a2 + 27.0 * a3) / 54.0 # <<<<<<<<<<<<<<
  13974. *
  13975. * R2 = R * R
  13976. */
  13977. __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)
  13978. __Pyx_GOTREF(__pyx_t_1);
  13979. __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_a1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 896, __pyx_L1_error)
  13980. __Pyx_GOTREF(__pyx_t_2);
  13981. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13982. __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_v_a1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 896, __pyx_L1_error)
  13983. __Pyx_GOTREF(__pyx_t_1);
  13984. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13985. __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)
  13986. __Pyx_GOTREF(__pyx_t_2);
  13987. __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_v_a2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 896, __pyx_L1_error)
  13988. __Pyx_GOTREF(__pyx_t_3);
  13989. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13990. __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 896, __pyx_L1_error)
  13991. __Pyx_GOTREF(__pyx_t_2);
  13992. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  13993. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13994. __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)
  13995. __Pyx_GOTREF(__pyx_t_3);
  13996. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 896, __pyx_L1_error)
  13997. __Pyx_GOTREF(__pyx_t_1);
  13998. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  13999. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14000. __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)
  14001. __Pyx_GOTREF(__pyx_t_3);
  14002. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14003. __pyx_v_R = __pyx_t_3;
  14004. __pyx_t_3 = 0;
  14005. /* "fontTools/misc/bezierTools.py":898
  14006. * R = (2.0 * a1 * a1 * a1 - 9.0 * a1 * a2 + 27.0 * a3) / 54.0
  14007. *
  14008. * R2 = R * R # <<<<<<<<<<<<<<
  14009. * Q3 = Q * Q * Q
  14010. * R2 = 0 if R2 < epsilon else R2
  14011. */
  14012. __pyx_t_3 = PyNumber_Multiply(__pyx_v_R, __pyx_v_R); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 898, __pyx_L1_error)
  14013. __Pyx_GOTREF(__pyx_t_3);
  14014. __pyx_v_R2 = __pyx_t_3;
  14015. __pyx_t_3 = 0;
  14016. /* "fontTools/misc/bezierTools.py":899
  14017. *
  14018. * R2 = R * R
  14019. * Q3 = Q * Q * Q # <<<<<<<<<<<<<<
  14020. * R2 = 0 if R2 < epsilon else R2
  14021. * Q3 = 0 if abs(Q3) < epsilon else Q3
  14022. */
  14023. __pyx_t_3 = PyNumber_Multiply(__pyx_v_Q, __pyx_v_Q); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 899, __pyx_L1_error)
  14024. __Pyx_GOTREF(__pyx_t_3);
  14025. __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_v_Q); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 899, __pyx_L1_error)
  14026. __Pyx_GOTREF(__pyx_t_1);
  14027. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14028. __pyx_v_Q3 = __pyx_t_1;
  14029. __pyx_t_1 = 0;
  14030. /* "fontTools/misc/bezierTools.py":900
  14031. * R2 = R * R
  14032. * Q3 = Q * Q * Q
  14033. * R2 = 0 if R2 < epsilon else R2 # <<<<<<<<<<<<<<
  14034. * Q3 = 0 if abs(Q3) < epsilon else Q3
  14035. *
  14036. */
  14037. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 900, __pyx_L1_error)
  14038. __Pyx_GOTREF(__pyx_t_3);
  14039. __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)
  14040. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14041. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 900, __pyx_L1_error)
  14042. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14043. if (__pyx_t_4) {
  14044. __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  14045. __pyx_t_1 = __pyx_mstate_global->__pyx_int_0;
  14046. } else {
  14047. __Pyx_INCREF(__pyx_v_R2);
  14048. __pyx_t_1 = __pyx_v_R2;
  14049. }
  14050. __Pyx_DECREF_SET(__pyx_v_R2, __pyx_t_1);
  14051. __pyx_t_1 = 0;
  14052. /* "fontTools/misc/bezierTools.py":901
  14053. * Q3 = Q * Q * Q
  14054. * R2 = 0 if R2 < epsilon else R2
  14055. * Q3 = 0 if abs(Q3) < epsilon else Q3 # <<<<<<<<<<<<<<
  14056. *
  14057. * R2_Q3 = R2 - Q3
  14058. */
  14059. __pyx_t_2 = __Pyx_PyNumber_Absolute(__pyx_v_Q3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 901, __pyx_L1_error)
  14060. __Pyx_GOTREF(__pyx_t_2);
  14061. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 901, __pyx_L1_error)
  14062. __Pyx_GOTREF(__pyx_t_3);
  14063. __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)
  14064. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14065. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14066. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 901, __pyx_L1_error)
  14067. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14068. if (__pyx_t_4) {
  14069. __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
  14070. __pyx_t_1 = __pyx_mstate_global->__pyx_int_0;
  14071. } else {
  14072. __Pyx_INCREF(__pyx_v_Q3);
  14073. __pyx_t_1 = __pyx_v_Q3;
  14074. }
  14075. __Pyx_DECREF_SET(__pyx_v_Q3, __pyx_t_1);
  14076. __pyx_t_1 = 0;
  14077. /* "fontTools/misc/bezierTools.py":903
  14078. * Q3 = 0 if abs(Q3) < epsilon else Q3
  14079. *
  14080. * R2_Q3 = R2 - Q3 # <<<<<<<<<<<<<<
  14081. *
  14082. * if R2 == 0.0 and Q3 == 0.0:
  14083. */
  14084. __pyx_t_1 = PyNumber_Subtract(__pyx_v_R2, __pyx_v_Q3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 903, __pyx_L1_error)
  14085. __Pyx_GOTREF(__pyx_t_1);
  14086. __pyx_v_R2_Q3 = __pyx_t_1;
  14087. __pyx_t_1 = 0;
  14088. /* "fontTools/misc/bezierTools.py":905
  14089. * R2_Q3 = R2 - Q3
  14090. *
  14091. * if R2 == 0.0 and Q3 == 0.0: # <<<<<<<<<<<<<<
  14092. * x = round(-a1 / 3.0, epsilonDigits)
  14093. * return [x, x, x]
  14094. */
  14095. __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)
  14096. if (__pyx_t_7) {
  14097. } else {
  14098. __pyx_t_4 = __pyx_t_7;
  14099. goto __pyx_L5_bool_binop_done;
  14100. }
  14101. __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)
  14102. __pyx_t_4 = __pyx_t_7;
  14103. __pyx_L5_bool_binop_done:;
  14104. if (__pyx_t_4) {
  14105. /* "fontTools/misc/bezierTools.py":906
  14106. *
  14107. * if R2 == 0.0 and Q3 == 0.0:
  14108. * x = round(-a1 / 3.0, epsilonDigits) # <<<<<<<<<<<<<<
  14109. * return [x, x, x]
  14110. * elif R2_Q3 <= epsilon * 0.5:
  14111. */
  14112. __pyx_t_6 = NULL;
  14113. __pyx_t_3 = PyNumber_Negative(__pyx_v_a1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 906, __pyx_L1_error)
  14114. __Pyx_GOTREF(__pyx_t_3);
  14115. __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)
  14116. __Pyx_GOTREF(__pyx_t_2);
  14117. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14118. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_epsilonDigits); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 906, __pyx_L1_error)
  14119. __Pyx_GOTREF(__pyx_t_3);
  14120. __pyx_t_5 = 1;
  14121. {
  14122. PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_2, __pyx_t_3};
  14123. __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));
  14124. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  14125. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14126. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14127. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 906, __pyx_L1_error)
  14128. __Pyx_GOTREF(__pyx_t_1);
  14129. }
  14130. __pyx_v_x = __pyx_t_1;
  14131. __pyx_t_1 = 0;
  14132. /* "fontTools/misc/bezierTools.py":907
  14133. * if R2 == 0.0 and Q3 == 0.0:
  14134. * x = round(-a1 / 3.0, epsilonDigits)
  14135. * return [x, x, x] # <<<<<<<<<<<<<<
  14136. * elif R2_Q3 <= epsilon * 0.5:
  14137. * # The epsilon * .5 above ensures that Q3 is not zero.
  14138. */
  14139. __Pyx_XDECREF(__pyx_r);
  14140. __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 907, __pyx_L1_error)
  14141. __Pyx_GOTREF(__pyx_t_1);
  14142. __Pyx_INCREF(__pyx_v_x);
  14143. __Pyx_GIVEREF(__pyx_v_x);
  14144. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_x) != (0)) __PYX_ERR(0, 907, __pyx_L1_error);
  14145. __Pyx_INCREF(__pyx_v_x);
  14146. __Pyx_GIVEREF(__pyx_v_x);
  14147. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 1, __pyx_v_x) != (0)) __PYX_ERR(0, 907, __pyx_L1_error);
  14148. __Pyx_INCREF(__pyx_v_x);
  14149. __Pyx_GIVEREF(__pyx_v_x);
  14150. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 2, __pyx_v_x) != (0)) __PYX_ERR(0, 907, __pyx_L1_error);
  14151. __pyx_r = __pyx_t_1;
  14152. __pyx_t_1 = 0;
  14153. goto __pyx_L0;
  14154. /* "fontTools/misc/bezierTools.py":905
  14155. * R2_Q3 = R2 - Q3
  14156. *
  14157. * if R2 == 0.0 and Q3 == 0.0: # <<<<<<<<<<<<<<
  14158. * x = round(-a1 / 3.0, epsilonDigits)
  14159. * return [x, x, x]
  14160. */
  14161. }
  14162. /* "fontTools/misc/bezierTools.py":908
  14163. * x = round(-a1 / 3.0, epsilonDigits)
  14164. * return [x, x, x]
  14165. * elif R2_Q3 <= epsilon * 0.5: # <<<<<<<<<<<<<<
  14166. * # The epsilon * .5 above ensures that Q3 is not zero.
  14167. * theta = acos(max(min(R / sqrt(Q3), 1.0), -1.0))
  14168. */
  14169. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 908, __pyx_L1_error)
  14170. __Pyx_GOTREF(__pyx_t_1);
  14171. __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)
  14172. __Pyx_GOTREF(__pyx_t_3);
  14173. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14174. __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)
  14175. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14176. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 908, __pyx_L1_error)
  14177. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14178. if (__pyx_t_4) {
  14179. /* "fontTools/misc/bezierTools.py":910
  14180. * elif R2_Q3 <= epsilon * 0.5:
  14181. * # The epsilon * .5 above ensures that Q3 is not zero.
  14182. * theta = acos(max(min(R / sqrt(Q3), 1.0), -1.0)) # <<<<<<<<<<<<<<
  14183. * rQ2 = -2.0 * sqrt(Q)
  14184. * a1_3 = a1 / 3.0
  14185. */
  14186. __pyx_t_3 = NULL;
  14187. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_acos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 910, __pyx_L1_error)
  14188. __Pyx_GOTREF(__pyx_t_2);
  14189. __pyx_t_8 = -1.0;
  14190. __pyx_t_9 = 1.0;
  14191. __pyx_t_10 = NULL;
  14192. __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_sqrt); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 910, __pyx_L1_error)
  14193. __Pyx_GOTREF(__pyx_t_11);
  14194. __pyx_t_5 = 1;
  14195. #if CYTHON_UNPACK_METHODS
  14196. if (unlikely(PyMethod_Check(__pyx_t_11))) {
  14197. __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_11);
  14198. assert(__pyx_t_10);
  14199. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
  14200. __Pyx_INCREF(__pyx_t_10);
  14201. __Pyx_INCREF(__pyx__function);
  14202. __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
  14203. __pyx_t_5 = 0;
  14204. }
  14205. #endif
  14206. {
  14207. PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_Q3};
  14208. __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));
  14209. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  14210. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14211. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 910, __pyx_L1_error)
  14212. __Pyx_GOTREF(__pyx_t_6);
  14213. }
  14214. __pyx_t_11 = __Pyx_PyNumber_Divide(__pyx_v_R, __pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 910, __pyx_L1_error)
  14215. __Pyx_GOTREF(__pyx_t_11);
  14216. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14217. __pyx_t_10 = PyFloat_FromDouble(__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 910, __pyx_L1_error)
  14218. __Pyx_GOTREF(__pyx_t_10);
  14219. __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)
  14220. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  14221. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 910, __pyx_L1_error)
  14222. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  14223. if (__pyx_t_4) {
  14224. __pyx_t_12 = PyFloat_FromDouble(__pyx_t_9); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 910, __pyx_L1_error)
  14225. __Pyx_GOTREF(__pyx_t_12);
  14226. __pyx_t_6 = __pyx_t_12;
  14227. __pyx_t_12 = 0;
  14228. } else {
  14229. __Pyx_INCREF(__pyx_t_11);
  14230. __pyx_t_6 = __pyx_t_11;
  14231. }
  14232. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14233. __Pyx_INCREF(__pyx_t_6);
  14234. __pyx_t_11 = __pyx_t_6;
  14235. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14236. __pyx_t_12 = PyFloat_FromDouble(__pyx_t_8); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 910, __pyx_L1_error)
  14237. __Pyx_GOTREF(__pyx_t_12);
  14238. __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)
  14239. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  14240. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 910, __pyx_L1_error)
  14241. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  14242. if (__pyx_t_4) {
  14243. __pyx_t_10 = PyFloat_FromDouble(__pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 910, __pyx_L1_error)
  14244. __Pyx_GOTREF(__pyx_t_10);
  14245. __pyx_t_6 = __pyx_t_10;
  14246. __pyx_t_10 = 0;
  14247. } else {
  14248. __Pyx_INCREF(__pyx_t_11);
  14249. __pyx_t_6 = __pyx_t_11;
  14250. }
  14251. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14252. __pyx_t_5 = 1;
  14253. #if CYTHON_UNPACK_METHODS
  14254. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  14255. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  14256. assert(__pyx_t_3);
  14257. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  14258. __Pyx_INCREF(__pyx_t_3);
  14259. __Pyx_INCREF(__pyx__function);
  14260. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  14261. __pyx_t_5 = 0;
  14262. }
  14263. #endif
  14264. {
  14265. PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_6};
  14266. __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));
  14267. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  14268. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14269. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14270. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 910, __pyx_L1_error)
  14271. __Pyx_GOTREF(__pyx_t_1);
  14272. }
  14273. __pyx_v_theta = __pyx_t_1;
  14274. __pyx_t_1 = 0;
  14275. /* "fontTools/misc/bezierTools.py":911
  14276. * # The epsilon * .5 above ensures that Q3 is not zero.
  14277. * theta = acos(max(min(R / sqrt(Q3), 1.0), -1.0))
  14278. * rQ2 = -2.0 * sqrt(Q) # <<<<<<<<<<<<<<
  14279. * a1_3 = a1 / 3.0
  14280. * x0 = rQ2 * cos(theta / 3.0) - a1_3
  14281. */
  14282. __pyx_t_2 = NULL;
  14283. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_sqrt); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 911, __pyx_L1_error)
  14284. __Pyx_GOTREF(__pyx_t_6);
  14285. __pyx_t_5 = 1;
  14286. #if CYTHON_UNPACK_METHODS
  14287. if (unlikely(PyMethod_Check(__pyx_t_6))) {
  14288. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
  14289. assert(__pyx_t_2);
  14290. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
  14291. __Pyx_INCREF(__pyx_t_2);
  14292. __Pyx_INCREF(__pyx__function);
  14293. __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
  14294. __pyx_t_5 = 0;
  14295. }
  14296. #endif
  14297. {
  14298. PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_Q};
  14299. __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));
  14300. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  14301. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14302. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 911, __pyx_L1_error)
  14303. __Pyx_GOTREF(__pyx_t_1);
  14304. }
  14305. __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)
  14306. __Pyx_GOTREF(__pyx_t_6);
  14307. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14308. __pyx_v_rQ2 = __pyx_t_6;
  14309. __pyx_t_6 = 0;
  14310. /* "fontTools/misc/bezierTools.py":912
  14311. * theta = acos(max(min(R / sqrt(Q3), 1.0), -1.0))
  14312. * rQ2 = -2.0 * sqrt(Q)
  14313. * a1_3 = a1 / 3.0 # <<<<<<<<<<<<<<
  14314. * x0 = rQ2 * cos(theta / 3.0) - a1_3
  14315. * x1 = rQ2 * cos((theta + 2.0 * pi) / 3.0) - a1_3
  14316. */
  14317. __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)
  14318. __Pyx_GOTREF(__pyx_t_6);
  14319. __pyx_v_a1_3 = __pyx_t_6;
  14320. __pyx_t_6 = 0;
  14321. /* "fontTools/misc/bezierTools.py":913
  14322. * rQ2 = -2.0 * sqrt(Q)
  14323. * a1_3 = a1 / 3.0
  14324. * x0 = rQ2 * cos(theta / 3.0) - a1_3 # <<<<<<<<<<<<<<
  14325. * x1 = rQ2 * cos((theta + 2.0 * pi) / 3.0) - a1_3
  14326. * x2 = rQ2 * cos((theta + 4.0 * pi) / 3.0) - a1_3
  14327. */
  14328. __pyx_t_1 = NULL;
  14329. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_cos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 913, __pyx_L1_error)
  14330. __Pyx_GOTREF(__pyx_t_2);
  14331. __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)
  14332. __Pyx_GOTREF(__pyx_t_3);
  14333. __pyx_t_5 = 1;
  14334. #if CYTHON_UNPACK_METHODS
  14335. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  14336. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
  14337. assert(__pyx_t_1);
  14338. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  14339. __Pyx_INCREF(__pyx_t_1);
  14340. __Pyx_INCREF(__pyx__function);
  14341. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  14342. __pyx_t_5 = 0;
  14343. }
  14344. #endif
  14345. {
  14346. PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_3};
  14347. __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));
  14348. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  14349. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14350. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14351. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 913, __pyx_L1_error)
  14352. __Pyx_GOTREF(__pyx_t_6);
  14353. }
  14354. __pyx_t_2 = PyNumber_Multiply(__pyx_v_rQ2, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 913, __pyx_L1_error)
  14355. __Pyx_GOTREF(__pyx_t_2);
  14356. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14357. __pyx_t_6 = PyNumber_Subtract(__pyx_t_2, __pyx_v_a1_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 913, __pyx_L1_error)
  14358. __Pyx_GOTREF(__pyx_t_6);
  14359. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14360. __pyx_v_x0 = __pyx_t_6;
  14361. __pyx_t_6 = 0;
  14362. /* "fontTools/misc/bezierTools.py":914
  14363. * a1_3 = a1 / 3.0
  14364. * x0 = rQ2 * cos(theta / 3.0) - a1_3
  14365. * x1 = rQ2 * cos((theta + 2.0 * pi) / 3.0) - a1_3 # <<<<<<<<<<<<<<
  14366. * x2 = rQ2 * cos((theta + 4.0 * pi) / 3.0) - a1_3
  14367. * x0, x1, x2 = sorted([x0, x1, x2])
  14368. */
  14369. __pyx_t_2 = NULL;
  14370. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 914, __pyx_L1_error)
  14371. __Pyx_GOTREF(__pyx_t_3);
  14372. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_pi); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 914, __pyx_L1_error)
  14373. __Pyx_GOTREF(__pyx_t_1);
  14374. __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)
  14375. __Pyx_GOTREF(__pyx_t_11);
  14376. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14377. __pyx_t_1 = PyNumber_Add(__pyx_v_theta, __pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 914, __pyx_L1_error)
  14378. __Pyx_GOTREF(__pyx_t_1);
  14379. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14380. __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)
  14381. __Pyx_GOTREF(__pyx_t_11);
  14382. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14383. __pyx_t_5 = 1;
  14384. #if CYTHON_UNPACK_METHODS
  14385. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  14386. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  14387. assert(__pyx_t_2);
  14388. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  14389. __Pyx_INCREF(__pyx_t_2);
  14390. __Pyx_INCREF(__pyx__function);
  14391. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  14392. __pyx_t_5 = 0;
  14393. }
  14394. #endif
  14395. {
  14396. PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_11};
  14397. __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));
  14398. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  14399. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14400. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14401. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 914, __pyx_L1_error)
  14402. __Pyx_GOTREF(__pyx_t_6);
  14403. }
  14404. __pyx_t_3 = PyNumber_Multiply(__pyx_v_rQ2, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 914, __pyx_L1_error)
  14405. __Pyx_GOTREF(__pyx_t_3);
  14406. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14407. __pyx_t_6 = PyNumber_Subtract(__pyx_t_3, __pyx_v_a1_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 914, __pyx_L1_error)
  14408. __Pyx_GOTREF(__pyx_t_6);
  14409. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14410. __pyx_v_x1 = __pyx_t_6;
  14411. __pyx_t_6 = 0;
  14412. /* "fontTools/misc/bezierTools.py":915
  14413. * x0 = rQ2 * cos(theta / 3.0) - a1_3
  14414. * x1 = rQ2 * cos((theta + 2.0 * pi) / 3.0) - a1_3
  14415. * x2 = rQ2 * cos((theta + 4.0 * pi) / 3.0) - a1_3 # <<<<<<<<<<<<<<
  14416. * x0, x1, x2 = sorted([x0, x1, x2])
  14417. * # Merge roots that are close-enough
  14418. */
  14419. __pyx_t_3 = NULL;
  14420. __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_cos); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 915, __pyx_L1_error)
  14421. __Pyx_GOTREF(__pyx_t_11);
  14422. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_pi); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 915, __pyx_L1_error)
  14423. __Pyx_GOTREF(__pyx_t_2);
  14424. __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)
  14425. __Pyx_GOTREF(__pyx_t_1);
  14426. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14427. __pyx_t_2 = PyNumber_Add(__pyx_v_theta, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 915, __pyx_L1_error)
  14428. __Pyx_GOTREF(__pyx_t_2);
  14429. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14430. __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)
  14431. __Pyx_GOTREF(__pyx_t_1);
  14432. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14433. __pyx_t_5 = 1;
  14434. #if CYTHON_UNPACK_METHODS
  14435. if (unlikely(PyMethod_Check(__pyx_t_11))) {
  14436. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11);
  14437. assert(__pyx_t_3);
  14438. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
  14439. __Pyx_INCREF(__pyx_t_3);
  14440. __Pyx_INCREF(__pyx__function);
  14441. __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
  14442. __pyx_t_5 = 0;
  14443. }
  14444. #endif
  14445. {
  14446. PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_1};
  14447. __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));
  14448. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  14449. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14450. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14451. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 915, __pyx_L1_error)
  14452. __Pyx_GOTREF(__pyx_t_6);
  14453. }
  14454. __pyx_t_11 = PyNumber_Multiply(__pyx_v_rQ2, __pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 915, __pyx_L1_error)
  14455. __Pyx_GOTREF(__pyx_t_11);
  14456. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14457. __pyx_t_6 = PyNumber_Subtract(__pyx_t_11, __pyx_v_a1_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 915, __pyx_L1_error)
  14458. __Pyx_GOTREF(__pyx_t_6);
  14459. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14460. __pyx_v_x2 = __pyx_t_6;
  14461. __pyx_t_6 = 0;
  14462. /* "fontTools/misc/bezierTools.py":916
  14463. * x1 = rQ2 * cos((theta + 2.0 * pi) / 3.0) - a1_3
  14464. * x2 = rQ2 * cos((theta + 4.0 * pi) / 3.0) - a1_3
  14465. * x0, x1, x2 = sorted([x0, x1, x2]) # <<<<<<<<<<<<<<
  14466. * # Merge roots that are close-enough
  14467. * if x1 - x0 < epsilon and x2 - x1 < epsilon:
  14468. */
  14469. __pyx_t_6 = PyList_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 916, __pyx_L1_error)
  14470. __Pyx_GOTREF(__pyx_t_6);
  14471. __Pyx_INCREF(__pyx_v_x0);
  14472. __Pyx_GIVEREF(__pyx_v_x0);
  14473. if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 0, __pyx_v_x0) != (0)) __PYX_ERR(0, 916, __pyx_L1_error);
  14474. __Pyx_INCREF(__pyx_v_x1);
  14475. __Pyx_GIVEREF(__pyx_v_x1);
  14476. if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 1, __pyx_v_x1) != (0)) __PYX_ERR(0, 916, __pyx_L1_error);
  14477. __Pyx_INCREF(__pyx_v_x2);
  14478. __Pyx_GIVEREF(__pyx_v_x2);
  14479. if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 2, __pyx_v_x2) != (0)) __PYX_ERR(0, 916, __pyx_L1_error);
  14480. if (unlikely((PyList_Sort(__pyx_t_6) < 0))) __PYX_ERR(0, 916, __pyx_L1_error)
  14481. if (1) {
  14482. PyObject* sequence = __pyx_t_6;
  14483. Py_ssize_t size = __Pyx_PyList_GET_SIZE(sequence);
  14484. if (unlikely(size != 3)) {
  14485. if (size > 3) __Pyx_RaiseTooManyValuesError(3);
  14486. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  14487. __PYX_ERR(0, 916, __pyx_L1_error)
  14488. }
  14489. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  14490. __pyx_t_11 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  14491. if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 916, __pyx_L1_error)
  14492. __Pyx_XGOTREF(__pyx_t_11);
  14493. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  14494. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 916, __pyx_L1_error)
  14495. __Pyx_XGOTREF(__pyx_t_1);
  14496. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  14497. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 916, __pyx_L1_error)
  14498. __Pyx_XGOTREF(__pyx_t_3);
  14499. #else
  14500. __pyx_t_11 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 916, __pyx_L1_error)
  14501. __Pyx_GOTREF(__pyx_t_11);
  14502. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 916, __pyx_L1_error)
  14503. __Pyx_GOTREF(__pyx_t_1);
  14504. __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 916, __pyx_L1_error)
  14505. __Pyx_GOTREF(__pyx_t_3);
  14506. #endif
  14507. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14508. }
  14509. __Pyx_DECREF_SET(__pyx_v_x0, __pyx_t_11);
  14510. __pyx_t_11 = 0;
  14511. __Pyx_DECREF_SET(__pyx_v_x1, __pyx_t_1);
  14512. __pyx_t_1 = 0;
  14513. __Pyx_DECREF_SET(__pyx_v_x2, __pyx_t_3);
  14514. __pyx_t_3 = 0;
  14515. /* "fontTools/misc/bezierTools.py":918
  14516. * x0, x1, x2 = sorted([x0, x1, x2])
  14517. * # Merge roots that are close-enough
  14518. * if x1 - x0 < epsilon and x2 - x1 < epsilon: # <<<<<<<<<<<<<<
  14519. * x0 = x1 = x2 = round((x0 + x1 + x2) / 3.0, epsilonDigits)
  14520. * elif x1 - x0 < epsilon:
  14521. */
  14522. __pyx_t_6 = PyNumber_Subtract(__pyx_v_x1, __pyx_v_x0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 918, __pyx_L1_error)
  14523. __Pyx_GOTREF(__pyx_t_6);
  14524. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 918, __pyx_L1_error)
  14525. __Pyx_GOTREF(__pyx_t_3);
  14526. __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)
  14527. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14528. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14529. __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 918, __pyx_L1_error)
  14530. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14531. if (__pyx_t_7) {
  14532. } else {
  14533. __pyx_t_4 = __pyx_t_7;
  14534. goto __pyx_L8_bool_binop_done;
  14535. }
  14536. __pyx_t_1 = PyNumber_Subtract(__pyx_v_x2, __pyx_v_x1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 918, __pyx_L1_error)
  14537. __Pyx_GOTREF(__pyx_t_1);
  14538. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 918, __pyx_L1_error)
  14539. __Pyx_GOTREF(__pyx_t_3);
  14540. __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)
  14541. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14542. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14543. __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 918, __pyx_L1_error)
  14544. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14545. __pyx_t_4 = __pyx_t_7;
  14546. __pyx_L8_bool_binop_done:;
  14547. if (__pyx_t_4) {
  14548. /* "fontTools/misc/bezierTools.py":919
  14549. * # Merge roots that are close-enough
  14550. * if x1 - x0 < epsilon and x2 - x1 < epsilon:
  14551. * x0 = x1 = x2 = round((x0 + x1 + x2) / 3.0, epsilonDigits) # <<<<<<<<<<<<<<
  14552. * elif x1 - x0 < epsilon:
  14553. * x0 = x1 = round((x0 + x1) / 2.0, epsilonDigits)
  14554. */
  14555. __pyx_t_3 = NULL;
  14556. __pyx_t_1 = PyNumber_Add(__pyx_v_x0, __pyx_v_x1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 919, __pyx_L1_error)
  14557. __Pyx_GOTREF(__pyx_t_1);
  14558. __pyx_t_11 = PyNumber_Add(__pyx_t_1, __pyx_v_x2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 919, __pyx_L1_error)
  14559. __Pyx_GOTREF(__pyx_t_11);
  14560. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14561. __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)
  14562. __Pyx_GOTREF(__pyx_t_1);
  14563. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14564. __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_epsilonDigits); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 919, __pyx_L1_error)
  14565. __Pyx_GOTREF(__pyx_t_11);
  14566. __pyx_t_5 = 1;
  14567. {
  14568. PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_1, __pyx_t_11};
  14569. __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));
  14570. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  14571. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14572. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14573. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 919, __pyx_L1_error)
  14574. __Pyx_GOTREF(__pyx_t_6);
  14575. }
  14576. __Pyx_INCREF(__pyx_t_6);
  14577. __Pyx_DECREF_SET(__pyx_v_x0, __pyx_t_6);
  14578. __Pyx_INCREF(__pyx_t_6);
  14579. __Pyx_DECREF_SET(__pyx_v_x1, __pyx_t_6);
  14580. __Pyx_INCREF(__pyx_t_6);
  14581. __Pyx_DECREF_SET(__pyx_v_x2, __pyx_t_6);
  14582. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14583. /* "fontTools/misc/bezierTools.py":918
  14584. * x0, x1, x2 = sorted([x0, x1, x2])
  14585. * # Merge roots that are close-enough
  14586. * if x1 - x0 < epsilon and x2 - x1 < epsilon: # <<<<<<<<<<<<<<
  14587. * x0 = x1 = x2 = round((x0 + x1 + x2) / 3.0, epsilonDigits)
  14588. * elif x1 - x0 < epsilon:
  14589. */
  14590. goto __pyx_L7;
  14591. }
  14592. /* "fontTools/misc/bezierTools.py":920
  14593. * if x1 - x0 < epsilon and x2 - x1 < epsilon:
  14594. * x0 = x1 = x2 = round((x0 + x1 + x2) / 3.0, epsilonDigits)
  14595. * elif x1 - x0 < epsilon: # <<<<<<<<<<<<<<
  14596. * x0 = x1 = round((x0 + x1) / 2.0, epsilonDigits)
  14597. * x2 = round(x2, epsilonDigits)
  14598. */
  14599. __pyx_t_6 = PyNumber_Subtract(__pyx_v_x1, __pyx_v_x0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 920, __pyx_L1_error)
  14600. __Pyx_GOTREF(__pyx_t_6);
  14601. __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 920, __pyx_L1_error)
  14602. __Pyx_GOTREF(__pyx_t_11);
  14603. __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)
  14604. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14605. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14606. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 920, __pyx_L1_error)
  14607. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14608. if (__pyx_t_4) {
  14609. /* "fontTools/misc/bezierTools.py":921
  14610. * x0 = x1 = x2 = round((x0 + x1 + x2) / 3.0, epsilonDigits)
  14611. * elif x1 - x0 < epsilon:
  14612. * x0 = x1 = round((x0 + x1) / 2.0, epsilonDigits) # <<<<<<<<<<<<<<
  14613. * x2 = round(x2, epsilonDigits)
  14614. * elif x2 - x1 < epsilon:
  14615. */
  14616. __pyx_t_11 = NULL;
  14617. __pyx_t_6 = PyNumber_Add(__pyx_v_x0, __pyx_v_x1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 921, __pyx_L1_error)
  14618. __Pyx_GOTREF(__pyx_t_6);
  14619. __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)
  14620. __Pyx_GOTREF(__pyx_t_3);
  14621. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14622. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_epsilonDigits); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 921, __pyx_L1_error)
  14623. __Pyx_GOTREF(__pyx_t_6);
  14624. __pyx_t_5 = 1;
  14625. {
  14626. PyObject *__pyx_callargs[3] = {__pyx_t_11, __pyx_t_3, __pyx_t_6};
  14627. __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));
  14628. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  14629. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14630. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14631. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 921, __pyx_L1_error)
  14632. __Pyx_GOTREF(__pyx_t_1);
  14633. }
  14634. __Pyx_INCREF(__pyx_t_1);
  14635. __Pyx_DECREF_SET(__pyx_v_x0, __pyx_t_1);
  14636. __Pyx_INCREF(__pyx_t_1);
  14637. __Pyx_DECREF_SET(__pyx_v_x1, __pyx_t_1);
  14638. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14639. /* "fontTools/misc/bezierTools.py":922
  14640. * elif x1 - x0 < epsilon:
  14641. * x0 = x1 = round((x0 + x1) / 2.0, epsilonDigits)
  14642. * x2 = round(x2, epsilonDigits) # <<<<<<<<<<<<<<
  14643. * elif x2 - x1 < epsilon:
  14644. * x0 = round(x0, epsilonDigits)
  14645. */
  14646. __pyx_t_6 = NULL;
  14647. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_epsilonDigits); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 922, __pyx_L1_error)
  14648. __Pyx_GOTREF(__pyx_t_3);
  14649. __pyx_t_5 = 1;
  14650. {
  14651. PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_x2, __pyx_t_3};
  14652. __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));
  14653. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  14654. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14655. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 922, __pyx_L1_error)
  14656. __Pyx_GOTREF(__pyx_t_1);
  14657. }
  14658. __Pyx_DECREF_SET(__pyx_v_x2, __pyx_t_1);
  14659. __pyx_t_1 = 0;
  14660. /* "fontTools/misc/bezierTools.py":920
  14661. * if x1 - x0 < epsilon and x2 - x1 < epsilon:
  14662. * x0 = x1 = x2 = round((x0 + x1 + x2) / 3.0, epsilonDigits)
  14663. * elif x1 - x0 < epsilon: # <<<<<<<<<<<<<<
  14664. * x0 = x1 = round((x0 + x1) / 2.0, epsilonDigits)
  14665. * x2 = round(x2, epsilonDigits)
  14666. */
  14667. goto __pyx_L7;
  14668. }
  14669. /* "fontTools/misc/bezierTools.py":923
  14670. * x0 = x1 = round((x0 + x1) / 2.0, epsilonDigits)
  14671. * x2 = round(x2, epsilonDigits)
  14672. * elif x2 - x1 < epsilon: # <<<<<<<<<<<<<<
  14673. * x0 = round(x0, epsilonDigits)
  14674. * x1 = x2 = round((x1 + x2) / 2.0, epsilonDigits)
  14675. */
  14676. __pyx_t_1 = PyNumber_Subtract(__pyx_v_x2, __pyx_v_x1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 923, __pyx_L1_error)
  14677. __Pyx_GOTREF(__pyx_t_1);
  14678. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 923, __pyx_L1_error)
  14679. __Pyx_GOTREF(__pyx_t_3);
  14680. __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)
  14681. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14682. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14683. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 923, __pyx_L1_error)
  14684. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14685. if (__pyx_t_4) {
  14686. /* "fontTools/misc/bezierTools.py":924
  14687. * x2 = round(x2, epsilonDigits)
  14688. * elif x2 - x1 < epsilon:
  14689. * x0 = round(x0, epsilonDigits) # <<<<<<<<<<<<<<
  14690. * x1 = x2 = round((x1 + x2) / 2.0, epsilonDigits)
  14691. * else:
  14692. */
  14693. __pyx_t_3 = NULL;
  14694. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_epsilonDigits); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error)
  14695. __Pyx_GOTREF(__pyx_t_1);
  14696. __pyx_t_5 = 1;
  14697. {
  14698. PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_x0, __pyx_t_1};
  14699. __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));
  14700. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  14701. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14702. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 924, __pyx_L1_error)
  14703. __Pyx_GOTREF(__pyx_t_6);
  14704. }
  14705. __Pyx_DECREF_SET(__pyx_v_x0, __pyx_t_6);
  14706. __pyx_t_6 = 0;
  14707. /* "fontTools/misc/bezierTools.py":925
  14708. * elif x2 - x1 < epsilon:
  14709. * x0 = round(x0, epsilonDigits)
  14710. * x1 = x2 = round((x1 + x2) / 2.0, epsilonDigits) # <<<<<<<<<<<<<<
  14711. * else:
  14712. * x0 = round(x0, epsilonDigits)
  14713. */
  14714. __pyx_t_1 = NULL;
  14715. __pyx_t_3 = PyNumber_Add(__pyx_v_x1, __pyx_v_x2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 925, __pyx_L1_error)
  14716. __Pyx_GOTREF(__pyx_t_3);
  14717. __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)
  14718. __Pyx_GOTREF(__pyx_t_11);
  14719. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14720. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_epsilonDigits); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 925, __pyx_L1_error)
  14721. __Pyx_GOTREF(__pyx_t_3);
  14722. __pyx_t_5 = 1;
  14723. {
  14724. PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_t_11, __pyx_t_3};
  14725. __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));
  14726. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  14727. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14728. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14729. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 925, __pyx_L1_error)
  14730. __Pyx_GOTREF(__pyx_t_6);
  14731. }
  14732. __Pyx_INCREF(__pyx_t_6);
  14733. __Pyx_DECREF_SET(__pyx_v_x1, __pyx_t_6);
  14734. __Pyx_INCREF(__pyx_t_6);
  14735. __Pyx_DECREF_SET(__pyx_v_x2, __pyx_t_6);
  14736. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14737. /* "fontTools/misc/bezierTools.py":923
  14738. * x0 = x1 = round((x0 + x1) / 2.0, epsilonDigits)
  14739. * x2 = round(x2, epsilonDigits)
  14740. * elif x2 - x1 < epsilon: # <<<<<<<<<<<<<<
  14741. * x0 = round(x0, epsilonDigits)
  14742. * x1 = x2 = round((x1 + x2) / 2.0, epsilonDigits)
  14743. */
  14744. goto __pyx_L7;
  14745. }
  14746. /* "fontTools/misc/bezierTools.py":927
  14747. * x1 = x2 = round((x1 + x2) / 2.0, epsilonDigits)
  14748. * else:
  14749. * x0 = round(x0, epsilonDigits) # <<<<<<<<<<<<<<
  14750. * x1 = round(x1, epsilonDigits)
  14751. * x2 = round(x2, epsilonDigits)
  14752. */
  14753. /*else*/ {
  14754. __pyx_t_3 = NULL;
  14755. __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_epsilonDigits); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 927, __pyx_L1_error)
  14756. __Pyx_GOTREF(__pyx_t_11);
  14757. __pyx_t_5 = 1;
  14758. {
  14759. PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_x0, __pyx_t_11};
  14760. __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));
  14761. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  14762. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14763. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 927, __pyx_L1_error)
  14764. __Pyx_GOTREF(__pyx_t_6);
  14765. }
  14766. __Pyx_DECREF_SET(__pyx_v_x0, __pyx_t_6);
  14767. __pyx_t_6 = 0;
  14768. /* "fontTools/misc/bezierTools.py":928
  14769. * else:
  14770. * x0 = round(x0, epsilonDigits)
  14771. * x1 = round(x1, epsilonDigits) # <<<<<<<<<<<<<<
  14772. * x2 = round(x2, epsilonDigits)
  14773. * return [x0, x1, x2]
  14774. */
  14775. __pyx_t_11 = NULL;
  14776. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_epsilonDigits); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 928, __pyx_L1_error)
  14777. __Pyx_GOTREF(__pyx_t_3);
  14778. __pyx_t_5 = 1;
  14779. {
  14780. PyObject *__pyx_callargs[3] = {__pyx_t_11, __pyx_v_x1, __pyx_t_3};
  14781. __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));
  14782. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  14783. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14784. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 928, __pyx_L1_error)
  14785. __Pyx_GOTREF(__pyx_t_6);
  14786. }
  14787. __Pyx_DECREF_SET(__pyx_v_x1, __pyx_t_6);
  14788. __pyx_t_6 = 0;
  14789. /* "fontTools/misc/bezierTools.py":929
  14790. * x0 = round(x0, epsilonDigits)
  14791. * x1 = round(x1, epsilonDigits)
  14792. * x2 = round(x2, epsilonDigits) # <<<<<<<<<<<<<<
  14793. * return [x0, x1, x2]
  14794. * else:
  14795. */
  14796. __pyx_t_3 = NULL;
  14797. __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_epsilonDigits); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 929, __pyx_L1_error)
  14798. __Pyx_GOTREF(__pyx_t_11);
  14799. __pyx_t_5 = 1;
  14800. {
  14801. PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_x2, __pyx_t_11};
  14802. __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));
  14803. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  14804. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14805. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 929, __pyx_L1_error)
  14806. __Pyx_GOTREF(__pyx_t_6);
  14807. }
  14808. __Pyx_DECREF_SET(__pyx_v_x2, __pyx_t_6);
  14809. __pyx_t_6 = 0;
  14810. }
  14811. __pyx_L7:;
  14812. /* "fontTools/misc/bezierTools.py":930
  14813. * x1 = round(x1, epsilonDigits)
  14814. * x2 = round(x2, epsilonDigits)
  14815. * return [x0, x1, x2] # <<<<<<<<<<<<<<
  14816. * else:
  14817. * x = pow(sqrt(R2_Q3) + abs(R), 1 / 3.0)
  14818. */
  14819. __Pyx_XDECREF(__pyx_r);
  14820. __pyx_t_6 = PyList_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 930, __pyx_L1_error)
  14821. __Pyx_GOTREF(__pyx_t_6);
  14822. __Pyx_INCREF(__pyx_v_x0);
  14823. __Pyx_GIVEREF(__pyx_v_x0);
  14824. if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 0, __pyx_v_x0) != (0)) __PYX_ERR(0, 930, __pyx_L1_error);
  14825. __Pyx_INCREF(__pyx_v_x1);
  14826. __Pyx_GIVEREF(__pyx_v_x1);
  14827. if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 1, __pyx_v_x1) != (0)) __PYX_ERR(0, 930, __pyx_L1_error);
  14828. __Pyx_INCREF(__pyx_v_x2);
  14829. __Pyx_GIVEREF(__pyx_v_x2);
  14830. if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 2, __pyx_v_x2) != (0)) __PYX_ERR(0, 930, __pyx_L1_error);
  14831. __pyx_r = __pyx_t_6;
  14832. __pyx_t_6 = 0;
  14833. goto __pyx_L0;
  14834. /* "fontTools/misc/bezierTools.py":908
  14835. * x = round(-a1 / 3.0, epsilonDigits)
  14836. * return [x, x, x]
  14837. * elif R2_Q3 <= epsilon * 0.5: # <<<<<<<<<<<<<<
  14838. * # The epsilon * .5 above ensures that Q3 is not zero.
  14839. * theta = acos(max(min(R / sqrt(Q3), 1.0), -1.0))
  14840. */
  14841. }
  14842. /* "fontTools/misc/bezierTools.py":932
  14843. * return [x0, x1, x2]
  14844. * else:
  14845. * x = pow(sqrt(R2_Q3) + abs(R), 1 / 3.0) # <<<<<<<<<<<<<<
  14846. * x = x + Q / x
  14847. * if R >= 0.0:
  14848. */
  14849. /*else*/ {
  14850. __pyx_t_11 = NULL;
  14851. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_sqrt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 932, __pyx_L1_error)
  14852. __Pyx_GOTREF(__pyx_t_3);
  14853. __pyx_t_5 = 1;
  14854. #if CYTHON_UNPACK_METHODS
  14855. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  14856. __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_3);
  14857. assert(__pyx_t_11);
  14858. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  14859. __Pyx_INCREF(__pyx_t_11);
  14860. __Pyx_INCREF(__pyx__function);
  14861. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  14862. __pyx_t_5 = 0;
  14863. }
  14864. #endif
  14865. {
  14866. PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_v_R2_Q3};
  14867. __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));
  14868. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  14869. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14870. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 932, __pyx_L1_error)
  14871. __Pyx_GOTREF(__pyx_t_6);
  14872. }
  14873. __pyx_t_3 = __Pyx_PyNumber_Absolute(__pyx_v_R); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 932, __pyx_L1_error)
  14874. __Pyx_GOTREF(__pyx_t_3);
  14875. __pyx_t_11 = PyNumber_Add(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 932, __pyx_L1_error)
  14876. __Pyx_GOTREF(__pyx_t_11);
  14877. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14878. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14879. __pyx_t_3 = PyFloat_FromDouble((1.0 / 3.0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 932, __pyx_L1_error)
  14880. __Pyx_GOTREF(__pyx_t_3);
  14881. __pyx_t_6 = __Pyx_PyNumber_Power2(__pyx_t_11, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 932, __pyx_L1_error)
  14882. __Pyx_GOTREF(__pyx_t_6);
  14883. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14884. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14885. __pyx_v_x = __pyx_t_6;
  14886. __pyx_t_6 = 0;
  14887. /* "fontTools/misc/bezierTools.py":933
  14888. * else:
  14889. * x = pow(sqrt(R2_Q3) + abs(R), 1 / 3.0)
  14890. * x = x + Q / x # <<<<<<<<<<<<<<
  14891. * if R >= 0.0:
  14892. * x = -x
  14893. */
  14894. __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_Q, __pyx_v_x); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 933, __pyx_L1_error)
  14895. __Pyx_GOTREF(__pyx_t_6);
  14896. __pyx_t_3 = PyNumber_Add(__pyx_v_x, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 933, __pyx_L1_error)
  14897. __Pyx_GOTREF(__pyx_t_3);
  14898. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  14899. __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_3);
  14900. __pyx_t_3 = 0;
  14901. /* "fontTools/misc/bezierTools.py":934
  14902. * x = pow(sqrt(R2_Q3) + abs(R), 1 / 3.0)
  14903. * x = x + Q / x
  14904. * if R >= 0.0: # <<<<<<<<<<<<<<
  14905. * x = -x
  14906. * x = round(x - a1 / 3.0, epsilonDigits)
  14907. */
  14908. __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)
  14909. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 934, __pyx_L1_error)
  14910. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14911. if (__pyx_t_4) {
  14912. /* "fontTools/misc/bezierTools.py":935
  14913. * x = x + Q / x
  14914. * if R >= 0.0:
  14915. * x = -x # <<<<<<<<<<<<<<
  14916. * x = round(x - a1 / 3.0, epsilonDigits)
  14917. * return [x]
  14918. */
  14919. __pyx_t_3 = PyNumber_Negative(__pyx_v_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 935, __pyx_L1_error)
  14920. __Pyx_GOTREF(__pyx_t_3);
  14921. __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_3);
  14922. __pyx_t_3 = 0;
  14923. /* "fontTools/misc/bezierTools.py":934
  14924. * x = pow(sqrt(R2_Q3) + abs(R), 1 / 3.0)
  14925. * x = x + Q / x
  14926. * if R >= 0.0: # <<<<<<<<<<<<<<
  14927. * x = -x
  14928. * x = round(x - a1 / 3.0, epsilonDigits)
  14929. */
  14930. }
  14931. /* "fontTools/misc/bezierTools.py":936
  14932. * if R >= 0.0:
  14933. * x = -x
  14934. * x = round(x - a1 / 3.0, epsilonDigits) # <<<<<<<<<<<<<<
  14935. * return [x]
  14936. *
  14937. */
  14938. __pyx_t_6 = NULL;
  14939. __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)
  14940. __Pyx_GOTREF(__pyx_t_11);
  14941. __pyx_t_1 = PyNumber_Subtract(__pyx_v_x, __pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 936, __pyx_L1_error)
  14942. __Pyx_GOTREF(__pyx_t_1);
  14943. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14944. __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_mstate_global->__pyx_n_u_epsilonDigits); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 936, __pyx_L1_error)
  14945. __Pyx_GOTREF(__pyx_t_11);
  14946. __pyx_t_5 = 1;
  14947. {
  14948. PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_1, __pyx_t_11};
  14949. __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));
  14950. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  14951. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14952. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  14953. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 936, __pyx_L1_error)
  14954. __Pyx_GOTREF(__pyx_t_3);
  14955. }
  14956. __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_3);
  14957. __pyx_t_3 = 0;
  14958. /* "fontTools/misc/bezierTools.py":937
  14959. * x = -x
  14960. * x = round(x - a1 / 3.0, epsilonDigits)
  14961. * return [x] # <<<<<<<<<<<<<<
  14962. *
  14963. *
  14964. */
  14965. __Pyx_XDECREF(__pyx_r);
  14966. __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 937, __pyx_L1_error)
  14967. __Pyx_GOTREF(__pyx_t_3);
  14968. __Pyx_INCREF(__pyx_v_x);
  14969. __Pyx_GIVEREF(__pyx_v_x);
  14970. if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_x) != (0)) __PYX_ERR(0, 937, __pyx_L1_error);
  14971. __pyx_r = __pyx_t_3;
  14972. __pyx_t_3 = 0;
  14973. goto __pyx_L0;
  14974. }
  14975. /* "fontTools/misc/bezierTools.py":848
  14976. *
  14977. *
  14978. * def solveCubic(a, b, c, d): # <<<<<<<<<<<<<<
  14979. * """Solve a cubic equation.
  14980. *
  14981. */
  14982. /* function exit code */
  14983. __pyx_L1_error:;
  14984. __Pyx_XDECREF(__pyx_t_1);
  14985. __Pyx_XDECREF(__pyx_t_2);
  14986. __Pyx_XDECREF(__pyx_t_3);
  14987. __Pyx_XDECREF(__pyx_t_6);
  14988. __Pyx_XDECREF(__pyx_t_10);
  14989. __Pyx_XDECREF(__pyx_t_11);
  14990. __Pyx_XDECREF(__pyx_t_12);
  14991. __Pyx_AddTraceback("fontTools.misc.bezierTools.solveCubic", __pyx_clineno, __pyx_lineno, __pyx_filename);
  14992. __pyx_r = NULL;
  14993. __pyx_L0:;
  14994. __Pyx_XDECREF(__pyx_v_a1);
  14995. __Pyx_XDECREF(__pyx_v_a2);
  14996. __Pyx_XDECREF(__pyx_v_a3);
  14997. __Pyx_XDECREF(__pyx_v_Q);
  14998. __Pyx_XDECREF(__pyx_v_R);
  14999. __Pyx_XDECREF(__pyx_v_R2);
  15000. __Pyx_XDECREF(__pyx_v_Q3);
  15001. __Pyx_XDECREF(__pyx_v_R2_Q3);
  15002. __Pyx_XDECREF(__pyx_v_x);
  15003. __Pyx_XDECREF(__pyx_v_theta);
  15004. __Pyx_XDECREF(__pyx_v_rQ2);
  15005. __Pyx_XDECREF(__pyx_v_a1_3);
  15006. __Pyx_XDECREF(__pyx_v_x0);
  15007. __Pyx_XDECREF(__pyx_v_x1);
  15008. __Pyx_XDECREF(__pyx_v_x2);
  15009. __Pyx_XDECREF(__pyx_v_a);
  15010. __Pyx_XGIVEREF(__pyx_r);
  15011. __Pyx_RefNannyFinishContext();
  15012. return __pyx_r;
  15013. }
  15014. /* "fontTools/misc/bezierTools.py":945
  15015. *
  15016. *
  15017. * def calcQuadraticParameters(pt1, pt2, pt3): # <<<<<<<<<<<<<<
  15018. * x2, y2 = pt2
  15019. * x3, y3 = pt3
  15020. */
  15021. /* Python wrapper */
  15022. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_51calcQuadraticParameters(PyObject *__pyx_self,
  15023. #if CYTHON_METH_FASTCALL
  15024. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  15025. #else
  15026. PyObject *__pyx_args, PyObject *__pyx_kwds
  15027. #endif
  15028. ); /*proto*/
  15029. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_50calcQuadraticParameters, "calcQuadraticParameters(pt1, pt2, pt3)");
  15030. 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};
  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. ) {
  15038. PyObject *__pyx_v_pt1 = 0;
  15039. PyObject *__pyx_v_pt2 = 0;
  15040. PyObject *__pyx_v_pt3 = 0;
  15041. #if !CYTHON_METH_FASTCALL
  15042. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  15043. #endif
  15044. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  15045. PyObject* values[3] = {0,0,0};
  15046. int __pyx_lineno = 0;
  15047. const char *__pyx_filename = NULL;
  15048. int __pyx_clineno = 0;
  15049. PyObject *__pyx_r = 0;
  15050. __Pyx_RefNannyDeclarations
  15051. __Pyx_RefNannySetupContext("calcQuadraticParameters (wrapper)", 0);
  15052. #if !CYTHON_METH_FASTCALL
  15053. #if CYTHON_ASSUME_SAFE_SIZE
  15054. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  15055. #else
  15056. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  15057. #endif
  15058. #endif
  15059. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  15060. {
  15061. 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};
  15062. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  15063. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 945, __pyx_L3_error)
  15064. if (__pyx_kwds_len > 0) {
  15065. switch (__pyx_nargs) {
  15066. case 3:
  15067. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  15068. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 945, __pyx_L3_error)
  15069. CYTHON_FALLTHROUGH;
  15070. case 2:
  15071. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  15072. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 945, __pyx_L3_error)
  15073. CYTHON_FALLTHROUGH;
  15074. case 1:
  15075. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  15076. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 945, __pyx_L3_error)
  15077. CYTHON_FALLTHROUGH;
  15078. case 0: break;
  15079. default: goto __pyx_L5_argtuple_error;
  15080. }
  15081. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  15082. 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)
  15083. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  15084. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("calcQuadraticParameters", 1, 3, 3, i); __PYX_ERR(0, 945, __pyx_L3_error) }
  15085. }
  15086. } else if (unlikely(__pyx_nargs != 3)) {
  15087. goto __pyx_L5_argtuple_error;
  15088. } else {
  15089. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  15090. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 945, __pyx_L3_error)
  15091. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  15092. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 945, __pyx_L3_error)
  15093. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  15094. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 945, __pyx_L3_error)
  15095. }
  15096. __pyx_v_pt1 = values[0];
  15097. __pyx_v_pt2 = values[1];
  15098. __pyx_v_pt3 = values[2];
  15099. }
  15100. goto __pyx_L6_skip;
  15101. __pyx_L5_argtuple_error:;
  15102. __Pyx_RaiseArgtupleInvalid("calcQuadraticParameters", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 945, __pyx_L3_error)
  15103. __pyx_L6_skip:;
  15104. goto __pyx_L4_argument_unpacking_done;
  15105. __pyx_L3_error:;
  15106. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  15107. Py_XDECREF(values[__pyx_temp]);
  15108. }
  15109. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcQuadraticParameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
  15110. __Pyx_RefNannyFinishContext();
  15111. return NULL;
  15112. __pyx_L4_argument_unpacking_done:;
  15113. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_50calcQuadraticParameters(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3);
  15114. /* function exit code */
  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_RefNannyFinishContext();
  15119. return __pyx_r;
  15120. }
  15121. 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) {
  15122. PyObject *__pyx_v_x2 = NULL;
  15123. PyObject *__pyx_v_y2 = NULL;
  15124. PyObject *__pyx_v_x3 = NULL;
  15125. PyObject *__pyx_v_y3 = NULL;
  15126. PyObject *__pyx_v_cx = NULL;
  15127. PyObject *__pyx_v_cy = NULL;
  15128. PyObject *__pyx_v_bx = NULL;
  15129. PyObject *__pyx_v_by = NULL;
  15130. PyObject *__pyx_v_ax = NULL;
  15131. PyObject *__pyx_v_ay = NULL;
  15132. PyObject *__pyx_r = NULL;
  15133. __Pyx_RefNannyDeclarations
  15134. PyObject *__pyx_t_1 = NULL;
  15135. PyObject *__pyx_t_2 = NULL;
  15136. PyObject *__pyx_t_3 = NULL;
  15137. PyObject *(*__pyx_t_4)(PyObject *);
  15138. PyObject *__pyx_t_5 = NULL;
  15139. int __pyx_lineno = 0;
  15140. const char *__pyx_filename = NULL;
  15141. int __pyx_clineno = 0;
  15142. __Pyx_RefNannySetupContext("calcQuadraticParameters", 0);
  15143. /* "fontTools/misc/bezierTools.py":946
  15144. *
  15145. * def calcQuadraticParameters(pt1, pt2, pt3):
  15146. * x2, y2 = pt2 # <<<<<<<<<<<<<<
  15147. * x3, y3 = pt3
  15148. * cx, cy = pt1
  15149. */
  15150. if ((likely(PyTuple_CheckExact(__pyx_v_pt2))) || (PyList_CheckExact(__pyx_v_pt2))) {
  15151. PyObject* sequence = __pyx_v_pt2;
  15152. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  15153. if (unlikely(size != 2)) {
  15154. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  15155. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  15156. __PYX_ERR(0, 946, __pyx_L1_error)
  15157. }
  15158. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  15159. if (likely(PyTuple_CheckExact(sequence))) {
  15160. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  15161. __Pyx_INCREF(__pyx_t_1);
  15162. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  15163. __Pyx_INCREF(__pyx_t_2);
  15164. } else {
  15165. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  15166. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 946, __pyx_L1_error)
  15167. __Pyx_XGOTREF(__pyx_t_1);
  15168. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  15169. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 946, __pyx_L1_error)
  15170. __Pyx_XGOTREF(__pyx_t_2);
  15171. }
  15172. #else
  15173. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 946, __pyx_L1_error)
  15174. __Pyx_GOTREF(__pyx_t_1);
  15175. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 946, __pyx_L1_error)
  15176. __Pyx_GOTREF(__pyx_t_2);
  15177. #endif
  15178. } else {
  15179. Py_ssize_t index = -1;
  15180. __pyx_t_3 = PyObject_GetIter(__pyx_v_pt2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 946, __pyx_L1_error)
  15181. __Pyx_GOTREF(__pyx_t_3);
  15182. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  15183. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
  15184. __Pyx_GOTREF(__pyx_t_1);
  15185. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  15186. __Pyx_GOTREF(__pyx_t_2);
  15187. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 946, __pyx_L1_error)
  15188. __pyx_t_4 = NULL;
  15189. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15190. goto __pyx_L4_unpacking_done;
  15191. __pyx_L3_unpacking_failed:;
  15192. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15193. __pyx_t_4 = NULL;
  15194. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  15195. __PYX_ERR(0, 946, __pyx_L1_error)
  15196. __pyx_L4_unpacking_done:;
  15197. }
  15198. __pyx_v_x2 = __pyx_t_1;
  15199. __pyx_t_1 = 0;
  15200. __pyx_v_y2 = __pyx_t_2;
  15201. __pyx_t_2 = 0;
  15202. /* "fontTools/misc/bezierTools.py":947
  15203. * def calcQuadraticParameters(pt1, pt2, pt3):
  15204. * x2, y2 = pt2
  15205. * x3, y3 = pt3 # <<<<<<<<<<<<<<
  15206. * cx, cy = pt1
  15207. * bx = (x2 - cx) * 2.0
  15208. */
  15209. if ((likely(PyTuple_CheckExact(__pyx_v_pt3))) || (PyList_CheckExact(__pyx_v_pt3))) {
  15210. PyObject* sequence = __pyx_v_pt3;
  15211. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  15212. if (unlikely(size != 2)) {
  15213. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  15214. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  15215. __PYX_ERR(0, 947, __pyx_L1_error)
  15216. }
  15217. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  15218. if (likely(PyTuple_CheckExact(sequence))) {
  15219. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  15220. __Pyx_INCREF(__pyx_t_2);
  15221. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  15222. __Pyx_INCREF(__pyx_t_1);
  15223. } else {
  15224. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  15225. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 947, __pyx_L1_error)
  15226. __Pyx_XGOTREF(__pyx_t_2);
  15227. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  15228. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 947, __pyx_L1_error)
  15229. __Pyx_XGOTREF(__pyx_t_1);
  15230. }
  15231. #else
  15232. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 947, __pyx_L1_error)
  15233. __Pyx_GOTREF(__pyx_t_2);
  15234. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 947, __pyx_L1_error)
  15235. __Pyx_GOTREF(__pyx_t_1);
  15236. #endif
  15237. } else {
  15238. Py_ssize_t index = -1;
  15239. __pyx_t_3 = PyObject_GetIter(__pyx_v_pt3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 947, __pyx_L1_error)
  15240. __Pyx_GOTREF(__pyx_t_3);
  15241. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  15242. index = 0; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
  15243. __Pyx_GOTREF(__pyx_t_2);
  15244. index = 1; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
  15245. __Pyx_GOTREF(__pyx_t_1);
  15246. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 947, __pyx_L1_error)
  15247. __pyx_t_4 = NULL;
  15248. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15249. goto __pyx_L6_unpacking_done;
  15250. __pyx_L5_unpacking_failed:;
  15251. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15252. __pyx_t_4 = NULL;
  15253. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  15254. __PYX_ERR(0, 947, __pyx_L1_error)
  15255. __pyx_L6_unpacking_done:;
  15256. }
  15257. __pyx_v_x3 = __pyx_t_2;
  15258. __pyx_t_2 = 0;
  15259. __pyx_v_y3 = __pyx_t_1;
  15260. __pyx_t_1 = 0;
  15261. /* "fontTools/misc/bezierTools.py":948
  15262. * x2, y2 = pt2
  15263. * x3, y3 = pt3
  15264. * cx, cy = pt1 # <<<<<<<<<<<<<<
  15265. * bx = (x2 - cx) * 2.0
  15266. * by = (y2 - cy) * 2.0
  15267. */
  15268. if ((likely(PyTuple_CheckExact(__pyx_v_pt1))) || (PyList_CheckExact(__pyx_v_pt1))) {
  15269. PyObject* sequence = __pyx_v_pt1;
  15270. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  15271. if (unlikely(size != 2)) {
  15272. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  15273. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  15274. __PYX_ERR(0, 948, __pyx_L1_error)
  15275. }
  15276. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  15277. if (likely(PyTuple_CheckExact(sequence))) {
  15278. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  15279. __Pyx_INCREF(__pyx_t_1);
  15280. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  15281. __Pyx_INCREF(__pyx_t_2);
  15282. } else {
  15283. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  15284. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 948, __pyx_L1_error)
  15285. __Pyx_XGOTREF(__pyx_t_1);
  15286. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  15287. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 948, __pyx_L1_error)
  15288. __Pyx_XGOTREF(__pyx_t_2);
  15289. }
  15290. #else
  15291. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 948, __pyx_L1_error)
  15292. __Pyx_GOTREF(__pyx_t_1);
  15293. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 948, __pyx_L1_error)
  15294. __Pyx_GOTREF(__pyx_t_2);
  15295. #endif
  15296. } else {
  15297. Py_ssize_t index = -1;
  15298. __pyx_t_3 = PyObject_GetIter(__pyx_v_pt1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 948, __pyx_L1_error)
  15299. __Pyx_GOTREF(__pyx_t_3);
  15300. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  15301. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
  15302. __Pyx_GOTREF(__pyx_t_1);
  15303. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
  15304. __Pyx_GOTREF(__pyx_t_2);
  15305. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 948, __pyx_L1_error)
  15306. __pyx_t_4 = NULL;
  15307. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15308. goto __pyx_L8_unpacking_done;
  15309. __pyx_L7_unpacking_failed:;
  15310. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15311. __pyx_t_4 = NULL;
  15312. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  15313. __PYX_ERR(0, 948, __pyx_L1_error)
  15314. __pyx_L8_unpacking_done:;
  15315. }
  15316. __pyx_v_cx = __pyx_t_1;
  15317. __pyx_t_1 = 0;
  15318. __pyx_v_cy = __pyx_t_2;
  15319. __pyx_t_2 = 0;
  15320. /* "fontTools/misc/bezierTools.py":949
  15321. * x3, y3 = pt3
  15322. * cx, cy = pt1
  15323. * bx = (x2 - cx) * 2.0 # <<<<<<<<<<<<<<
  15324. * by = (y2 - cy) * 2.0
  15325. * ax = x3 - cx - bx
  15326. */
  15327. __pyx_t_2 = PyNumber_Subtract(__pyx_v_x2, __pyx_v_cx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 949, __pyx_L1_error)
  15328. __Pyx_GOTREF(__pyx_t_2);
  15329. __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)
  15330. __Pyx_GOTREF(__pyx_t_1);
  15331. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  15332. __pyx_v_bx = __pyx_t_1;
  15333. __pyx_t_1 = 0;
  15334. /* "fontTools/misc/bezierTools.py":950
  15335. * cx, cy = pt1
  15336. * bx = (x2 - cx) * 2.0
  15337. * by = (y2 - cy) * 2.0 # <<<<<<<<<<<<<<
  15338. * ax = x3 - cx - bx
  15339. * ay = y3 - cy - by
  15340. */
  15341. __pyx_t_1 = PyNumber_Subtract(__pyx_v_y2, __pyx_v_cy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 950, __pyx_L1_error)
  15342. __Pyx_GOTREF(__pyx_t_1);
  15343. __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)
  15344. __Pyx_GOTREF(__pyx_t_2);
  15345. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  15346. __pyx_v_by = __pyx_t_2;
  15347. __pyx_t_2 = 0;
  15348. /* "fontTools/misc/bezierTools.py":951
  15349. * bx = (x2 - cx) * 2.0
  15350. * by = (y2 - cy) * 2.0
  15351. * ax = x3 - cx - bx # <<<<<<<<<<<<<<
  15352. * ay = y3 - cy - by
  15353. * return (ax, ay), (bx, by), (cx, cy)
  15354. */
  15355. __pyx_t_2 = PyNumber_Subtract(__pyx_v_x3, __pyx_v_cx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 951, __pyx_L1_error)
  15356. __Pyx_GOTREF(__pyx_t_2);
  15357. __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_v_bx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 951, __pyx_L1_error)
  15358. __Pyx_GOTREF(__pyx_t_1);
  15359. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  15360. __pyx_v_ax = __pyx_t_1;
  15361. __pyx_t_1 = 0;
  15362. /* "fontTools/misc/bezierTools.py":952
  15363. * by = (y2 - cy) * 2.0
  15364. * ax = x3 - cx - bx
  15365. * ay = y3 - cy - by # <<<<<<<<<<<<<<
  15366. * return (ax, ay), (bx, by), (cx, cy)
  15367. *
  15368. */
  15369. __pyx_t_1 = PyNumber_Subtract(__pyx_v_y3, __pyx_v_cy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 952, __pyx_L1_error)
  15370. __Pyx_GOTREF(__pyx_t_1);
  15371. __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_by); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 952, __pyx_L1_error)
  15372. __Pyx_GOTREF(__pyx_t_2);
  15373. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  15374. __pyx_v_ay = __pyx_t_2;
  15375. __pyx_t_2 = 0;
  15376. /* "fontTools/misc/bezierTools.py":953
  15377. * ax = x3 - cx - bx
  15378. * ay = y3 - cy - by
  15379. * return (ax, ay), (bx, by), (cx, cy) # <<<<<<<<<<<<<<
  15380. *
  15381. *
  15382. */
  15383. __Pyx_XDECREF(__pyx_r);
  15384. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 953, __pyx_L1_error)
  15385. __Pyx_GOTREF(__pyx_t_2);
  15386. __Pyx_INCREF(__pyx_v_ax);
  15387. __Pyx_GIVEREF(__pyx_v_ax);
  15388. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_ax) != (0)) __PYX_ERR(0, 953, __pyx_L1_error);
  15389. __Pyx_INCREF(__pyx_v_ay);
  15390. __Pyx_GIVEREF(__pyx_v_ay);
  15391. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_ay) != (0)) __PYX_ERR(0, 953, __pyx_L1_error);
  15392. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 953, __pyx_L1_error)
  15393. __Pyx_GOTREF(__pyx_t_1);
  15394. __Pyx_INCREF(__pyx_v_bx);
  15395. __Pyx_GIVEREF(__pyx_v_bx);
  15396. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_bx) != (0)) __PYX_ERR(0, 953, __pyx_L1_error);
  15397. __Pyx_INCREF(__pyx_v_by);
  15398. __Pyx_GIVEREF(__pyx_v_by);
  15399. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_by) != (0)) __PYX_ERR(0, 953, __pyx_L1_error);
  15400. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 953, __pyx_L1_error)
  15401. __Pyx_GOTREF(__pyx_t_3);
  15402. __Pyx_INCREF(__pyx_v_cx);
  15403. __Pyx_GIVEREF(__pyx_v_cx);
  15404. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_cx) != (0)) __PYX_ERR(0, 953, __pyx_L1_error);
  15405. __Pyx_INCREF(__pyx_v_cy);
  15406. __Pyx_GIVEREF(__pyx_v_cy);
  15407. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_cy) != (0)) __PYX_ERR(0, 953, __pyx_L1_error);
  15408. __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 953, __pyx_L1_error)
  15409. __Pyx_GOTREF(__pyx_t_5);
  15410. __Pyx_GIVEREF(__pyx_t_2);
  15411. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 953, __pyx_L1_error);
  15412. __Pyx_GIVEREF(__pyx_t_1);
  15413. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 953, __pyx_L1_error);
  15414. __Pyx_GIVEREF(__pyx_t_3);
  15415. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 953, __pyx_L1_error);
  15416. __pyx_t_2 = 0;
  15417. __pyx_t_1 = 0;
  15418. __pyx_t_3 = 0;
  15419. __pyx_r = __pyx_t_5;
  15420. __pyx_t_5 = 0;
  15421. goto __pyx_L0;
  15422. /* "fontTools/misc/bezierTools.py":945
  15423. *
  15424. *
  15425. * def calcQuadraticParameters(pt1, pt2, pt3): # <<<<<<<<<<<<<<
  15426. * x2, y2 = pt2
  15427. * x3, y3 = pt3
  15428. */
  15429. /* function exit code */
  15430. __pyx_L1_error:;
  15431. __Pyx_XDECREF(__pyx_t_1);
  15432. __Pyx_XDECREF(__pyx_t_2);
  15433. __Pyx_XDECREF(__pyx_t_3);
  15434. __Pyx_XDECREF(__pyx_t_5);
  15435. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcQuadraticParameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
  15436. __pyx_r = NULL;
  15437. __pyx_L0:;
  15438. __Pyx_XDECREF(__pyx_v_x2);
  15439. __Pyx_XDECREF(__pyx_v_y2);
  15440. __Pyx_XDECREF(__pyx_v_x3);
  15441. __Pyx_XDECREF(__pyx_v_y3);
  15442. __Pyx_XDECREF(__pyx_v_cx);
  15443. __Pyx_XDECREF(__pyx_v_cy);
  15444. __Pyx_XDECREF(__pyx_v_bx);
  15445. __Pyx_XDECREF(__pyx_v_by);
  15446. __Pyx_XDECREF(__pyx_v_ax);
  15447. __Pyx_XDECREF(__pyx_v_ay);
  15448. __Pyx_XGIVEREF(__pyx_r);
  15449. __Pyx_RefNannyFinishContext();
  15450. return __pyx_r;
  15451. }
  15452. /* "fontTools/misc/bezierTools.py":956
  15453. *
  15454. *
  15455. * def calcCubicParameters(pt1, pt2, pt3, pt4): # <<<<<<<<<<<<<<
  15456. * x2, y2 = pt2
  15457. * x3, y3 = pt3
  15458. */
  15459. /* Python wrapper */
  15460. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_53calcCubicParameters(PyObject *__pyx_self,
  15461. #if CYTHON_METH_FASTCALL
  15462. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  15463. #else
  15464. PyObject *__pyx_args, PyObject *__pyx_kwds
  15465. #endif
  15466. ); /*proto*/
  15467. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_52calcCubicParameters, "calcCubicParameters(pt1, pt2, pt3, pt4)");
  15468. 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};
  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. ) {
  15476. PyObject *__pyx_v_pt1 = 0;
  15477. PyObject *__pyx_v_pt2 = 0;
  15478. PyObject *__pyx_v_pt3 = 0;
  15479. PyObject *__pyx_v_pt4 = 0;
  15480. #if !CYTHON_METH_FASTCALL
  15481. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  15482. #endif
  15483. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  15484. PyObject* values[4] = {0,0,0,0};
  15485. int __pyx_lineno = 0;
  15486. const char *__pyx_filename = NULL;
  15487. int __pyx_clineno = 0;
  15488. PyObject *__pyx_r = 0;
  15489. __Pyx_RefNannyDeclarations
  15490. __Pyx_RefNannySetupContext("calcCubicParameters (wrapper)", 0);
  15491. #if !CYTHON_METH_FASTCALL
  15492. #if CYTHON_ASSUME_SAFE_SIZE
  15493. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  15494. #else
  15495. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  15496. #endif
  15497. #endif
  15498. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  15499. {
  15500. 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};
  15501. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  15502. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 956, __pyx_L3_error)
  15503. if (__pyx_kwds_len > 0) {
  15504. switch (__pyx_nargs) {
  15505. case 4:
  15506. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  15507. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 956, __pyx_L3_error)
  15508. CYTHON_FALLTHROUGH;
  15509. case 3:
  15510. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  15511. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 956, __pyx_L3_error)
  15512. CYTHON_FALLTHROUGH;
  15513. case 2:
  15514. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  15515. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 956, __pyx_L3_error)
  15516. CYTHON_FALLTHROUGH;
  15517. case 1:
  15518. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  15519. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 956, __pyx_L3_error)
  15520. CYTHON_FALLTHROUGH;
  15521. case 0: break;
  15522. default: goto __pyx_L5_argtuple_error;
  15523. }
  15524. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  15525. 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)
  15526. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  15527. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("calcCubicParameters", 1, 4, 4, i); __PYX_ERR(0, 956, __pyx_L3_error) }
  15528. }
  15529. } else if (unlikely(__pyx_nargs != 4)) {
  15530. goto __pyx_L5_argtuple_error;
  15531. } else {
  15532. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  15533. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 956, __pyx_L3_error)
  15534. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  15535. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 956, __pyx_L3_error)
  15536. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  15537. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 956, __pyx_L3_error)
  15538. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  15539. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 956, __pyx_L3_error)
  15540. }
  15541. __pyx_v_pt1 = values[0];
  15542. __pyx_v_pt2 = values[1];
  15543. __pyx_v_pt3 = values[2];
  15544. __pyx_v_pt4 = values[3];
  15545. }
  15546. goto __pyx_L6_skip;
  15547. __pyx_L5_argtuple_error:;
  15548. __Pyx_RaiseArgtupleInvalid("calcCubicParameters", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 956, __pyx_L3_error)
  15549. __pyx_L6_skip:;
  15550. goto __pyx_L4_argument_unpacking_done;
  15551. __pyx_L3_error:;
  15552. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  15553. Py_XDECREF(values[__pyx_temp]);
  15554. }
  15555. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcCubicParameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
  15556. __Pyx_RefNannyFinishContext();
  15557. return NULL;
  15558. __pyx_L4_argument_unpacking_done:;
  15559. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_52calcCubicParameters(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_pt4);
  15560. /* function exit code */
  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_RefNannyFinishContext();
  15565. return __pyx_r;
  15566. }
  15567. 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) {
  15568. PyObject *__pyx_v_x2 = NULL;
  15569. PyObject *__pyx_v_y2 = NULL;
  15570. PyObject *__pyx_v_x3 = NULL;
  15571. PyObject *__pyx_v_y3 = NULL;
  15572. PyObject *__pyx_v_x4 = NULL;
  15573. PyObject *__pyx_v_y4 = NULL;
  15574. PyObject *__pyx_v_dx = NULL;
  15575. PyObject *__pyx_v_dy = NULL;
  15576. PyObject *__pyx_v_cx = NULL;
  15577. PyObject *__pyx_v_cy = NULL;
  15578. PyObject *__pyx_v_bx = NULL;
  15579. PyObject *__pyx_v_by = NULL;
  15580. PyObject *__pyx_v_ax = NULL;
  15581. PyObject *__pyx_v_ay = NULL;
  15582. PyObject *__pyx_r = NULL;
  15583. __Pyx_RefNannyDeclarations
  15584. PyObject *__pyx_t_1 = NULL;
  15585. PyObject *__pyx_t_2 = NULL;
  15586. PyObject *__pyx_t_3 = NULL;
  15587. PyObject *(*__pyx_t_4)(PyObject *);
  15588. PyObject *__pyx_t_5 = NULL;
  15589. PyObject *__pyx_t_6 = NULL;
  15590. int __pyx_lineno = 0;
  15591. const char *__pyx_filename = NULL;
  15592. int __pyx_clineno = 0;
  15593. __Pyx_RefNannySetupContext("calcCubicParameters", 0);
  15594. /* "fontTools/misc/bezierTools.py":957
  15595. *
  15596. * def calcCubicParameters(pt1, pt2, pt3, pt4):
  15597. * x2, y2 = pt2 # <<<<<<<<<<<<<<
  15598. * x3, y3 = pt3
  15599. * x4, y4 = pt4
  15600. */
  15601. if ((likely(PyTuple_CheckExact(__pyx_v_pt2))) || (PyList_CheckExact(__pyx_v_pt2))) {
  15602. PyObject* sequence = __pyx_v_pt2;
  15603. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  15604. if (unlikely(size != 2)) {
  15605. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  15606. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  15607. __PYX_ERR(0, 957, __pyx_L1_error)
  15608. }
  15609. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  15610. if (likely(PyTuple_CheckExact(sequence))) {
  15611. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  15612. __Pyx_INCREF(__pyx_t_1);
  15613. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  15614. __Pyx_INCREF(__pyx_t_2);
  15615. } else {
  15616. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  15617. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 957, __pyx_L1_error)
  15618. __Pyx_XGOTREF(__pyx_t_1);
  15619. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  15620. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 957, __pyx_L1_error)
  15621. __Pyx_XGOTREF(__pyx_t_2);
  15622. }
  15623. #else
  15624. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 957, __pyx_L1_error)
  15625. __Pyx_GOTREF(__pyx_t_1);
  15626. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 957, __pyx_L1_error)
  15627. __Pyx_GOTREF(__pyx_t_2);
  15628. #endif
  15629. } else {
  15630. Py_ssize_t index = -1;
  15631. __pyx_t_3 = PyObject_GetIter(__pyx_v_pt2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 957, __pyx_L1_error)
  15632. __Pyx_GOTREF(__pyx_t_3);
  15633. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  15634. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
  15635. __Pyx_GOTREF(__pyx_t_1);
  15636. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  15637. __Pyx_GOTREF(__pyx_t_2);
  15638. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 957, __pyx_L1_error)
  15639. __pyx_t_4 = NULL;
  15640. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15641. goto __pyx_L4_unpacking_done;
  15642. __pyx_L3_unpacking_failed:;
  15643. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15644. __pyx_t_4 = NULL;
  15645. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  15646. __PYX_ERR(0, 957, __pyx_L1_error)
  15647. __pyx_L4_unpacking_done:;
  15648. }
  15649. __pyx_v_x2 = __pyx_t_1;
  15650. __pyx_t_1 = 0;
  15651. __pyx_v_y2 = __pyx_t_2;
  15652. __pyx_t_2 = 0;
  15653. /* "fontTools/misc/bezierTools.py":958
  15654. * def calcCubicParameters(pt1, pt2, pt3, pt4):
  15655. * x2, y2 = pt2
  15656. * x3, y3 = pt3 # <<<<<<<<<<<<<<
  15657. * x4, y4 = pt4
  15658. * dx, dy = pt1
  15659. */
  15660. if ((likely(PyTuple_CheckExact(__pyx_v_pt3))) || (PyList_CheckExact(__pyx_v_pt3))) {
  15661. PyObject* sequence = __pyx_v_pt3;
  15662. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  15663. if (unlikely(size != 2)) {
  15664. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  15665. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  15666. __PYX_ERR(0, 958, __pyx_L1_error)
  15667. }
  15668. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  15669. if (likely(PyTuple_CheckExact(sequence))) {
  15670. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  15671. __Pyx_INCREF(__pyx_t_2);
  15672. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  15673. __Pyx_INCREF(__pyx_t_1);
  15674. } else {
  15675. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  15676. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 958, __pyx_L1_error)
  15677. __Pyx_XGOTREF(__pyx_t_2);
  15678. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  15679. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 958, __pyx_L1_error)
  15680. __Pyx_XGOTREF(__pyx_t_1);
  15681. }
  15682. #else
  15683. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 958, __pyx_L1_error)
  15684. __Pyx_GOTREF(__pyx_t_2);
  15685. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 958, __pyx_L1_error)
  15686. __Pyx_GOTREF(__pyx_t_1);
  15687. #endif
  15688. } else {
  15689. Py_ssize_t index = -1;
  15690. __pyx_t_3 = PyObject_GetIter(__pyx_v_pt3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 958, __pyx_L1_error)
  15691. __Pyx_GOTREF(__pyx_t_3);
  15692. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  15693. index = 0; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
  15694. __Pyx_GOTREF(__pyx_t_2);
  15695. index = 1; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
  15696. __Pyx_GOTREF(__pyx_t_1);
  15697. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 958, __pyx_L1_error)
  15698. __pyx_t_4 = NULL;
  15699. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15700. goto __pyx_L6_unpacking_done;
  15701. __pyx_L5_unpacking_failed:;
  15702. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15703. __pyx_t_4 = NULL;
  15704. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  15705. __PYX_ERR(0, 958, __pyx_L1_error)
  15706. __pyx_L6_unpacking_done:;
  15707. }
  15708. __pyx_v_x3 = __pyx_t_2;
  15709. __pyx_t_2 = 0;
  15710. __pyx_v_y3 = __pyx_t_1;
  15711. __pyx_t_1 = 0;
  15712. /* "fontTools/misc/bezierTools.py":959
  15713. * x2, y2 = pt2
  15714. * x3, y3 = pt3
  15715. * x4, y4 = pt4 # <<<<<<<<<<<<<<
  15716. * dx, dy = pt1
  15717. * cx = (x2 - dx) * 3.0
  15718. */
  15719. if ((likely(PyTuple_CheckExact(__pyx_v_pt4))) || (PyList_CheckExact(__pyx_v_pt4))) {
  15720. PyObject* sequence = __pyx_v_pt4;
  15721. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  15722. if (unlikely(size != 2)) {
  15723. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  15724. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  15725. __PYX_ERR(0, 959, __pyx_L1_error)
  15726. }
  15727. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  15728. if (likely(PyTuple_CheckExact(sequence))) {
  15729. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  15730. __Pyx_INCREF(__pyx_t_1);
  15731. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  15732. __Pyx_INCREF(__pyx_t_2);
  15733. } else {
  15734. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  15735. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 959, __pyx_L1_error)
  15736. __Pyx_XGOTREF(__pyx_t_1);
  15737. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  15738. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 959, __pyx_L1_error)
  15739. __Pyx_XGOTREF(__pyx_t_2);
  15740. }
  15741. #else
  15742. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 959, __pyx_L1_error)
  15743. __Pyx_GOTREF(__pyx_t_1);
  15744. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 959, __pyx_L1_error)
  15745. __Pyx_GOTREF(__pyx_t_2);
  15746. #endif
  15747. } else {
  15748. Py_ssize_t index = -1;
  15749. __pyx_t_3 = PyObject_GetIter(__pyx_v_pt4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 959, __pyx_L1_error)
  15750. __Pyx_GOTREF(__pyx_t_3);
  15751. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  15752. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
  15753. __Pyx_GOTREF(__pyx_t_1);
  15754. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
  15755. __Pyx_GOTREF(__pyx_t_2);
  15756. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 959, __pyx_L1_error)
  15757. __pyx_t_4 = NULL;
  15758. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15759. goto __pyx_L8_unpacking_done;
  15760. __pyx_L7_unpacking_failed:;
  15761. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15762. __pyx_t_4 = NULL;
  15763. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  15764. __PYX_ERR(0, 959, __pyx_L1_error)
  15765. __pyx_L8_unpacking_done:;
  15766. }
  15767. __pyx_v_x4 = __pyx_t_1;
  15768. __pyx_t_1 = 0;
  15769. __pyx_v_y4 = __pyx_t_2;
  15770. __pyx_t_2 = 0;
  15771. /* "fontTools/misc/bezierTools.py":960
  15772. * x3, y3 = pt3
  15773. * x4, y4 = pt4
  15774. * dx, dy = pt1 # <<<<<<<<<<<<<<
  15775. * cx = (x2 - dx) * 3.0
  15776. * cy = (y2 - dy) * 3.0
  15777. */
  15778. if ((likely(PyTuple_CheckExact(__pyx_v_pt1))) || (PyList_CheckExact(__pyx_v_pt1))) {
  15779. PyObject* sequence = __pyx_v_pt1;
  15780. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  15781. if (unlikely(size != 2)) {
  15782. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  15783. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  15784. __PYX_ERR(0, 960, __pyx_L1_error)
  15785. }
  15786. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  15787. if (likely(PyTuple_CheckExact(sequence))) {
  15788. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  15789. __Pyx_INCREF(__pyx_t_2);
  15790. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  15791. __Pyx_INCREF(__pyx_t_1);
  15792. } else {
  15793. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  15794. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 960, __pyx_L1_error)
  15795. __Pyx_XGOTREF(__pyx_t_2);
  15796. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  15797. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 960, __pyx_L1_error)
  15798. __Pyx_XGOTREF(__pyx_t_1);
  15799. }
  15800. #else
  15801. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 960, __pyx_L1_error)
  15802. __Pyx_GOTREF(__pyx_t_2);
  15803. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 960, __pyx_L1_error)
  15804. __Pyx_GOTREF(__pyx_t_1);
  15805. #endif
  15806. } else {
  15807. Py_ssize_t index = -1;
  15808. __pyx_t_3 = PyObject_GetIter(__pyx_v_pt1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 960, __pyx_L1_error)
  15809. __Pyx_GOTREF(__pyx_t_3);
  15810. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  15811. index = 0; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L9_unpacking_failed;
  15812. __Pyx_GOTREF(__pyx_t_2);
  15813. index = 1; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L9_unpacking_failed;
  15814. __Pyx_GOTREF(__pyx_t_1);
  15815. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 960, __pyx_L1_error)
  15816. __pyx_t_4 = NULL;
  15817. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15818. goto __pyx_L10_unpacking_done;
  15819. __pyx_L9_unpacking_failed:;
  15820. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  15821. __pyx_t_4 = NULL;
  15822. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  15823. __PYX_ERR(0, 960, __pyx_L1_error)
  15824. __pyx_L10_unpacking_done:;
  15825. }
  15826. __pyx_v_dx = __pyx_t_2;
  15827. __pyx_t_2 = 0;
  15828. __pyx_v_dy = __pyx_t_1;
  15829. __pyx_t_1 = 0;
  15830. /* "fontTools/misc/bezierTools.py":961
  15831. * x4, y4 = pt4
  15832. * dx, dy = pt1
  15833. * cx = (x2 - dx) * 3.0 # <<<<<<<<<<<<<<
  15834. * cy = (y2 - dy) * 3.0
  15835. * bx = (x3 - x2) * 3.0 - cx
  15836. */
  15837. __pyx_t_1 = PyNumber_Subtract(__pyx_v_x2, __pyx_v_dx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 961, __pyx_L1_error)
  15838. __Pyx_GOTREF(__pyx_t_1);
  15839. __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)
  15840. __Pyx_GOTREF(__pyx_t_2);
  15841. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  15842. __pyx_v_cx = __pyx_t_2;
  15843. __pyx_t_2 = 0;
  15844. /* "fontTools/misc/bezierTools.py":962
  15845. * dx, dy = pt1
  15846. * cx = (x2 - dx) * 3.0
  15847. * cy = (y2 - dy) * 3.0 # <<<<<<<<<<<<<<
  15848. * bx = (x3 - x2) * 3.0 - cx
  15849. * by = (y3 - y2) * 3.0 - cy
  15850. */
  15851. __pyx_t_2 = PyNumber_Subtract(__pyx_v_y2, __pyx_v_dy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 962, __pyx_L1_error)
  15852. __Pyx_GOTREF(__pyx_t_2);
  15853. __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)
  15854. __Pyx_GOTREF(__pyx_t_1);
  15855. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  15856. __pyx_v_cy = __pyx_t_1;
  15857. __pyx_t_1 = 0;
  15858. /* "fontTools/misc/bezierTools.py":963
  15859. * cx = (x2 - dx) * 3.0
  15860. * cy = (y2 - dy) * 3.0
  15861. * bx = (x3 - x2) * 3.0 - cx # <<<<<<<<<<<<<<
  15862. * by = (y3 - y2) * 3.0 - cy
  15863. * ax = x4 - dx - cx - bx
  15864. */
  15865. __pyx_t_1 = PyNumber_Subtract(__pyx_v_x3, __pyx_v_x2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 963, __pyx_L1_error)
  15866. __Pyx_GOTREF(__pyx_t_1);
  15867. __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)
  15868. __Pyx_GOTREF(__pyx_t_2);
  15869. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  15870. __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_v_cx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 963, __pyx_L1_error)
  15871. __Pyx_GOTREF(__pyx_t_1);
  15872. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  15873. __pyx_v_bx = __pyx_t_1;
  15874. __pyx_t_1 = 0;
  15875. /* "fontTools/misc/bezierTools.py":964
  15876. * cy = (y2 - dy) * 3.0
  15877. * bx = (x3 - x2) * 3.0 - cx
  15878. * by = (y3 - y2) * 3.0 - cy # <<<<<<<<<<<<<<
  15879. * ax = x4 - dx - cx - bx
  15880. * ay = y4 - dy - cy - by
  15881. */
  15882. __pyx_t_1 = PyNumber_Subtract(__pyx_v_y3, __pyx_v_y2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 964, __pyx_L1_error)
  15883. __Pyx_GOTREF(__pyx_t_1);
  15884. __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)
  15885. __Pyx_GOTREF(__pyx_t_2);
  15886. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  15887. __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_v_cy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 964, __pyx_L1_error)
  15888. __Pyx_GOTREF(__pyx_t_1);
  15889. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  15890. __pyx_v_by = __pyx_t_1;
  15891. __pyx_t_1 = 0;
  15892. /* "fontTools/misc/bezierTools.py":965
  15893. * bx = (x3 - x2) * 3.0 - cx
  15894. * by = (y3 - y2) * 3.0 - cy
  15895. * ax = x4 - dx - cx - bx # <<<<<<<<<<<<<<
  15896. * ay = y4 - dy - cy - by
  15897. * return (ax, ay), (bx, by), (cx, cy), (dx, dy)
  15898. */
  15899. __pyx_t_1 = PyNumber_Subtract(__pyx_v_x4, __pyx_v_dx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 965, __pyx_L1_error)
  15900. __Pyx_GOTREF(__pyx_t_1);
  15901. __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_cx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 965, __pyx_L1_error)
  15902. __Pyx_GOTREF(__pyx_t_2);
  15903. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  15904. __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_v_bx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 965, __pyx_L1_error)
  15905. __Pyx_GOTREF(__pyx_t_1);
  15906. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  15907. __pyx_v_ax = __pyx_t_1;
  15908. __pyx_t_1 = 0;
  15909. /* "fontTools/misc/bezierTools.py":966
  15910. * by = (y3 - y2) * 3.0 - cy
  15911. * ax = x4 - dx - cx - bx
  15912. * ay = y4 - dy - cy - by # <<<<<<<<<<<<<<
  15913. * return (ax, ay), (bx, by), (cx, cy), (dx, dy)
  15914. *
  15915. */
  15916. __pyx_t_1 = PyNumber_Subtract(__pyx_v_y4, __pyx_v_dy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 966, __pyx_L1_error)
  15917. __Pyx_GOTREF(__pyx_t_1);
  15918. __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_cy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 966, __pyx_L1_error)
  15919. __Pyx_GOTREF(__pyx_t_2);
  15920. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  15921. __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_v_by); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 966, __pyx_L1_error)
  15922. __Pyx_GOTREF(__pyx_t_1);
  15923. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  15924. __pyx_v_ay = __pyx_t_1;
  15925. __pyx_t_1 = 0;
  15926. /* "fontTools/misc/bezierTools.py":967
  15927. * ax = x4 - dx - cx - bx
  15928. * ay = y4 - dy - cy - by
  15929. * return (ax, ay), (bx, by), (cx, cy), (dx, dy) # <<<<<<<<<<<<<<
  15930. *
  15931. *
  15932. */
  15933. __Pyx_XDECREF(__pyx_r);
  15934. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 967, __pyx_L1_error)
  15935. __Pyx_GOTREF(__pyx_t_1);
  15936. __Pyx_INCREF(__pyx_v_ax);
  15937. __Pyx_GIVEREF(__pyx_v_ax);
  15938. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_ax) != (0)) __PYX_ERR(0, 967, __pyx_L1_error);
  15939. __Pyx_INCREF(__pyx_v_ay);
  15940. __Pyx_GIVEREF(__pyx_v_ay);
  15941. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_ay) != (0)) __PYX_ERR(0, 967, __pyx_L1_error);
  15942. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 967, __pyx_L1_error)
  15943. __Pyx_GOTREF(__pyx_t_2);
  15944. __Pyx_INCREF(__pyx_v_bx);
  15945. __Pyx_GIVEREF(__pyx_v_bx);
  15946. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_bx) != (0)) __PYX_ERR(0, 967, __pyx_L1_error);
  15947. __Pyx_INCREF(__pyx_v_by);
  15948. __Pyx_GIVEREF(__pyx_v_by);
  15949. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_by) != (0)) __PYX_ERR(0, 967, __pyx_L1_error);
  15950. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 967, __pyx_L1_error)
  15951. __Pyx_GOTREF(__pyx_t_3);
  15952. __Pyx_INCREF(__pyx_v_cx);
  15953. __Pyx_GIVEREF(__pyx_v_cx);
  15954. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_cx) != (0)) __PYX_ERR(0, 967, __pyx_L1_error);
  15955. __Pyx_INCREF(__pyx_v_cy);
  15956. __Pyx_GIVEREF(__pyx_v_cy);
  15957. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_cy) != (0)) __PYX_ERR(0, 967, __pyx_L1_error);
  15958. __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 967, __pyx_L1_error)
  15959. __Pyx_GOTREF(__pyx_t_5);
  15960. __Pyx_INCREF(__pyx_v_dx);
  15961. __Pyx_GIVEREF(__pyx_v_dx);
  15962. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_dx) != (0)) __PYX_ERR(0, 967, __pyx_L1_error);
  15963. __Pyx_INCREF(__pyx_v_dy);
  15964. __Pyx_GIVEREF(__pyx_v_dy);
  15965. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_dy) != (0)) __PYX_ERR(0, 967, __pyx_L1_error);
  15966. __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 967, __pyx_L1_error)
  15967. __Pyx_GOTREF(__pyx_t_6);
  15968. __Pyx_GIVEREF(__pyx_t_1);
  15969. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 967, __pyx_L1_error);
  15970. __Pyx_GIVEREF(__pyx_t_2);
  15971. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 967, __pyx_L1_error);
  15972. __Pyx_GIVEREF(__pyx_t_3);
  15973. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 967, __pyx_L1_error);
  15974. __Pyx_GIVEREF(__pyx_t_5);
  15975. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5) != (0)) __PYX_ERR(0, 967, __pyx_L1_error);
  15976. __pyx_t_1 = 0;
  15977. __pyx_t_2 = 0;
  15978. __pyx_t_3 = 0;
  15979. __pyx_t_5 = 0;
  15980. __pyx_r = __pyx_t_6;
  15981. __pyx_t_6 = 0;
  15982. goto __pyx_L0;
  15983. /* "fontTools/misc/bezierTools.py":956
  15984. *
  15985. *
  15986. * def calcCubicParameters(pt1, pt2, pt3, pt4): # <<<<<<<<<<<<<<
  15987. * x2, y2 = pt2
  15988. * x3, y3 = pt3
  15989. */
  15990. /* function exit code */
  15991. __pyx_L1_error:;
  15992. __Pyx_XDECREF(__pyx_t_1);
  15993. __Pyx_XDECREF(__pyx_t_2);
  15994. __Pyx_XDECREF(__pyx_t_3);
  15995. __Pyx_XDECREF(__pyx_t_5);
  15996. __Pyx_XDECREF(__pyx_t_6);
  15997. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcCubicParameters", __pyx_clineno, __pyx_lineno, __pyx_filename);
  15998. __pyx_r = NULL;
  15999. __pyx_L0:;
  16000. __Pyx_XDECREF(__pyx_v_x2);
  16001. __Pyx_XDECREF(__pyx_v_y2);
  16002. __Pyx_XDECREF(__pyx_v_x3);
  16003. __Pyx_XDECREF(__pyx_v_y3);
  16004. __Pyx_XDECREF(__pyx_v_x4);
  16005. __Pyx_XDECREF(__pyx_v_y4);
  16006. __Pyx_XDECREF(__pyx_v_dx);
  16007. __Pyx_XDECREF(__pyx_v_dy);
  16008. __Pyx_XDECREF(__pyx_v_cx);
  16009. __Pyx_XDECREF(__pyx_v_cy);
  16010. __Pyx_XDECREF(__pyx_v_bx);
  16011. __Pyx_XDECREF(__pyx_v_by);
  16012. __Pyx_XDECREF(__pyx_v_ax);
  16013. __Pyx_XDECREF(__pyx_v_ay);
  16014. __Pyx_XGIVEREF(__pyx_r);
  16015. __Pyx_RefNannyFinishContext();
  16016. return __pyx_r;
  16017. }
  16018. /* "fontTools/misc/bezierTools.py":970
  16019. *
  16020. *
  16021. * @cython.cfunc # <<<<<<<<<<<<<<
  16022. * @cython.inline
  16023. * @cython.locals(
  16024. */
  16025. 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) {
  16026. __pyx_t_double_complex __pyx_v_a;
  16027. __pyx_t_double_complex __pyx_v_b;
  16028. __pyx_t_double_complex __pyx_v_c;
  16029. PyObject *__pyx_r = NULL;
  16030. __Pyx_RefNannyDeclarations
  16031. PyObject *__pyx_t_1 = NULL;
  16032. PyObject *__pyx_t_2 = NULL;
  16033. PyObject *__pyx_t_3 = NULL;
  16034. PyObject *__pyx_t_4 = NULL;
  16035. PyObject *__pyx_t_5 = NULL;
  16036. int __pyx_lineno = 0;
  16037. const char *__pyx_filename = NULL;
  16038. int __pyx_clineno = 0;
  16039. __Pyx_RefNannySetupContext("calcCubicParametersC", 0);
  16040. /* "fontTools/misc/bezierTools.py":982
  16041. * )
  16042. * def calcCubicParametersC(pt1, pt2, pt3, pt4):
  16043. * c = (pt2 - pt1) * 3.0 # <<<<<<<<<<<<<<
  16044. * b = (pt3 - pt2) * 3.0 - c
  16045. * a = pt4 - pt1 - c - b
  16046. */
  16047. __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));
  16048. /* "fontTools/misc/bezierTools.py":983
  16049. * def calcCubicParametersC(pt1, pt2, pt3, pt4):
  16050. * c = (pt2 - pt1) * 3.0
  16051. * b = (pt3 - pt2) * 3.0 - c # <<<<<<<<<<<<<<
  16052. * a = pt4 - pt1 - c - b
  16053. * return (a, b, c, pt1)
  16054. */
  16055. __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);
  16056. /* "fontTools/misc/bezierTools.py":984
  16057. * c = (pt2 - pt1) * 3.0
  16058. * b = (pt3 - pt2) * 3.0 - c
  16059. * a = pt4 - pt1 - c - b # <<<<<<<<<<<<<<
  16060. * return (a, b, c, pt1)
  16061. *
  16062. */
  16063. __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);
  16064. /* "fontTools/misc/bezierTools.py":985
  16065. * b = (pt3 - pt2) * 3.0 - c
  16066. * a = pt4 - pt1 - c - b
  16067. * return (a, b, c, pt1) # <<<<<<<<<<<<<<
  16068. *
  16069. *
  16070. */
  16071. __Pyx_XDECREF(__pyx_r);
  16072. __pyx_t_1 = __pyx_PyComplex_FromComplex(__pyx_v_a); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 985, __pyx_L1_error)
  16073. __Pyx_GOTREF(__pyx_t_1);
  16074. __pyx_t_2 = __pyx_PyComplex_FromComplex(__pyx_v_b); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 985, __pyx_L1_error)
  16075. __Pyx_GOTREF(__pyx_t_2);
  16076. __pyx_t_3 = __pyx_PyComplex_FromComplex(__pyx_v_c); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 985, __pyx_L1_error)
  16077. __Pyx_GOTREF(__pyx_t_3);
  16078. __pyx_t_4 = __pyx_PyComplex_FromComplex(__pyx_v_pt1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 985, __pyx_L1_error)
  16079. __Pyx_GOTREF(__pyx_t_4);
  16080. __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 985, __pyx_L1_error)
  16081. __Pyx_GOTREF(__pyx_t_5);
  16082. __Pyx_GIVEREF(__pyx_t_1);
  16083. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 985, __pyx_L1_error);
  16084. __Pyx_GIVEREF(__pyx_t_2);
  16085. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 985, __pyx_L1_error);
  16086. __Pyx_GIVEREF(__pyx_t_3);
  16087. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 985, __pyx_L1_error);
  16088. __Pyx_GIVEREF(__pyx_t_4);
  16089. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4) != (0)) __PYX_ERR(0, 985, __pyx_L1_error);
  16090. __pyx_t_1 = 0;
  16091. __pyx_t_2 = 0;
  16092. __pyx_t_3 = 0;
  16093. __pyx_t_4 = 0;
  16094. __pyx_r = __pyx_t_5;
  16095. __pyx_t_5 = 0;
  16096. goto __pyx_L0;
  16097. /* "fontTools/misc/bezierTools.py":970
  16098. *
  16099. *
  16100. * @cython.cfunc # <<<<<<<<<<<<<<
  16101. * @cython.inline
  16102. * @cython.locals(
  16103. */
  16104. /* function exit code */
  16105. __pyx_L1_error:;
  16106. __Pyx_XDECREF(__pyx_t_1);
  16107. __Pyx_XDECREF(__pyx_t_2);
  16108. __Pyx_XDECREF(__pyx_t_3);
  16109. __Pyx_XDECREF(__pyx_t_4);
  16110. __Pyx_XDECREF(__pyx_t_5);
  16111. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcCubicParametersC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  16112. __pyx_r = 0;
  16113. __pyx_L0:;
  16114. __Pyx_XGIVEREF(__pyx_r);
  16115. __Pyx_RefNannyFinishContext();
  16116. return __pyx_r;
  16117. }
  16118. /* "fontTools/misc/bezierTools.py":988
  16119. *
  16120. *
  16121. * def calcQuadraticPoints(a, b, c): # <<<<<<<<<<<<<<
  16122. * ax, ay = a
  16123. * bx, by = b
  16124. */
  16125. /* Python wrapper */
  16126. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_55calcQuadraticPoints(PyObject *__pyx_self,
  16127. #if CYTHON_METH_FASTCALL
  16128. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  16129. #else
  16130. PyObject *__pyx_args, PyObject *__pyx_kwds
  16131. #endif
  16132. ); /*proto*/
  16133. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_54calcQuadraticPoints, "calcQuadraticPoints(a, b, c)");
  16134. 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};
  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. ) {
  16142. PyObject *__pyx_v_a = 0;
  16143. PyObject *__pyx_v_b = 0;
  16144. PyObject *__pyx_v_c = 0;
  16145. #if !CYTHON_METH_FASTCALL
  16146. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  16147. #endif
  16148. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  16149. PyObject* values[3] = {0,0,0};
  16150. int __pyx_lineno = 0;
  16151. const char *__pyx_filename = NULL;
  16152. int __pyx_clineno = 0;
  16153. PyObject *__pyx_r = 0;
  16154. __Pyx_RefNannyDeclarations
  16155. __Pyx_RefNannySetupContext("calcQuadraticPoints (wrapper)", 0);
  16156. #if !CYTHON_METH_FASTCALL
  16157. #if CYTHON_ASSUME_SAFE_SIZE
  16158. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  16159. #else
  16160. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  16161. #endif
  16162. #endif
  16163. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  16164. {
  16165. 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};
  16166. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  16167. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 988, __pyx_L3_error)
  16168. if (__pyx_kwds_len > 0) {
  16169. switch (__pyx_nargs) {
  16170. case 3:
  16171. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  16172. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 988, __pyx_L3_error)
  16173. CYTHON_FALLTHROUGH;
  16174. case 2:
  16175. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  16176. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 988, __pyx_L3_error)
  16177. CYTHON_FALLTHROUGH;
  16178. case 1:
  16179. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  16180. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 988, __pyx_L3_error)
  16181. CYTHON_FALLTHROUGH;
  16182. case 0: break;
  16183. default: goto __pyx_L5_argtuple_error;
  16184. }
  16185. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  16186. 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)
  16187. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  16188. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("calcQuadraticPoints", 1, 3, 3, i); __PYX_ERR(0, 988, __pyx_L3_error) }
  16189. }
  16190. } else if (unlikely(__pyx_nargs != 3)) {
  16191. goto __pyx_L5_argtuple_error;
  16192. } else {
  16193. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  16194. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 988, __pyx_L3_error)
  16195. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  16196. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 988, __pyx_L3_error)
  16197. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  16198. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 988, __pyx_L3_error)
  16199. }
  16200. __pyx_v_a = values[0];
  16201. __pyx_v_b = values[1];
  16202. __pyx_v_c = values[2];
  16203. }
  16204. goto __pyx_L6_skip;
  16205. __pyx_L5_argtuple_error:;
  16206. __Pyx_RaiseArgtupleInvalid("calcQuadraticPoints", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 988, __pyx_L3_error)
  16207. __pyx_L6_skip:;
  16208. goto __pyx_L4_argument_unpacking_done;
  16209. __pyx_L3_error:;
  16210. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  16211. Py_XDECREF(values[__pyx_temp]);
  16212. }
  16213. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcQuadraticPoints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  16214. __Pyx_RefNannyFinishContext();
  16215. return NULL;
  16216. __pyx_L4_argument_unpacking_done:;
  16217. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_54calcQuadraticPoints(__pyx_self, __pyx_v_a, __pyx_v_b, __pyx_v_c);
  16218. /* function exit code */
  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_RefNannyFinishContext();
  16223. return __pyx_r;
  16224. }
  16225. 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) {
  16226. PyObject *__pyx_v_ax = NULL;
  16227. PyObject *__pyx_v_ay = NULL;
  16228. PyObject *__pyx_v_bx = NULL;
  16229. PyObject *__pyx_v_by = NULL;
  16230. PyObject *__pyx_v_cx = NULL;
  16231. PyObject *__pyx_v_cy = NULL;
  16232. PyObject *__pyx_v_x1 = NULL;
  16233. PyObject *__pyx_v_y1 = NULL;
  16234. PyObject *__pyx_v_x2 = NULL;
  16235. PyObject *__pyx_v_y2 = NULL;
  16236. PyObject *__pyx_v_x3 = NULL;
  16237. PyObject *__pyx_v_y3 = NULL;
  16238. PyObject *__pyx_r = NULL;
  16239. __Pyx_RefNannyDeclarations
  16240. PyObject *__pyx_t_1 = NULL;
  16241. PyObject *__pyx_t_2 = NULL;
  16242. PyObject *__pyx_t_3 = NULL;
  16243. PyObject *(*__pyx_t_4)(PyObject *);
  16244. PyObject *__pyx_t_5 = NULL;
  16245. int __pyx_lineno = 0;
  16246. const char *__pyx_filename = NULL;
  16247. int __pyx_clineno = 0;
  16248. __Pyx_RefNannySetupContext("calcQuadraticPoints", 0);
  16249. /* "fontTools/misc/bezierTools.py":989
  16250. *
  16251. * def calcQuadraticPoints(a, b, c):
  16252. * ax, ay = a # <<<<<<<<<<<<<<
  16253. * bx, by = b
  16254. * cx, cy = c
  16255. */
  16256. if ((likely(PyTuple_CheckExact(__pyx_v_a))) || (PyList_CheckExact(__pyx_v_a))) {
  16257. PyObject* sequence = __pyx_v_a;
  16258. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  16259. if (unlikely(size != 2)) {
  16260. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  16261. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  16262. __PYX_ERR(0, 989, __pyx_L1_error)
  16263. }
  16264. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  16265. if (likely(PyTuple_CheckExact(sequence))) {
  16266. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  16267. __Pyx_INCREF(__pyx_t_1);
  16268. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  16269. __Pyx_INCREF(__pyx_t_2);
  16270. } else {
  16271. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  16272. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 989, __pyx_L1_error)
  16273. __Pyx_XGOTREF(__pyx_t_1);
  16274. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  16275. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 989, __pyx_L1_error)
  16276. __Pyx_XGOTREF(__pyx_t_2);
  16277. }
  16278. #else
  16279. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 989, __pyx_L1_error)
  16280. __Pyx_GOTREF(__pyx_t_1);
  16281. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 989, __pyx_L1_error)
  16282. __Pyx_GOTREF(__pyx_t_2);
  16283. #endif
  16284. } else {
  16285. Py_ssize_t index = -1;
  16286. __pyx_t_3 = PyObject_GetIter(__pyx_v_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 989, __pyx_L1_error)
  16287. __Pyx_GOTREF(__pyx_t_3);
  16288. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  16289. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
  16290. __Pyx_GOTREF(__pyx_t_1);
  16291. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  16292. __Pyx_GOTREF(__pyx_t_2);
  16293. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 989, __pyx_L1_error)
  16294. __pyx_t_4 = NULL;
  16295. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16296. goto __pyx_L4_unpacking_done;
  16297. __pyx_L3_unpacking_failed:;
  16298. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16299. __pyx_t_4 = NULL;
  16300. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  16301. __PYX_ERR(0, 989, __pyx_L1_error)
  16302. __pyx_L4_unpacking_done:;
  16303. }
  16304. __pyx_v_ax = __pyx_t_1;
  16305. __pyx_t_1 = 0;
  16306. __pyx_v_ay = __pyx_t_2;
  16307. __pyx_t_2 = 0;
  16308. /* "fontTools/misc/bezierTools.py":990
  16309. * def calcQuadraticPoints(a, b, c):
  16310. * ax, ay = a
  16311. * bx, by = b # <<<<<<<<<<<<<<
  16312. * cx, cy = c
  16313. * x1 = cx
  16314. */
  16315. if ((likely(PyTuple_CheckExact(__pyx_v_b))) || (PyList_CheckExact(__pyx_v_b))) {
  16316. PyObject* sequence = __pyx_v_b;
  16317. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  16318. if (unlikely(size != 2)) {
  16319. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  16320. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  16321. __PYX_ERR(0, 990, __pyx_L1_error)
  16322. }
  16323. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  16324. if (likely(PyTuple_CheckExact(sequence))) {
  16325. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  16326. __Pyx_INCREF(__pyx_t_2);
  16327. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  16328. __Pyx_INCREF(__pyx_t_1);
  16329. } else {
  16330. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  16331. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 990, __pyx_L1_error)
  16332. __Pyx_XGOTREF(__pyx_t_2);
  16333. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  16334. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 990, __pyx_L1_error)
  16335. __Pyx_XGOTREF(__pyx_t_1);
  16336. }
  16337. #else
  16338. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 990, __pyx_L1_error)
  16339. __Pyx_GOTREF(__pyx_t_2);
  16340. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 990, __pyx_L1_error)
  16341. __Pyx_GOTREF(__pyx_t_1);
  16342. #endif
  16343. } else {
  16344. Py_ssize_t index = -1;
  16345. __pyx_t_3 = PyObject_GetIter(__pyx_v_b); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 990, __pyx_L1_error)
  16346. __Pyx_GOTREF(__pyx_t_3);
  16347. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  16348. index = 0; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
  16349. __Pyx_GOTREF(__pyx_t_2);
  16350. index = 1; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
  16351. __Pyx_GOTREF(__pyx_t_1);
  16352. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 990, __pyx_L1_error)
  16353. __pyx_t_4 = NULL;
  16354. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16355. goto __pyx_L6_unpacking_done;
  16356. __pyx_L5_unpacking_failed:;
  16357. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16358. __pyx_t_4 = NULL;
  16359. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  16360. __PYX_ERR(0, 990, __pyx_L1_error)
  16361. __pyx_L6_unpacking_done:;
  16362. }
  16363. __pyx_v_bx = __pyx_t_2;
  16364. __pyx_t_2 = 0;
  16365. __pyx_v_by = __pyx_t_1;
  16366. __pyx_t_1 = 0;
  16367. /* "fontTools/misc/bezierTools.py":991
  16368. * ax, ay = a
  16369. * bx, by = b
  16370. * cx, cy = c # <<<<<<<<<<<<<<
  16371. * x1 = cx
  16372. * y1 = cy
  16373. */
  16374. if ((likely(PyTuple_CheckExact(__pyx_v_c))) || (PyList_CheckExact(__pyx_v_c))) {
  16375. PyObject* sequence = __pyx_v_c;
  16376. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  16377. if (unlikely(size != 2)) {
  16378. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  16379. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  16380. __PYX_ERR(0, 991, __pyx_L1_error)
  16381. }
  16382. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  16383. if (likely(PyTuple_CheckExact(sequence))) {
  16384. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  16385. __Pyx_INCREF(__pyx_t_1);
  16386. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  16387. __Pyx_INCREF(__pyx_t_2);
  16388. } else {
  16389. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  16390. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 991, __pyx_L1_error)
  16391. __Pyx_XGOTREF(__pyx_t_1);
  16392. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  16393. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 991, __pyx_L1_error)
  16394. __Pyx_XGOTREF(__pyx_t_2);
  16395. }
  16396. #else
  16397. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 991, __pyx_L1_error)
  16398. __Pyx_GOTREF(__pyx_t_1);
  16399. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 991, __pyx_L1_error)
  16400. __Pyx_GOTREF(__pyx_t_2);
  16401. #endif
  16402. } else {
  16403. Py_ssize_t index = -1;
  16404. __pyx_t_3 = PyObject_GetIter(__pyx_v_c); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 991, __pyx_L1_error)
  16405. __Pyx_GOTREF(__pyx_t_3);
  16406. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  16407. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
  16408. __Pyx_GOTREF(__pyx_t_1);
  16409. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
  16410. __Pyx_GOTREF(__pyx_t_2);
  16411. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 991, __pyx_L1_error)
  16412. __pyx_t_4 = NULL;
  16413. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16414. goto __pyx_L8_unpacking_done;
  16415. __pyx_L7_unpacking_failed:;
  16416. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16417. __pyx_t_4 = NULL;
  16418. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  16419. __PYX_ERR(0, 991, __pyx_L1_error)
  16420. __pyx_L8_unpacking_done:;
  16421. }
  16422. __pyx_v_cx = __pyx_t_1;
  16423. __pyx_t_1 = 0;
  16424. __pyx_v_cy = __pyx_t_2;
  16425. __pyx_t_2 = 0;
  16426. /* "fontTools/misc/bezierTools.py":992
  16427. * bx, by = b
  16428. * cx, cy = c
  16429. * x1 = cx # <<<<<<<<<<<<<<
  16430. * y1 = cy
  16431. * x2 = (bx * 0.5) + cx
  16432. */
  16433. __Pyx_INCREF(__pyx_v_cx);
  16434. __pyx_v_x1 = __pyx_v_cx;
  16435. /* "fontTools/misc/bezierTools.py":993
  16436. * cx, cy = c
  16437. * x1 = cx
  16438. * y1 = cy # <<<<<<<<<<<<<<
  16439. * x2 = (bx * 0.5) + cx
  16440. * y2 = (by * 0.5) + cy
  16441. */
  16442. __Pyx_INCREF(__pyx_v_cy);
  16443. __pyx_v_y1 = __pyx_v_cy;
  16444. /* "fontTools/misc/bezierTools.py":994
  16445. * x1 = cx
  16446. * y1 = cy
  16447. * x2 = (bx * 0.5) + cx # <<<<<<<<<<<<<<
  16448. * y2 = (by * 0.5) + cy
  16449. * x3 = ax + bx + cx
  16450. */
  16451. __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)
  16452. __Pyx_GOTREF(__pyx_t_2);
  16453. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_cx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 994, __pyx_L1_error)
  16454. __Pyx_GOTREF(__pyx_t_1);
  16455. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  16456. __pyx_v_x2 = __pyx_t_1;
  16457. __pyx_t_1 = 0;
  16458. /* "fontTools/misc/bezierTools.py":995
  16459. * y1 = cy
  16460. * x2 = (bx * 0.5) + cx
  16461. * y2 = (by * 0.5) + cy # <<<<<<<<<<<<<<
  16462. * x3 = ax + bx + cx
  16463. * y3 = ay + by + cy
  16464. */
  16465. __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)
  16466. __Pyx_GOTREF(__pyx_t_1);
  16467. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_cy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 995, __pyx_L1_error)
  16468. __Pyx_GOTREF(__pyx_t_2);
  16469. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16470. __pyx_v_y2 = __pyx_t_2;
  16471. __pyx_t_2 = 0;
  16472. /* "fontTools/misc/bezierTools.py":996
  16473. * x2 = (bx * 0.5) + cx
  16474. * y2 = (by * 0.5) + cy
  16475. * x3 = ax + bx + cx # <<<<<<<<<<<<<<
  16476. * y3 = ay + by + cy
  16477. * return (x1, y1), (x2, y2), (x3, y3)
  16478. */
  16479. __pyx_t_2 = PyNumber_Add(__pyx_v_ax, __pyx_v_bx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 996, __pyx_L1_error)
  16480. __Pyx_GOTREF(__pyx_t_2);
  16481. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_cx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 996, __pyx_L1_error)
  16482. __Pyx_GOTREF(__pyx_t_1);
  16483. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  16484. __pyx_v_x3 = __pyx_t_1;
  16485. __pyx_t_1 = 0;
  16486. /* "fontTools/misc/bezierTools.py":997
  16487. * y2 = (by * 0.5) + cy
  16488. * x3 = ax + bx + cx
  16489. * y3 = ay + by + cy # <<<<<<<<<<<<<<
  16490. * return (x1, y1), (x2, y2), (x3, y3)
  16491. *
  16492. */
  16493. __pyx_t_1 = PyNumber_Add(__pyx_v_ay, __pyx_v_by); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 997, __pyx_L1_error)
  16494. __Pyx_GOTREF(__pyx_t_1);
  16495. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_cy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 997, __pyx_L1_error)
  16496. __Pyx_GOTREF(__pyx_t_2);
  16497. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16498. __pyx_v_y3 = __pyx_t_2;
  16499. __pyx_t_2 = 0;
  16500. /* "fontTools/misc/bezierTools.py":998
  16501. * x3 = ax + bx + cx
  16502. * y3 = ay + by + cy
  16503. * return (x1, y1), (x2, y2), (x3, y3) # <<<<<<<<<<<<<<
  16504. *
  16505. *
  16506. */
  16507. __Pyx_XDECREF(__pyx_r);
  16508. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 998, __pyx_L1_error)
  16509. __Pyx_GOTREF(__pyx_t_2);
  16510. __Pyx_INCREF(__pyx_v_x1);
  16511. __Pyx_GIVEREF(__pyx_v_x1);
  16512. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_x1) != (0)) __PYX_ERR(0, 998, __pyx_L1_error);
  16513. __Pyx_INCREF(__pyx_v_y1);
  16514. __Pyx_GIVEREF(__pyx_v_y1);
  16515. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_y1) != (0)) __PYX_ERR(0, 998, __pyx_L1_error);
  16516. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 998, __pyx_L1_error)
  16517. __Pyx_GOTREF(__pyx_t_1);
  16518. __Pyx_INCREF(__pyx_v_x2);
  16519. __Pyx_GIVEREF(__pyx_v_x2);
  16520. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x2) != (0)) __PYX_ERR(0, 998, __pyx_L1_error);
  16521. __Pyx_INCREF(__pyx_v_y2);
  16522. __Pyx_GIVEREF(__pyx_v_y2);
  16523. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_y2) != (0)) __PYX_ERR(0, 998, __pyx_L1_error);
  16524. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 998, __pyx_L1_error)
  16525. __Pyx_GOTREF(__pyx_t_3);
  16526. __Pyx_INCREF(__pyx_v_x3);
  16527. __Pyx_GIVEREF(__pyx_v_x3);
  16528. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x3) != (0)) __PYX_ERR(0, 998, __pyx_L1_error);
  16529. __Pyx_INCREF(__pyx_v_y3);
  16530. __Pyx_GIVEREF(__pyx_v_y3);
  16531. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_y3) != (0)) __PYX_ERR(0, 998, __pyx_L1_error);
  16532. __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 998, __pyx_L1_error)
  16533. __Pyx_GOTREF(__pyx_t_5);
  16534. __Pyx_GIVEREF(__pyx_t_2);
  16535. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 998, __pyx_L1_error);
  16536. __Pyx_GIVEREF(__pyx_t_1);
  16537. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 998, __pyx_L1_error);
  16538. __Pyx_GIVEREF(__pyx_t_3);
  16539. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 998, __pyx_L1_error);
  16540. __pyx_t_2 = 0;
  16541. __pyx_t_1 = 0;
  16542. __pyx_t_3 = 0;
  16543. __pyx_r = __pyx_t_5;
  16544. __pyx_t_5 = 0;
  16545. goto __pyx_L0;
  16546. /* "fontTools/misc/bezierTools.py":988
  16547. *
  16548. *
  16549. * def calcQuadraticPoints(a, b, c): # <<<<<<<<<<<<<<
  16550. * ax, ay = a
  16551. * bx, by = b
  16552. */
  16553. /* function exit code */
  16554. __pyx_L1_error:;
  16555. __Pyx_XDECREF(__pyx_t_1);
  16556. __Pyx_XDECREF(__pyx_t_2);
  16557. __Pyx_XDECREF(__pyx_t_3);
  16558. __Pyx_XDECREF(__pyx_t_5);
  16559. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcQuadraticPoints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  16560. __pyx_r = NULL;
  16561. __pyx_L0:;
  16562. __Pyx_XDECREF(__pyx_v_ax);
  16563. __Pyx_XDECREF(__pyx_v_ay);
  16564. __Pyx_XDECREF(__pyx_v_bx);
  16565. __Pyx_XDECREF(__pyx_v_by);
  16566. __Pyx_XDECREF(__pyx_v_cx);
  16567. __Pyx_XDECREF(__pyx_v_cy);
  16568. __Pyx_XDECREF(__pyx_v_x1);
  16569. __Pyx_XDECREF(__pyx_v_y1);
  16570. __Pyx_XDECREF(__pyx_v_x2);
  16571. __Pyx_XDECREF(__pyx_v_y2);
  16572. __Pyx_XDECREF(__pyx_v_x3);
  16573. __Pyx_XDECREF(__pyx_v_y3);
  16574. __Pyx_XGIVEREF(__pyx_r);
  16575. __Pyx_RefNannyFinishContext();
  16576. return __pyx_r;
  16577. }
  16578. /* "fontTools/misc/bezierTools.py":1001
  16579. *
  16580. *
  16581. * def calcCubicPoints(a, b, c, d): # <<<<<<<<<<<<<<
  16582. * ax, ay = a
  16583. * bx, by = b
  16584. */
  16585. /* Python wrapper */
  16586. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_57calcCubicPoints(PyObject *__pyx_self,
  16587. #if CYTHON_METH_FASTCALL
  16588. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  16589. #else
  16590. PyObject *__pyx_args, PyObject *__pyx_kwds
  16591. #endif
  16592. ); /*proto*/
  16593. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_56calcCubicPoints, "calcCubicPoints(a, b, c, d)");
  16594. 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};
  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. ) {
  16602. PyObject *__pyx_v_a = 0;
  16603. PyObject *__pyx_v_b = 0;
  16604. PyObject *__pyx_v_c = 0;
  16605. PyObject *__pyx_v_d = 0;
  16606. #if !CYTHON_METH_FASTCALL
  16607. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  16608. #endif
  16609. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  16610. PyObject* values[4] = {0,0,0,0};
  16611. int __pyx_lineno = 0;
  16612. const char *__pyx_filename = NULL;
  16613. int __pyx_clineno = 0;
  16614. PyObject *__pyx_r = 0;
  16615. __Pyx_RefNannyDeclarations
  16616. __Pyx_RefNannySetupContext("calcCubicPoints (wrapper)", 0);
  16617. #if !CYTHON_METH_FASTCALL
  16618. #if CYTHON_ASSUME_SAFE_SIZE
  16619. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  16620. #else
  16621. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  16622. #endif
  16623. #endif
  16624. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  16625. {
  16626. 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};
  16627. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  16628. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1001, __pyx_L3_error)
  16629. if (__pyx_kwds_len > 0) {
  16630. switch (__pyx_nargs) {
  16631. case 4:
  16632. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  16633. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1001, __pyx_L3_error)
  16634. CYTHON_FALLTHROUGH;
  16635. case 3:
  16636. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  16637. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1001, __pyx_L3_error)
  16638. CYTHON_FALLTHROUGH;
  16639. case 2:
  16640. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  16641. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1001, __pyx_L3_error)
  16642. CYTHON_FALLTHROUGH;
  16643. case 1:
  16644. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  16645. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1001, __pyx_L3_error)
  16646. CYTHON_FALLTHROUGH;
  16647. case 0: break;
  16648. default: goto __pyx_L5_argtuple_error;
  16649. }
  16650. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  16651. 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)
  16652. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  16653. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("calcCubicPoints", 1, 4, 4, i); __PYX_ERR(0, 1001, __pyx_L3_error) }
  16654. }
  16655. } else if (unlikely(__pyx_nargs != 4)) {
  16656. goto __pyx_L5_argtuple_error;
  16657. } else {
  16658. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  16659. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1001, __pyx_L3_error)
  16660. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  16661. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1001, __pyx_L3_error)
  16662. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  16663. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1001, __pyx_L3_error)
  16664. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  16665. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1001, __pyx_L3_error)
  16666. }
  16667. __pyx_v_a = values[0];
  16668. __pyx_v_b = values[1];
  16669. __pyx_v_c = values[2];
  16670. __pyx_v_d = values[3];
  16671. }
  16672. goto __pyx_L6_skip;
  16673. __pyx_L5_argtuple_error:;
  16674. __Pyx_RaiseArgtupleInvalid("calcCubicPoints", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 1001, __pyx_L3_error)
  16675. __pyx_L6_skip:;
  16676. goto __pyx_L4_argument_unpacking_done;
  16677. __pyx_L3_error:;
  16678. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  16679. Py_XDECREF(values[__pyx_temp]);
  16680. }
  16681. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcCubicPoints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  16682. __Pyx_RefNannyFinishContext();
  16683. return NULL;
  16684. __pyx_L4_argument_unpacking_done:;
  16685. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_56calcCubicPoints(__pyx_self, __pyx_v_a, __pyx_v_b, __pyx_v_c, __pyx_v_d);
  16686. /* function exit code */
  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_RefNannyFinishContext();
  16691. return __pyx_r;
  16692. }
  16693. 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) {
  16694. PyObject *__pyx_v_ax = NULL;
  16695. PyObject *__pyx_v_ay = NULL;
  16696. PyObject *__pyx_v_bx = NULL;
  16697. PyObject *__pyx_v_by = NULL;
  16698. PyObject *__pyx_v_cx = NULL;
  16699. PyObject *__pyx_v_cy = NULL;
  16700. PyObject *__pyx_v_dx = NULL;
  16701. PyObject *__pyx_v_dy = NULL;
  16702. PyObject *__pyx_v_x1 = NULL;
  16703. PyObject *__pyx_v_y1 = NULL;
  16704. PyObject *__pyx_v_x2 = NULL;
  16705. PyObject *__pyx_v_y2 = NULL;
  16706. PyObject *__pyx_v_x3 = NULL;
  16707. PyObject *__pyx_v_y3 = NULL;
  16708. PyObject *__pyx_v_x4 = NULL;
  16709. PyObject *__pyx_v_y4 = NULL;
  16710. PyObject *__pyx_r = NULL;
  16711. __Pyx_RefNannyDeclarations
  16712. PyObject *__pyx_t_1 = NULL;
  16713. PyObject *__pyx_t_2 = NULL;
  16714. PyObject *__pyx_t_3 = NULL;
  16715. PyObject *(*__pyx_t_4)(PyObject *);
  16716. PyObject *__pyx_t_5 = NULL;
  16717. PyObject *__pyx_t_6 = NULL;
  16718. int __pyx_lineno = 0;
  16719. const char *__pyx_filename = NULL;
  16720. int __pyx_clineno = 0;
  16721. __Pyx_RefNannySetupContext("calcCubicPoints", 0);
  16722. /* "fontTools/misc/bezierTools.py":1002
  16723. *
  16724. * def calcCubicPoints(a, b, c, d):
  16725. * ax, ay = a # <<<<<<<<<<<<<<
  16726. * bx, by = b
  16727. * cx, cy = c
  16728. */
  16729. if ((likely(PyTuple_CheckExact(__pyx_v_a))) || (PyList_CheckExact(__pyx_v_a))) {
  16730. PyObject* sequence = __pyx_v_a;
  16731. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  16732. if (unlikely(size != 2)) {
  16733. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  16734. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  16735. __PYX_ERR(0, 1002, __pyx_L1_error)
  16736. }
  16737. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  16738. if (likely(PyTuple_CheckExact(sequence))) {
  16739. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  16740. __Pyx_INCREF(__pyx_t_1);
  16741. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  16742. __Pyx_INCREF(__pyx_t_2);
  16743. } else {
  16744. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  16745. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1002, __pyx_L1_error)
  16746. __Pyx_XGOTREF(__pyx_t_1);
  16747. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  16748. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1002, __pyx_L1_error)
  16749. __Pyx_XGOTREF(__pyx_t_2);
  16750. }
  16751. #else
  16752. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1002, __pyx_L1_error)
  16753. __Pyx_GOTREF(__pyx_t_1);
  16754. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1002, __pyx_L1_error)
  16755. __Pyx_GOTREF(__pyx_t_2);
  16756. #endif
  16757. } else {
  16758. Py_ssize_t index = -1;
  16759. __pyx_t_3 = PyObject_GetIter(__pyx_v_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1002, __pyx_L1_error)
  16760. __Pyx_GOTREF(__pyx_t_3);
  16761. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  16762. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
  16763. __Pyx_GOTREF(__pyx_t_1);
  16764. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  16765. __Pyx_GOTREF(__pyx_t_2);
  16766. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 1002, __pyx_L1_error)
  16767. __pyx_t_4 = NULL;
  16768. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16769. goto __pyx_L4_unpacking_done;
  16770. __pyx_L3_unpacking_failed:;
  16771. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16772. __pyx_t_4 = NULL;
  16773. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  16774. __PYX_ERR(0, 1002, __pyx_L1_error)
  16775. __pyx_L4_unpacking_done:;
  16776. }
  16777. __pyx_v_ax = __pyx_t_1;
  16778. __pyx_t_1 = 0;
  16779. __pyx_v_ay = __pyx_t_2;
  16780. __pyx_t_2 = 0;
  16781. /* "fontTools/misc/bezierTools.py":1003
  16782. * def calcCubicPoints(a, b, c, d):
  16783. * ax, ay = a
  16784. * bx, by = b # <<<<<<<<<<<<<<
  16785. * cx, cy = c
  16786. * dx, dy = d
  16787. */
  16788. if ((likely(PyTuple_CheckExact(__pyx_v_b))) || (PyList_CheckExact(__pyx_v_b))) {
  16789. PyObject* sequence = __pyx_v_b;
  16790. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  16791. if (unlikely(size != 2)) {
  16792. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  16793. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  16794. __PYX_ERR(0, 1003, __pyx_L1_error)
  16795. }
  16796. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  16797. if (likely(PyTuple_CheckExact(sequence))) {
  16798. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  16799. __Pyx_INCREF(__pyx_t_2);
  16800. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  16801. __Pyx_INCREF(__pyx_t_1);
  16802. } else {
  16803. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  16804. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1003, __pyx_L1_error)
  16805. __Pyx_XGOTREF(__pyx_t_2);
  16806. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  16807. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1003, __pyx_L1_error)
  16808. __Pyx_XGOTREF(__pyx_t_1);
  16809. }
  16810. #else
  16811. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1003, __pyx_L1_error)
  16812. __Pyx_GOTREF(__pyx_t_2);
  16813. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1003, __pyx_L1_error)
  16814. __Pyx_GOTREF(__pyx_t_1);
  16815. #endif
  16816. } else {
  16817. Py_ssize_t index = -1;
  16818. __pyx_t_3 = PyObject_GetIter(__pyx_v_b); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1003, __pyx_L1_error)
  16819. __Pyx_GOTREF(__pyx_t_3);
  16820. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  16821. index = 0; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
  16822. __Pyx_GOTREF(__pyx_t_2);
  16823. index = 1; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
  16824. __Pyx_GOTREF(__pyx_t_1);
  16825. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 1003, __pyx_L1_error)
  16826. __pyx_t_4 = NULL;
  16827. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16828. goto __pyx_L6_unpacking_done;
  16829. __pyx_L5_unpacking_failed:;
  16830. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16831. __pyx_t_4 = NULL;
  16832. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  16833. __PYX_ERR(0, 1003, __pyx_L1_error)
  16834. __pyx_L6_unpacking_done:;
  16835. }
  16836. __pyx_v_bx = __pyx_t_2;
  16837. __pyx_t_2 = 0;
  16838. __pyx_v_by = __pyx_t_1;
  16839. __pyx_t_1 = 0;
  16840. /* "fontTools/misc/bezierTools.py":1004
  16841. * ax, ay = a
  16842. * bx, by = b
  16843. * cx, cy = c # <<<<<<<<<<<<<<
  16844. * dx, dy = d
  16845. * x1 = dx
  16846. */
  16847. if ((likely(PyTuple_CheckExact(__pyx_v_c))) || (PyList_CheckExact(__pyx_v_c))) {
  16848. PyObject* sequence = __pyx_v_c;
  16849. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  16850. if (unlikely(size != 2)) {
  16851. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  16852. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  16853. __PYX_ERR(0, 1004, __pyx_L1_error)
  16854. }
  16855. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  16856. if (likely(PyTuple_CheckExact(sequence))) {
  16857. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  16858. __Pyx_INCREF(__pyx_t_1);
  16859. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  16860. __Pyx_INCREF(__pyx_t_2);
  16861. } else {
  16862. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  16863. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1004, __pyx_L1_error)
  16864. __Pyx_XGOTREF(__pyx_t_1);
  16865. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  16866. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1004, __pyx_L1_error)
  16867. __Pyx_XGOTREF(__pyx_t_2);
  16868. }
  16869. #else
  16870. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1004, __pyx_L1_error)
  16871. __Pyx_GOTREF(__pyx_t_1);
  16872. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1004, __pyx_L1_error)
  16873. __Pyx_GOTREF(__pyx_t_2);
  16874. #endif
  16875. } else {
  16876. Py_ssize_t index = -1;
  16877. __pyx_t_3 = PyObject_GetIter(__pyx_v_c); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1004, __pyx_L1_error)
  16878. __Pyx_GOTREF(__pyx_t_3);
  16879. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  16880. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
  16881. __Pyx_GOTREF(__pyx_t_1);
  16882. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
  16883. __Pyx_GOTREF(__pyx_t_2);
  16884. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 1004, __pyx_L1_error)
  16885. __pyx_t_4 = NULL;
  16886. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16887. goto __pyx_L8_unpacking_done;
  16888. __pyx_L7_unpacking_failed:;
  16889. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16890. __pyx_t_4 = NULL;
  16891. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  16892. __PYX_ERR(0, 1004, __pyx_L1_error)
  16893. __pyx_L8_unpacking_done:;
  16894. }
  16895. __pyx_v_cx = __pyx_t_1;
  16896. __pyx_t_1 = 0;
  16897. __pyx_v_cy = __pyx_t_2;
  16898. __pyx_t_2 = 0;
  16899. /* "fontTools/misc/bezierTools.py":1005
  16900. * bx, by = b
  16901. * cx, cy = c
  16902. * dx, dy = d # <<<<<<<<<<<<<<
  16903. * x1 = dx
  16904. * y1 = dy
  16905. */
  16906. if ((likely(PyTuple_CheckExact(__pyx_v_d))) || (PyList_CheckExact(__pyx_v_d))) {
  16907. PyObject* sequence = __pyx_v_d;
  16908. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  16909. if (unlikely(size != 2)) {
  16910. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  16911. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  16912. __PYX_ERR(0, 1005, __pyx_L1_error)
  16913. }
  16914. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  16915. if (likely(PyTuple_CheckExact(sequence))) {
  16916. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  16917. __Pyx_INCREF(__pyx_t_2);
  16918. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  16919. __Pyx_INCREF(__pyx_t_1);
  16920. } else {
  16921. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  16922. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1005, __pyx_L1_error)
  16923. __Pyx_XGOTREF(__pyx_t_2);
  16924. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  16925. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1005, __pyx_L1_error)
  16926. __Pyx_XGOTREF(__pyx_t_1);
  16927. }
  16928. #else
  16929. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1005, __pyx_L1_error)
  16930. __Pyx_GOTREF(__pyx_t_2);
  16931. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1005, __pyx_L1_error)
  16932. __Pyx_GOTREF(__pyx_t_1);
  16933. #endif
  16934. } else {
  16935. Py_ssize_t index = -1;
  16936. __pyx_t_3 = PyObject_GetIter(__pyx_v_d); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1005, __pyx_L1_error)
  16937. __Pyx_GOTREF(__pyx_t_3);
  16938. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  16939. index = 0; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L9_unpacking_failed;
  16940. __Pyx_GOTREF(__pyx_t_2);
  16941. index = 1; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L9_unpacking_failed;
  16942. __Pyx_GOTREF(__pyx_t_1);
  16943. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 1005, __pyx_L1_error)
  16944. __pyx_t_4 = NULL;
  16945. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16946. goto __pyx_L10_unpacking_done;
  16947. __pyx_L9_unpacking_failed:;
  16948. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16949. __pyx_t_4 = NULL;
  16950. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  16951. __PYX_ERR(0, 1005, __pyx_L1_error)
  16952. __pyx_L10_unpacking_done:;
  16953. }
  16954. __pyx_v_dx = __pyx_t_2;
  16955. __pyx_t_2 = 0;
  16956. __pyx_v_dy = __pyx_t_1;
  16957. __pyx_t_1 = 0;
  16958. /* "fontTools/misc/bezierTools.py":1006
  16959. * cx, cy = c
  16960. * dx, dy = d
  16961. * x1 = dx # <<<<<<<<<<<<<<
  16962. * y1 = dy
  16963. * x2 = (cx / 3.0) + dx
  16964. */
  16965. __Pyx_INCREF(__pyx_v_dx);
  16966. __pyx_v_x1 = __pyx_v_dx;
  16967. /* "fontTools/misc/bezierTools.py":1007
  16968. * dx, dy = d
  16969. * x1 = dx
  16970. * y1 = dy # <<<<<<<<<<<<<<
  16971. * x2 = (cx / 3.0) + dx
  16972. * y2 = (cy / 3.0) + dy
  16973. */
  16974. __Pyx_INCREF(__pyx_v_dy);
  16975. __pyx_v_y1 = __pyx_v_dy;
  16976. /* "fontTools/misc/bezierTools.py":1008
  16977. * x1 = dx
  16978. * y1 = dy
  16979. * x2 = (cx / 3.0) + dx # <<<<<<<<<<<<<<
  16980. * y2 = (cy / 3.0) + dy
  16981. * x3 = (bx + cx) / 3.0 + x2
  16982. */
  16983. __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)
  16984. __Pyx_GOTREF(__pyx_t_1);
  16985. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_dx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1008, __pyx_L1_error)
  16986. __Pyx_GOTREF(__pyx_t_2);
  16987. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16988. __pyx_v_x2 = __pyx_t_2;
  16989. __pyx_t_2 = 0;
  16990. /* "fontTools/misc/bezierTools.py":1009
  16991. * y1 = dy
  16992. * x2 = (cx / 3.0) + dx
  16993. * y2 = (cy / 3.0) + dy # <<<<<<<<<<<<<<
  16994. * x3 = (bx + cx) / 3.0 + x2
  16995. * y3 = (by + cy) / 3.0 + y2
  16996. */
  16997. __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)
  16998. __Pyx_GOTREF(__pyx_t_2);
  16999. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_dy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1009, __pyx_L1_error)
  17000. __Pyx_GOTREF(__pyx_t_1);
  17001. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17002. __pyx_v_y2 = __pyx_t_1;
  17003. __pyx_t_1 = 0;
  17004. /* "fontTools/misc/bezierTools.py":1010
  17005. * x2 = (cx / 3.0) + dx
  17006. * y2 = (cy / 3.0) + dy
  17007. * x3 = (bx + cx) / 3.0 + x2 # <<<<<<<<<<<<<<
  17008. * y3 = (by + cy) / 3.0 + y2
  17009. * x4 = ax + dx + cx + bx
  17010. */
  17011. __pyx_t_1 = PyNumber_Add(__pyx_v_bx, __pyx_v_cx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1010, __pyx_L1_error)
  17012. __Pyx_GOTREF(__pyx_t_1);
  17013. __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)
  17014. __Pyx_GOTREF(__pyx_t_2);
  17015. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17016. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_x2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1010, __pyx_L1_error)
  17017. __Pyx_GOTREF(__pyx_t_1);
  17018. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17019. __pyx_v_x3 = __pyx_t_1;
  17020. __pyx_t_1 = 0;
  17021. /* "fontTools/misc/bezierTools.py":1011
  17022. * y2 = (cy / 3.0) + dy
  17023. * x3 = (bx + cx) / 3.0 + x2
  17024. * y3 = (by + cy) / 3.0 + y2 # <<<<<<<<<<<<<<
  17025. * x4 = ax + dx + cx + bx
  17026. * y4 = ay + dy + cy + by
  17027. */
  17028. __pyx_t_1 = PyNumber_Add(__pyx_v_by, __pyx_v_cy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1011, __pyx_L1_error)
  17029. __Pyx_GOTREF(__pyx_t_1);
  17030. __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)
  17031. __Pyx_GOTREF(__pyx_t_2);
  17032. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17033. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_y2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1011, __pyx_L1_error)
  17034. __Pyx_GOTREF(__pyx_t_1);
  17035. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17036. __pyx_v_y3 = __pyx_t_1;
  17037. __pyx_t_1 = 0;
  17038. /* "fontTools/misc/bezierTools.py":1012
  17039. * x3 = (bx + cx) / 3.0 + x2
  17040. * y3 = (by + cy) / 3.0 + y2
  17041. * x4 = ax + dx + cx + bx # <<<<<<<<<<<<<<
  17042. * y4 = ay + dy + cy + by
  17043. * return (x1, y1), (x2, y2), (x3, y3), (x4, y4)
  17044. */
  17045. __pyx_t_1 = PyNumber_Add(__pyx_v_ax, __pyx_v_dx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1012, __pyx_L1_error)
  17046. __Pyx_GOTREF(__pyx_t_1);
  17047. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_cx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1012, __pyx_L1_error)
  17048. __Pyx_GOTREF(__pyx_t_2);
  17049. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17050. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_bx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1012, __pyx_L1_error)
  17051. __Pyx_GOTREF(__pyx_t_1);
  17052. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17053. __pyx_v_x4 = __pyx_t_1;
  17054. __pyx_t_1 = 0;
  17055. /* "fontTools/misc/bezierTools.py":1013
  17056. * y3 = (by + cy) / 3.0 + y2
  17057. * x4 = ax + dx + cx + bx
  17058. * y4 = ay + dy + cy + by # <<<<<<<<<<<<<<
  17059. * return (x1, y1), (x2, y2), (x3, y3), (x4, y4)
  17060. *
  17061. */
  17062. __pyx_t_1 = PyNumber_Add(__pyx_v_ay, __pyx_v_dy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1013, __pyx_L1_error)
  17063. __Pyx_GOTREF(__pyx_t_1);
  17064. __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_cy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1013, __pyx_L1_error)
  17065. __Pyx_GOTREF(__pyx_t_2);
  17066. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17067. __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_by); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1013, __pyx_L1_error)
  17068. __Pyx_GOTREF(__pyx_t_1);
  17069. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17070. __pyx_v_y4 = __pyx_t_1;
  17071. __pyx_t_1 = 0;
  17072. /* "fontTools/misc/bezierTools.py":1014
  17073. * x4 = ax + dx + cx + bx
  17074. * y4 = ay + dy + cy + by
  17075. * return (x1, y1), (x2, y2), (x3, y3), (x4, y4) # <<<<<<<<<<<<<<
  17076. *
  17077. *
  17078. */
  17079. __Pyx_XDECREF(__pyx_r);
  17080. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1014, __pyx_L1_error)
  17081. __Pyx_GOTREF(__pyx_t_1);
  17082. __Pyx_INCREF(__pyx_v_x1);
  17083. __Pyx_GIVEREF(__pyx_v_x1);
  17084. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x1) != (0)) __PYX_ERR(0, 1014, __pyx_L1_error);
  17085. __Pyx_INCREF(__pyx_v_y1);
  17086. __Pyx_GIVEREF(__pyx_v_y1);
  17087. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_y1) != (0)) __PYX_ERR(0, 1014, __pyx_L1_error);
  17088. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1014, __pyx_L1_error)
  17089. __Pyx_GOTREF(__pyx_t_2);
  17090. __Pyx_INCREF(__pyx_v_x2);
  17091. __Pyx_GIVEREF(__pyx_v_x2);
  17092. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_x2) != (0)) __PYX_ERR(0, 1014, __pyx_L1_error);
  17093. __Pyx_INCREF(__pyx_v_y2);
  17094. __Pyx_GIVEREF(__pyx_v_y2);
  17095. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_y2) != (0)) __PYX_ERR(0, 1014, __pyx_L1_error);
  17096. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1014, __pyx_L1_error)
  17097. __Pyx_GOTREF(__pyx_t_3);
  17098. __Pyx_INCREF(__pyx_v_x3);
  17099. __Pyx_GIVEREF(__pyx_v_x3);
  17100. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x3) != (0)) __PYX_ERR(0, 1014, __pyx_L1_error);
  17101. __Pyx_INCREF(__pyx_v_y3);
  17102. __Pyx_GIVEREF(__pyx_v_y3);
  17103. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_y3) != (0)) __PYX_ERR(0, 1014, __pyx_L1_error);
  17104. __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1014, __pyx_L1_error)
  17105. __Pyx_GOTREF(__pyx_t_5);
  17106. __Pyx_INCREF(__pyx_v_x4);
  17107. __Pyx_GIVEREF(__pyx_v_x4);
  17108. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_x4) != (0)) __PYX_ERR(0, 1014, __pyx_L1_error);
  17109. __Pyx_INCREF(__pyx_v_y4);
  17110. __Pyx_GIVEREF(__pyx_v_y4);
  17111. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_y4) != (0)) __PYX_ERR(0, 1014, __pyx_L1_error);
  17112. __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1014, __pyx_L1_error)
  17113. __Pyx_GOTREF(__pyx_t_6);
  17114. __Pyx_GIVEREF(__pyx_t_1);
  17115. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 1014, __pyx_L1_error);
  17116. __Pyx_GIVEREF(__pyx_t_2);
  17117. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 1014, __pyx_L1_error);
  17118. __Pyx_GIVEREF(__pyx_t_3);
  17119. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 1014, __pyx_L1_error);
  17120. __Pyx_GIVEREF(__pyx_t_5);
  17121. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_5) != (0)) __PYX_ERR(0, 1014, __pyx_L1_error);
  17122. __pyx_t_1 = 0;
  17123. __pyx_t_2 = 0;
  17124. __pyx_t_3 = 0;
  17125. __pyx_t_5 = 0;
  17126. __pyx_r = __pyx_t_6;
  17127. __pyx_t_6 = 0;
  17128. goto __pyx_L0;
  17129. /* "fontTools/misc/bezierTools.py":1001
  17130. *
  17131. *
  17132. * def calcCubicPoints(a, b, c, d): # <<<<<<<<<<<<<<
  17133. * ax, ay = a
  17134. * bx, by = b
  17135. */
  17136. /* function exit code */
  17137. __pyx_L1_error:;
  17138. __Pyx_XDECREF(__pyx_t_1);
  17139. __Pyx_XDECREF(__pyx_t_2);
  17140. __Pyx_XDECREF(__pyx_t_3);
  17141. __Pyx_XDECREF(__pyx_t_5);
  17142. __Pyx_XDECREF(__pyx_t_6);
  17143. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcCubicPoints", __pyx_clineno, __pyx_lineno, __pyx_filename);
  17144. __pyx_r = NULL;
  17145. __pyx_L0:;
  17146. __Pyx_XDECREF(__pyx_v_ax);
  17147. __Pyx_XDECREF(__pyx_v_ay);
  17148. __Pyx_XDECREF(__pyx_v_bx);
  17149. __Pyx_XDECREF(__pyx_v_by);
  17150. __Pyx_XDECREF(__pyx_v_cx);
  17151. __Pyx_XDECREF(__pyx_v_cy);
  17152. __Pyx_XDECREF(__pyx_v_dx);
  17153. __Pyx_XDECREF(__pyx_v_dy);
  17154. __Pyx_XDECREF(__pyx_v_x1);
  17155. __Pyx_XDECREF(__pyx_v_y1);
  17156. __Pyx_XDECREF(__pyx_v_x2);
  17157. __Pyx_XDECREF(__pyx_v_y2);
  17158. __Pyx_XDECREF(__pyx_v_x3);
  17159. __Pyx_XDECREF(__pyx_v_y3);
  17160. __Pyx_XDECREF(__pyx_v_x4);
  17161. __Pyx_XDECREF(__pyx_v_y4);
  17162. __Pyx_XGIVEREF(__pyx_r);
  17163. __Pyx_RefNannyFinishContext();
  17164. return __pyx_r;
  17165. }
  17166. /* "fontTools/misc/bezierTools.py":1017
  17167. *
  17168. *
  17169. * @cython.cfunc # <<<<<<<<<<<<<<
  17170. * @cython.inline
  17171. * @cython.locals(
  17172. */
  17173. 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) {
  17174. __pyx_t_double_complex __pyx_v_p2;
  17175. __pyx_t_double_complex __pyx_v_p3;
  17176. __pyx_t_double_complex __pyx_v_p4;
  17177. PyObject *__pyx_r = NULL;
  17178. __Pyx_RefNannyDeclarations
  17179. PyObject *__pyx_t_1 = NULL;
  17180. PyObject *__pyx_t_2 = NULL;
  17181. PyObject *__pyx_t_3 = NULL;
  17182. PyObject *__pyx_t_4 = NULL;
  17183. PyObject *__pyx_t_5 = NULL;
  17184. int __pyx_lineno = 0;
  17185. const char *__pyx_filename = NULL;
  17186. int __pyx_clineno = 0;
  17187. __Pyx_RefNannySetupContext("calcCubicPointsC", 0);
  17188. /* "fontTools/misc/bezierTools.py":1029
  17189. * )
  17190. * def calcCubicPointsC(a, b, c, d):
  17191. * p2 = c * (1 / 3) + d # <<<<<<<<<<<<<<
  17192. * p3 = (b + c) * (1 / 3) + p2
  17193. * p4 = a + b + c + d
  17194. */
  17195. __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);
  17196. /* "fontTools/misc/bezierTools.py":1030
  17197. * def calcCubicPointsC(a, b, c, d):
  17198. * p2 = c * (1 / 3) + d
  17199. * p3 = (b + c) * (1 / 3) + p2 # <<<<<<<<<<<<<<
  17200. * p4 = a + b + c + d
  17201. * return (d, p2, p3, p4)
  17202. */
  17203. __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);
  17204. /* "fontTools/misc/bezierTools.py":1031
  17205. * p2 = c * (1 / 3) + d
  17206. * p3 = (b + c) * (1 / 3) + p2
  17207. * p4 = a + b + c + d # <<<<<<<<<<<<<<
  17208. * return (d, p2, p3, p4)
  17209. *
  17210. */
  17211. __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);
  17212. /* "fontTools/misc/bezierTools.py":1032
  17213. * p3 = (b + c) * (1 / 3) + p2
  17214. * p4 = a + b + c + d
  17215. * return (d, p2, p3, p4) # <<<<<<<<<<<<<<
  17216. *
  17217. *
  17218. */
  17219. __Pyx_XDECREF(__pyx_r);
  17220. __pyx_t_1 = __pyx_PyComplex_FromComplex(__pyx_v_d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1032, __pyx_L1_error)
  17221. __Pyx_GOTREF(__pyx_t_1);
  17222. __pyx_t_2 = __pyx_PyComplex_FromComplex(__pyx_v_p2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1032, __pyx_L1_error)
  17223. __Pyx_GOTREF(__pyx_t_2);
  17224. __pyx_t_3 = __pyx_PyComplex_FromComplex(__pyx_v_p3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1032, __pyx_L1_error)
  17225. __Pyx_GOTREF(__pyx_t_3);
  17226. __pyx_t_4 = __pyx_PyComplex_FromComplex(__pyx_v_p4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1032, __pyx_L1_error)
  17227. __Pyx_GOTREF(__pyx_t_4);
  17228. __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1032, __pyx_L1_error)
  17229. __Pyx_GOTREF(__pyx_t_5);
  17230. __Pyx_GIVEREF(__pyx_t_1);
  17231. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 1032, __pyx_L1_error);
  17232. __Pyx_GIVEREF(__pyx_t_2);
  17233. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 1032, __pyx_L1_error);
  17234. __Pyx_GIVEREF(__pyx_t_3);
  17235. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3) != (0)) __PYX_ERR(0, 1032, __pyx_L1_error);
  17236. __Pyx_GIVEREF(__pyx_t_4);
  17237. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4) != (0)) __PYX_ERR(0, 1032, __pyx_L1_error);
  17238. __pyx_t_1 = 0;
  17239. __pyx_t_2 = 0;
  17240. __pyx_t_3 = 0;
  17241. __pyx_t_4 = 0;
  17242. __pyx_r = __pyx_t_5;
  17243. __pyx_t_5 = 0;
  17244. goto __pyx_L0;
  17245. /* "fontTools/misc/bezierTools.py":1017
  17246. *
  17247. *
  17248. * @cython.cfunc # <<<<<<<<<<<<<<
  17249. * @cython.inline
  17250. * @cython.locals(
  17251. */
  17252. /* function exit code */
  17253. __pyx_L1_error:;
  17254. __Pyx_XDECREF(__pyx_t_1);
  17255. __Pyx_XDECREF(__pyx_t_2);
  17256. __Pyx_XDECREF(__pyx_t_3);
  17257. __Pyx_XDECREF(__pyx_t_4);
  17258. __Pyx_XDECREF(__pyx_t_5);
  17259. __Pyx_AddTraceback("fontTools.misc.bezierTools.calcCubicPointsC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  17260. __pyx_r = 0;
  17261. __pyx_L0:;
  17262. __Pyx_XGIVEREF(__pyx_r);
  17263. __Pyx_RefNannyFinishContext();
  17264. return __pyx_r;
  17265. }
  17266. /* "fontTools/misc/bezierTools.py":1040
  17267. *
  17268. *
  17269. * def linePointAtT(pt1, pt2, t): # <<<<<<<<<<<<<<
  17270. * """Finds the point at time `t` on a line.
  17271. *
  17272. */
  17273. /* Python wrapper */
  17274. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_59linePointAtT(PyObject *__pyx_self,
  17275. #if CYTHON_METH_FASTCALL
  17276. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  17277. #else
  17278. PyObject *__pyx_args, PyObject *__pyx_kwds
  17279. #endif
  17280. ); /*proto*/
  17281. 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.");
  17282. 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};
  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. ) {
  17290. PyObject *__pyx_v_pt1 = 0;
  17291. PyObject *__pyx_v_pt2 = 0;
  17292. PyObject *__pyx_v_t = 0;
  17293. #if !CYTHON_METH_FASTCALL
  17294. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  17295. #endif
  17296. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  17297. PyObject* values[3] = {0,0,0};
  17298. int __pyx_lineno = 0;
  17299. const char *__pyx_filename = NULL;
  17300. int __pyx_clineno = 0;
  17301. PyObject *__pyx_r = 0;
  17302. __Pyx_RefNannyDeclarations
  17303. __Pyx_RefNannySetupContext("linePointAtT (wrapper)", 0);
  17304. #if !CYTHON_METH_FASTCALL
  17305. #if CYTHON_ASSUME_SAFE_SIZE
  17306. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  17307. #else
  17308. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  17309. #endif
  17310. #endif
  17311. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  17312. {
  17313. 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};
  17314. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  17315. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1040, __pyx_L3_error)
  17316. if (__pyx_kwds_len > 0) {
  17317. switch (__pyx_nargs) {
  17318. case 3:
  17319. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  17320. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1040, __pyx_L3_error)
  17321. CYTHON_FALLTHROUGH;
  17322. case 2:
  17323. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  17324. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1040, __pyx_L3_error)
  17325. CYTHON_FALLTHROUGH;
  17326. case 1:
  17327. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  17328. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1040, __pyx_L3_error)
  17329. CYTHON_FALLTHROUGH;
  17330. case 0: break;
  17331. default: goto __pyx_L5_argtuple_error;
  17332. }
  17333. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  17334. 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)
  17335. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  17336. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("linePointAtT", 1, 3, 3, i); __PYX_ERR(0, 1040, __pyx_L3_error) }
  17337. }
  17338. } else if (unlikely(__pyx_nargs != 3)) {
  17339. goto __pyx_L5_argtuple_error;
  17340. } else {
  17341. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  17342. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1040, __pyx_L3_error)
  17343. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  17344. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1040, __pyx_L3_error)
  17345. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  17346. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1040, __pyx_L3_error)
  17347. }
  17348. __pyx_v_pt1 = values[0];
  17349. __pyx_v_pt2 = values[1];
  17350. __pyx_v_t = values[2];
  17351. }
  17352. goto __pyx_L6_skip;
  17353. __pyx_L5_argtuple_error:;
  17354. __Pyx_RaiseArgtupleInvalid("linePointAtT", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1040, __pyx_L3_error)
  17355. __pyx_L6_skip:;
  17356. goto __pyx_L4_argument_unpacking_done;
  17357. __pyx_L3_error:;
  17358. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  17359. Py_XDECREF(values[__pyx_temp]);
  17360. }
  17361. __Pyx_AddTraceback("fontTools.misc.bezierTools.linePointAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  17362. __Pyx_RefNannyFinishContext();
  17363. return NULL;
  17364. __pyx_L4_argument_unpacking_done:;
  17365. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_58linePointAtT(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_t);
  17366. /* function exit code */
  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_RefNannyFinishContext();
  17371. return __pyx_r;
  17372. }
  17373. 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) {
  17374. PyObject *__pyx_r = NULL;
  17375. __Pyx_RefNannyDeclarations
  17376. PyObject *__pyx_t_1 = NULL;
  17377. PyObject *__pyx_t_2 = NULL;
  17378. PyObject *__pyx_t_3 = NULL;
  17379. PyObject *__pyx_t_4 = NULL;
  17380. int __pyx_lineno = 0;
  17381. const char *__pyx_filename = NULL;
  17382. int __pyx_clineno = 0;
  17383. __Pyx_RefNannySetupContext("linePointAtT", 0);
  17384. /* "fontTools/misc/bezierTools.py":1050
  17385. * A 2D tuple with the coordinates of the point.
  17386. * """
  17387. * return ((pt1[0] * (1 - t) + pt2[0] * t), (pt1[1] * (1 - t) + pt2[1] * t)) # <<<<<<<<<<<<<<
  17388. *
  17389. *
  17390. */
  17391. __Pyx_XDECREF(__pyx_r);
  17392. __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)
  17393. __Pyx_GOTREF(__pyx_t_1);
  17394. __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)
  17395. __Pyx_GOTREF(__pyx_t_2);
  17396. __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1050, __pyx_L1_error)
  17397. __Pyx_GOTREF(__pyx_t_3);
  17398. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17399. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17400. __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)
  17401. __Pyx_GOTREF(__pyx_t_2);
  17402. __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_v_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1050, __pyx_L1_error)
  17403. __Pyx_GOTREF(__pyx_t_1);
  17404. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17405. __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1050, __pyx_L1_error)
  17406. __Pyx_GOTREF(__pyx_t_2);
  17407. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17408. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17409. __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)
  17410. __Pyx_GOTREF(__pyx_t_1);
  17411. __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)
  17412. __Pyx_GOTREF(__pyx_t_3);
  17413. __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1050, __pyx_L1_error)
  17414. __Pyx_GOTREF(__pyx_t_4);
  17415. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17416. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17417. __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)
  17418. __Pyx_GOTREF(__pyx_t_3);
  17419. __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_v_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1050, __pyx_L1_error)
  17420. __Pyx_GOTREF(__pyx_t_1);
  17421. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17422. __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1050, __pyx_L1_error)
  17423. __Pyx_GOTREF(__pyx_t_3);
  17424. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  17425. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17426. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1050, __pyx_L1_error)
  17427. __Pyx_GOTREF(__pyx_t_1);
  17428. __Pyx_GIVEREF(__pyx_t_2);
  17429. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 1050, __pyx_L1_error);
  17430. __Pyx_GIVEREF(__pyx_t_3);
  17431. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 1050, __pyx_L1_error);
  17432. __pyx_t_2 = 0;
  17433. __pyx_t_3 = 0;
  17434. __pyx_r = __pyx_t_1;
  17435. __pyx_t_1 = 0;
  17436. goto __pyx_L0;
  17437. /* "fontTools/misc/bezierTools.py":1040
  17438. *
  17439. *
  17440. * def linePointAtT(pt1, pt2, t): # <<<<<<<<<<<<<<
  17441. * """Finds the point at time `t` on a line.
  17442. *
  17443. */
  17444. /* function exit code */
  17445. __pyx_L1_error:;
  17446. __Pyx_XDECREF(__pyx_t_1);
  17447. __Pyx_XDECREF(__pyx_t_2);
  17448. __Pyx_XDECREF(__pyx_t_3);
  17449. __Pyx_XDECREF(__pyx_t_4);
  17450. __Pyx_AddTraceback("fontTools.misc.bezierTools.linePointAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  17451. __pyx_r = NULL;
  17452. __pyx_L0:;
  17453. __Pyx_XGIVEREF(__pyx_r);
  17454. __Pyx_RefNannyFinishContext();
  17455. return __pyx_r;
  17456. }
  17457. /* "fontTools/misc/bezierTools.py":1053
  17458. *
  17459. *
  17460. * def quadraticPointAtT(pt1, pt2, pt3, t): # <<<<<<<<<<<<<<
  17461. * """Finds the point at time `t` on a quadratic curve.
  17462. *
  17463. */
  17464. /* Python wrapper */
  17465. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_61quadraticPointAtT(PyObject *__pyx_self,
  17466. #if CYTHON_METH_FASTCALL
  17467. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  17468. #else
  17469. PyObject *__pyx_args, PyObject *__pyx_kwds
  17470. #endif
  17471. ); /*proto*/
  17472. 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.");
  17473. 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};
  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. ) {
  17481. PyObject *__pyx_v_pt1 = 0;
  17482. PyObject *__pyx_v_pt2 = 0;
  17483. PyObject *__pyx_v_pt3 = 0;
  17484. PyObject *__pyx_v_t = 0;
  17485. #if !CYTHON_METH_FASTCALL
  17486. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  17487. #endif
  17488. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  17489. PyObject* values[4] = {0,0,0,0};
  17490. int __pyx_lineno = 0;
  17491. const char *__pyx_filename = NULL;
  17492. int __pyx_clineno = 0;
  17493. PyObject *__pyx_r = 0;
  17494. __Pyx_RefNannyDeclarations
  17495. __Pyx_RefNannySetupContext("quadraticPointAtT (wrapper)", 0);
  17496. #if !CYTHON_METH_FASTCALL
  17497. #if CYTHON_ASSUME_SAFE_SIZE
  17498. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  17499. #else
  17500. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  17501. #endif
  17502. #endif
  17503. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  17504. {
  17505. 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};
  17506. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  17507. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1053, __pyx_L3_error)
  17508. if (__pyx_kwds_len > 0) {
  17509. switch (__pyx_nargs) {
  17510. case 4:
  17511. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  17512. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1053, __pyx_L3_error)
  17513. CYTHON_FALLTHROUGH;
  17514. case 3:
  17515. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  17516. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1053, __pyx_L3_error)
  17517. CYTHON_FALLTHROUGH;
  17518. case 2:
  17519. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  17520. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1053, __pyx_L3_error)
  17521. CYTHON_FALLTHROUGH;
  17522. case 1:
  17523. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  17524. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1053, __pyx_L3_error)
  17525. CYTHON_FALLTHROUGH;
  17526. case 0: break;
  17527. default: goto __pyx_L5_argtuple_error;
  17528. }
  17529. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  17530. 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)
  17531. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  17532. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("quadraticPointAtT", 1, 4, 4, i); __PYX_ERR(0, 1053, __pyx_L3_error) }
  17533. }
  17534. } else if (unlikely(__pyx_nargs != 4)) {
  17535. goto __pyx_L5_argtuple_error;
  17536. } else {
  17537. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  17538. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1053, __pyx_L3_error)
  17539. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  17540. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1053, __pyx_L3_error)
  17541. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  17542. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1053, __pyx_L3_error)
  17543. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  17544. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1053, __pyx_L3_error)
  17545. }
  17546. __pyx_v_pt1 = values[0];
  17547. __pyx_v_pt2 = values[1];
  17548. __pyx_v_pt3 = values[2];
  17549. __pyx_v_t = values[3];
  17550. }
  17551. goto __pyx_L6_skip;
  17552. __pyx_L5_argtuple_error:;
  17553. __Pyx_RaiseArgtupleInvalid("quadraticPointAtT", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 1053, __pyx_L3_error)
  17554. __pyx_L6_skip:;
  17555. goto __pyx_L4_argument_unpacking_done;
  17556. __pyx_L3_error:;
  17557. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  17558. Py_XDECREF(values[__pyx_temp]);
  17559. }
  17560. __Pyx_AddTraceback("fontTools.misc.bezierTools.quadraticPointAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  17561. __Pyx_RefNannyFinishContext();
  17562. return NULL;
  17563. __pyx_L4_argument_unpacking_done:;
  17564. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_60quadraticPointAtT(__pyx_self, __pyx_v_pt1, __pyx_v_pt2, __pyx_v_pt3, __pyx_v_t);
  17565. /* function exit code */
  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_RefNannyFinishContext();
  17570. return __pyx_r;
  17571. }
  17572. 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) {
  17573. PyObject *__pyx_v_x = NULL;
  17574. PyObject *__pyx_v_y = NULL;
  17575. PyObject *__pyx_r = NULL;
  17576. __Pyx_RefNannyDeclarations
  17577. PyObject *__pyx_t_1 = NULL;
  17578. PyObject *__pyx_t_2 = NULL;
  17579. PyObject *__pyx_t_3 = NULL;
  17580. PyObject *__pyx_t_4 = NULL;
  17581. int __pyx_lineno = 0;
  17582. const char *__pyx_filename = NULL;
  17583. int __pyx_clineno = 0;
  17584. __Pyx_RefNannySetupContext("quadraticPointAtT", 0);
  17585. /* "fontTools/misc/bezierTools.py":1063
  17586. * A 2D tuple with the coordinates of the point.
  17587. * """
  17588. * x = (1 - t) * (1 - t) * pt1[0] + 2 * (1 - t) * t * pt2[0] + t * t * pt3[0] # <<<<<<<<<<<<<<
  17589. * y = (1 - t) * (1 - t) * pt1[1] + 2 * (1 - t) * t * pt2[1] + t * t * pt3[1]
  17590. * return (x, y)
  17591. */
  17592. __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)
  17593. __Pyx_GOTREF(__pyx_t_1);
  17594. __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)
  17595. __Pyx_GOTREF(__pyx_t_2);
  17596. __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1063, __pyx_L1_error)
  17597. __Pyx_GOTREF(__pyx_t_3);
  17598. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17599. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17600. __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)
  17601. __Pyx_GOTREF(__pyx_t_2);
  17602. __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1063, __pyx_L1_error)
  17603. __Pyx_GOTREF(__pyx_t_1);
  17604. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17605. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17606. __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)
  17607. __Pyx_GOTREF(__pyx_t_2);
  17608. __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)
  17609. __Pyx_GOTREF(__pyx_t_3);
  17610. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17611. __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_v_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1063, __pyx_L1_error)
  17612. __Pyx_GOTREF(__pyx_t_2);
  17613. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17614. __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)
  17615. __Pyx_GOTREF(__pyx_t_3);
  17616. __pyx_t_4 = PyNumber_Multiply(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1063, __pyx_L1_error)
  17617. __Pyx_GOTREF(__pyx_t_4);
  17618. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17619. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17620. __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1063, __pyx_L1_error)
  17621. __Pyx_GOTREF(__pyx_t_3);
  17622. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17623. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  17624. __pyx_t_4 = PyNumber_Multiply(__pyx_v_t, __pyx_v_t); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1063, __pyx_L1_error)
  17625. __Pyx_GOTREF(__pyx_t_4);
  17626. __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)
  17627. __Pyx_GOTREF(__pyx_t_1);
  17628. __pyx_t_2 = PyNumber_Multiply(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1063, __pyx_L1_error)
  17629. __Pyx_GOTREF(__pyx_t_2);
  17630. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  17631. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17632. __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1063, __pyx_L1_error)
  17633. __Pyx_GOTREF(__pyx_t_1);
  17634. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17635. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17636. __pyx_v_x = __pyx_t_1;
  17637. __pyx_t_1 = 0;
  17638. /* "fontTools/misc/bezierTools.py":1064
  17639. * """
  17640. * x = (1 - t) * (1 - t) * pt1[0] + 2 * (1 - t) * t * pt2[0] + t * t * pt3[0]
  17641. * y = (1 - t) * (1 - t) * pt1[1] + 2 * (1 - t) * t * pt2[1] + t * t * pt3[1] # <<<<<<<<<<<<<<
  17642. * return (x, y)
  17643. *
  17644. */
  17645. __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)
  17646. __Pyx_GOTREF(__pyx_t_1);
  17647. __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)
  17648. __Pyx_GOTREF(__pyx_t_2);
  17649. __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1064, __pyx_L1_error)
  17650. __Pyx_GOTREF(__pyx_t_3);
  17651. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17652. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17653. __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)
  17654. __Pyx_GOTREF(__pyx_t_2);
  17655. __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1064, __pyx_L1_error)
  17656. __Pyx_GOTREF(__pyx_t_1);
  17657. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17658. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17659. __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)
  17660. __Pyx_GOTREF(__pyx_t_2);
  17661. __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)
  17662. __Pyx_GOTREF(__pyx_t_3);
  17663. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17664. __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_v_t); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1064, __pyx_L1_error)
  17665. __Pyx_GOTREF(__pyx_t_2);
  17666. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17667. __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)
  17668. __Pyx_GOTREF(__pyx_t_3);
  17669. __pyx_t_4 = PyNumber_Multiply(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1064, __pyx_L1_error)
  17670. __Pyx_GOTREF(__pyx_t_4);
  17671. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17672. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17673. __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1064, __pyx_L1_error)
  17674. __Pyx_GOTREF(__pyx_t_3);
  17675. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17676. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  17677. __pyx_t_4 = PyNumber_Multiply(__pyx_v_t, __pyx_v_t); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1064, __pyx_L1_error)
  17678. __Pyx_GOTREF(__pyx_t_4);
  17679. __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)
  17680. __Pyx_GOTREF(__pyx_t_1);
  17681. __pyx_t_2 = PyNumber_Multiply(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1064, __pyx_L1_error)
  17682. __Pyx_GOTREF(__pyx_t_2);
  17683. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  17684. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17685. __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1064, __pyx_L1_error)
  17686. __Pyx_GOTREF(__pyx_t_1);
  17687. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17688. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17689. __pyx_v_y = __pyx_t_1;
  17690. __pyx_t_1 = 0;
  17691. /* "fontTools/misc/bezierTools.py":1065
  17692. * x = (1 - t) * (1 - t) * pt1[0] + 2 * (1 - t) * t * pt2[0] + t * t * pt3[0]
  17693. * y = (1 - t) * (1 - t) * pt1[1] + 2 * (1 - t) * t * pt2[1] + t * t * pt3[1]
  17694. * return (x, y) # <<<<<<<<<<<<<<
  17695. *
  17696. *
  17697. */
  17698. __Pyx_XDECREF(__pyx_r);
  17699. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1065, __pyx_L1_error)
  17700. __Pyx_GOTREF(__pyx_t_1);
  17701. __Pyx_INCREF(__pyx_v_x);
  17702. __Pyx_GIVEREF(__pyx_v_x);
  17703. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x) != (0)) __PYX_ERR(0, 1065, __pyx_L1_error);
  17704. __Pyx_INCREF(__pyx_v_y);
  17705. __Pyx_GIVEREF(__pyx_v_y);
  17706. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_y) != (0)) __PYX_ERR(0, 1065, __pyx_L1_error);
  17707. __pyx_r = __pyx_t_1;
  17708. __pyx_t_1 = 0;
  17709. goto __pyx_L0;
  17710. /* "fontTools/misc/bezierTools.py":1053
  17711. *
  17712. *
  17713. * def quadraticPointAtT(pt1, pt2, pt3, t): # <<<<<<<<<<<<<<
  17714. * """Finds the point at time `t` on a quadratic curve.
  17715. *
  17716. */
  17717. /* function exit code */
  17718. __pyx_L1_error:;
  17719. __Pyx_XDECREF(__pyx_t_1);
  17720. __Pyx_XDECREF(__pyx_t_2);
  17721. __Pyx_XDECREF(__pyx_t_3);
  17722. __Pyx_XDECREF(__pyx_t_4);
  17723. __Pyx_AddTraceback("fontTools.misc.bezierTools.quadraticPointAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  17724. __pyx_r = NULL;
  17725. __pyx_L0:;
  17726. __Pyx_XDECREF(__pyx_v_x);
  17727. __Pyx_XDECREF(__pyx_v_y);
  17728. __Pyx_XGIVEREF(__pyx_r);
  17729. __Pyx_RefNannyFinishContext();
  17730. return __pyx_r;
  17731. }
  17732. /* "fontTools/misc/bezierTools.py":1068
  17733. *
  17734. *
  17735. * def cubicPointAtT(pt1, pt2, pt3, pt4, t): # <<<<<<<<<<<<<<
  17736. * """Finds the point at time `t` on a cubic curve.
  17737. *
  17738. */
  17739. /* Python wrapper */
  17740. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_63cubicPointAtT(PyObject *__pyx_self,
  17741. #if CYTHON_METH_FASTCALL
  17742. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  17743. #else
  17744. PyObject *__pyx_args, PyObject *__pyx_kwds
  17745. #endif
  17746. ); /*proto*/
  17747. 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.");
  17748. 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};
  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. ) {
  17756. PyObject *__pyx_v_pt1 = 0;
  17757. PyObject *__pyx_v_pt2 = 0;
  17758. PyObject *__pyx_v_pt3 = 0;
  17759. PyObject *__pyx_v_pt4 = 0;
  17760. PyObject *__pyx_v_t = 0;
  17761. #if !CYTHON_METH_FASTCALL
  17762. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  17763. #endif
  17764. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  17765. PyObject* values[5] = {0,0,0,0,0};
  17766. int __pyx_lineno = 0;
  17767. const char *__pyx_filename = NULL;
  17768. int __pyx_clineno = 0;
  17769. PyObject *__pyx_r = 0;
  17770. __Pyx_RefNannyDeclarations
  17771. __Pyx_RefNannySetupContext("cubicPointAtT (wrapper)", 0);
  17772. #if !CYTHON_METH_FASTCALL
  17773. #if CYTHON_ASSUME_SAFE_SIZE
  17774. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  17775. #else
  17776. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  17777. #endif
  17778. #endif
  17779. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  17780. {
  17781. 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};
  17782. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  17783. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1068, __pyx_L3_error)
  17784. if (__pyx_kwds_len > 0) {
  17785. switch (__pyx_nargs) {
  17786. case 5:
  17787. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  17788. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1068, __pyx_L3_error)
  17789. CYTHON_FALLTHROUGH;
  17790. case 4:
  17791. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  17792. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1068, __pyx_L3_error)
  17793. CYTHON_FALLTHROUGH;
  17794. case 3:
  17795. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  17796. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1068, __pyx_L3_error)
  17797. CYTHON_FALLTHROUGH;
  17798. case 2:
  17799. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  17800. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1068, __pyx_L3_error)
  17801. CYTHON_FALLTHROUGH;
  17802. case 1:
  17803. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  17804. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1068, __pyx_L3_error)
  17805. CYTHON_FALLTHROUGH;
  17806. case 0: break;
  17807. default: goto __pyx_L5_argtuple_error;
  17808. }
  17809. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  17810. 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)
  17811. for (Py_ssize_t i = __pyx_nargs; i < 5; i++) {
  17812. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("cubicPointAtT", 1, 5, 5, i); __PYX_ERR(0, 1068, __pyx_L3_error) }
  17813. }
  17814. } else if (unlikely(__pyx_nargs != 5)) {
  17815. goto __pyx_L5_argtuple_error;
  17816. } else {
  17817. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  17818. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1068, __pyx_L3_error)
  17819. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  17820. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1068, __pyx_L3_error)
  17821. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  17822. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1068, __pyx_L3_error)
  17823. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  17824. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1068, __pyx_L3_error)
  17825. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  17826. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1068, __pyx_L3_error)
  17827. }
  17828. __pyx_v_pt1 = values[0];
  17829. __pyx_v_pt2 = values[1];
  17830. __pyx_v_pt3 = values[2];
  17831. __pyx_v_pt4 = values[3];
  17832. __pyx_v_t = values[4];
  17833. }
  17834. goto __pyx_L6_skip;
  17835. __pyx_L5_argtuple_error:;
  17836. __Pyx_RaiseArgtupleInvalid("cubicPointAtT", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 1068, __pyx_L3_error)
  17837. __pyx_L6_skip:;
  17838. goto __pyx_L4_argument_unpacking_done;
  17839. __pyx_L3_error:;
  17840. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  17841. Py_XDECREF(values[__pyx_temp]);
  17842. }
  17843. __Pyx_AddTraceback("fontTools.misc.bezierTools.cubicPointAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  17844. __Pyx_RefNannyFinishContext();
  17845. return NULL;
  17846. __pyx_L4_argument_unpacking_done:;
  17847. __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);
  17848. /* function exit code */
  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_RefNannyFinishContext();
  17853. return __pyx_r;
  17854. }
  17855. 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) {
  17856. PyObject *__pyx_v_t2 = NULL;
  17857. PyObject *__pyx_v__1_t = NULL;
  17858. PyObject *__pyx_v__1_t_2 = NULL;
  17859. PyObject *__pyx_v_x = NULL;
  17860. PyObject *__pyx_v_y = NULL;
  17861. PyObject *__pyx_r = NULL;
  17862. __Pyx_RefNannyDeclarations
  17863. PyObject *__pyx_t_1 = NULL;
  17864. PyObject *__pyx_t_2 = NULL;
  17865. PyObject *__pyx_t_3 = NULL;
  17866. PyObject *__pyx_t_4 = NULL;
  17867. PyObject *__pyx_t_5 = NULL;
  17868. int __pyx_lineno = 0;
  17869. const char *__pyx_filename = NULL;
  17870. int __pyx_clineno = 0;
  17871. __Pyx_RefNannySetupContext("cubicPointAtT", 0);
  17872. /* "fontTools/misc/bezierTools.py":1078
  17873. * A 2D tuple with the coordinates of the point.
  17874. * """
  17875. * t2 = t * t # <<<<<<<<<<<<<<
  17876. * _1_t = 1 - t
  17877. * _1_t_2 = _1_t * _1_t
  17878. */
  17879. __pyx_t_1 = PyNumber_Multiply(__pyx_v_t, __pyx_v_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1078, __pyx_L1_error)
  17880. __Pyx_GOTREF(__pyx_t_1);
  17881. __pyx_v_t2 = __pyx_t_1;
  17882. __pyx_t_1 = 0;
  17883. /* "fontTools/misc/bezierTools.py":1079
  17884. * """
  17885. * t2 = t * t
  17886. * _1_t = 1 - t # <<<<<<<<<<<<<<
  17887. * _1_t_2 = _1_t * _1_t
  17888. * x = (
  17889. */
  17890. __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)
  17891. __Pyx_GOTREF(__pyx_t_1);
  17892. __pyx_v__1_t = __pyx_t_1;
  17893. __pyx_t_1 = 0;
  17894. /* "fontTools/misc/bezierTools.py":1080
  17895. * t2 = t * t
  17896. * _1_t = 1 - t
  17897. * _1_t_2 = _1_t * _1_t # <<<<<<<<<<<<<<
  17898. * x = (
  17899. * _1_t_2 * _1_t * pt1[0]
  17900. */
  17901. __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)
  17902. __Pyx_GOTREF(__pyx_t_1);
  17903. __pyx_v__1_t_2 = __pyx_t_1;
  17904. __pyx_t_1 = 0;
  17905. /* "fontTools/misc/bezierTools.py":1082
  17906. * _1_t_2 = _1_t * _1_t
  17907. * x = (
  17908. * _1_t_2 * _1_t * pt1[0] # <<<<<<<<<<<<<<
  17909. * + 3 * (_1_t_2 * t * pt2[0] + _1_t * t2 * pt3[0])
  17910. * + t2 * t * pt4[0]
  17911. */
  17912. __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)
  17913. __Pyx_GOTREF(__pyx_t_1);
  17914. __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)
  17915. __Pyx_GOTREF(__pyx_t_2);
  17916. __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1082, __pyx_L1_error)
  17917. __Pyx_GOTREF(__pyx_t_3);
  17918. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17919. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17920. /* "fontTools/misc/bezierTools.py":1083
  17921. * x = (
  17922. * _1_t_2 * _1_t * pt1[0]
  17923. * + 3 * (_1_t_2 * t * pt2[0] + _1_t * t2 * pt3[0]) # <<<<<<<<<<<<<<
  17924. * + t2 * t * pt4[0]
  17925. * )
  17926. */
  17927. __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)
  17928. __Pyx_GOTREF(__pyx_t_2);
  17929. __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)
  17930. __Pyx_GOTREF(__pyx_t_1);
  17931. __pyx_t_4 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1083, __pyx_L1_error)
  17932. __Pyx_GOTREF(__pyx_t_4);
  17933. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17934. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17935. __pyx_t_1 = PyNumber_Multiply(__pyx_v__1_t, __pyx_v_t2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1083, __pyx_L1_error)
  17936. __Pyx_GOTREF(__pyx_t_1);
  17937. __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)
  17938. __Pyx_GOTREF(__pyx_t_2);
  17939. __pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1083, __pyx_L1_error)
  17940. __Pyx_GOTREF(__pyx_t_5);
  17941. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17942. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17943. __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1083, __pyx_L1_error)
  17944. __Pyx_GOTREF(__pyx_t_2);
  17945. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  17946. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  17947. __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)
  17948. __Pyx_GOTREF(__pyx_t_5);
  17949. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17950. __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1083, __pyx_L1_error)
  17951. __Pyx_GOTREF(__pyx_t_2);
  17952. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17953. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  17954. /* "fontTools/misc/bezierTools.py":1084
  17955. * _1_t_2 * _1_t * pt1[0]
  17956. * + 3 * (_1_t_2 * t * pt2[0] + _1_t * t2 * pt3[0])
  17957. * + t2 * t * pt4[0] # <<<<<<<<<<<<<<
  17958. * )
  17959. * y = (
  17960. */
  17961. __pyx_t_5 = PyNumber_Multiply(__pyx_v_t2, __pyx_v_t); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1084, __pyx_L1_error)
  17962. __Pyx_GOTREF(__pyx_t_5);
  17963. __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)
  17964. __Pyx_GOTREF(__pyx_t_3);
  17965. __pyx_t_4 = PyNumber_Multiply(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1084, __pyx_L1_error)
  17966. __Pyx_GOTREF(__pyx_t_4);
  17967. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  17968. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17969. __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1084, __pyx_L1_error)
  17970. __Pyx_GOTREF(__pyx_t_3);
  17971. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17972. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  17973. __pyx_v_x = __pyx_t_3;
  17974. __pyx_t_3 = 0;
  17975. /* "fontTools/misc/bezierTools.py":1087
  17976. * )
  17977. * y = (
  17978. * _1_t_2 * _1_t * pt1[1] # <<<<<<<<<<<<<<
  17979. * + 3 * (_1_t_2 * t * pt2[1] + _1_t * t2 * pt3[1])
  17980. * + t2 * t * pt4[1]
  17981. */
  17982. __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)
  17983. __Pyx_GOTREF(__pyx_t_3);
  17984. __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)
  17985. __Pyx_GOTREF(__pyx_t_4);
  17986. __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1087, __pyx_L1_error)
  17987. __Pyx_GOTREF(__pyx_t_2);
  17988. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17989. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  17990. /* "fontTools/misc/bezierTools.py":1088
  17991. * y = (
  17992. * _1_t_2 * _1_t * pt1[1]
  17993. * + 3 * (_1_t_2 * t * pt2[1] + _1_t * t2 * pt3[1]) # <<<<<<<<<<<<<<
  17994. * + t2 * t * pt4[1]
  17995. * )
  17996. */
  17997. __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)
  17998. __Pyx_GOTREF(__pyx_t_4);
  17999. __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)
  18000. __Pyx_GOTREF(__pyx_t_3);
  18001. __pyx_t_5 = PyNumber_Multiply(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1088, __pyx_L1_error)
  18002. __Pyx_GOTREF(__pyx_t_5);
  18003. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  18004. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18005. __pyx_t_3 = PyNumber_Multiply(__pyx_v__1_t, __pyx_v_t2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1088, __pyx_L1_error)
  18006. __Pyx_GOTREF(__pyx_t_3);
  18007. __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)
  18008. __Pyx_GOTREF(__pyx_t_4);
  18009. __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1088, __pyx_L1_error)
  18010. __Pyx_GOTREF(__pyx_t_1);
  18011. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18012. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  18013. __pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1088, __pyx_L1_error)
  18014. __Pyx_GOTREF(__pyx_t_4);
  18015. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  18016. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18017. __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)
  18018. __Pyx_GOTREF(__pyx_t_1);
  18019. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  18020. __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1088, __pyx_L1_error)
  18021. __Pyx_GOTREF(__pyx_t_4);
  18022. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18023. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18024. /* "fontTools/misc/bezierTools.py":1089
  18025. * _1_t_2 * _1_t * pt1[1]
  18026. * + 3 * (_1_t_2 * t * pt2[1] + _1_t * t2 * pt3[1])
  18027. * + t2 * t * pt4[1] # <<<<<<<<<<<<<<
  18028. * )
  18029. * return (x, y)
  18030. */
  18031. __pyx_t_1 = PyNumber_Multiply(__pyx_v_t2, __pyx_v_t); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1089, __pyx_L1_error)
  18032. __Pyx_GOTREF(__pyx_t_1);
  18033. __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)
  18034. __Pyx_GOTREF(__pyx_t_2);
  18035. __pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1089, __pyx_L1_error)
  18036. __Pyx_GOTREF(__pyx_t_5);
  18037. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18038. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18039. __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1089, __pyx_L1_error)
  18040. __Pyx_GOTREF(__pyx_t_2);
  18041. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  18042. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  18043. __pyx_v_y = __pyx_t_2;
  18044. __pyx_t_2 = 0;
  18045. /* "fontTools/misc/bezierTools.py":1091
  18046. * + t2 * t * pt4[1]
  18047. * )
  18048. * return (x, y) # <<<<<<<<<<<<<<
  18049. *
  18050. *
  18051. */
  18052. __Pyx_XDECREF(__pyx_r);
  18053. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1091, __pyx_L1_error)
  18054. __Pyx_GOTREF(__pyx_t_2);
  18055. __Pyx_INCREF(__pyx_v_x);
  18056. __Pyx_GIVEREF(__pyx_v_x);
  18057. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_x) != (0)) __PYX_ERR(0, 1091, __pyx_L1_error);
  18058. __Pyx_INCREF(__pyx_v_y);
  18059. __Pyx_GIVEREF(__pyx_v_y);
  18060. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_y) != (0)) __PYX_ERR(0, 1091, __pyx_L1_error);
  18061. __pyx_r = __pyx_t_2;
  18062. __pyx_t_2 = 0;
  18063. goto __pyx_L0;
  18064. /* "fontTools/misc/bezierTools.py":1068
  18065. *
  18066. *
  18067. * def cubicPointAtT(pt1, pt2, pt3, pt4, t): # <<<<<<<<<<<<<<
  18068. * """Finds the point at time `t` on a cubic curve.
  18069. *
  18070. */
  18071. /* function exit code */
  18072. __pyx_L1_error:;
  18073. __Pyx_XDECREF(__pyx_t_1);
  18074. __Pyx_XDECREF(__pyx_t_2);
  18075. __Pyx_XDECREF(__pyx_t_3);
  18076. __Pyx_XDECREF(__pyx_t_4);
  18077. __Pyx_XDECREF(__pyx_t_5);
  18078. __Pyx_AddTraceback("fontTools.misc.bezierTools.cubicPointAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  18079. __pyx_r = NULL;
  18080. __pyx_L0:;
  18081. __Pyx_XDECREF(__pyx_v_t2);
  18082. __Pyx_XDECREF(__pyx_v__1_t);
  18083. __Pyx_XDECREF(__pyx_v__1_t_2);
  18084. __Pyx_XDECREF(__pyx_v_x);
  18085. __Pyx_XDECREF(__pyx_v_y);
  18086. __Pyx_XGIVEREF(__pyx_r);
  18087. __Pyx_RefNannyFinishContext();
  18088. return __pyx_r;
  18089. }
  18090. /* "fontTools/misc/bezierTools.py":1094
  18091. *
  18092. *
  18093. * @cython.returns(cython.complex) # <<<<<<<<<<<<<<
  18094. * @cython.locals(
  18095. * t=cython.double,
  18096. */
  18097. /* Python wrapper */
  18098. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_65cubicPointAtTC(PyObject *__pyx_self,
  18099. #if CYTHON_METH_FASTCALL
  18100. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  18101. #else
  18102. PyObject *__pyx_args, PyObject *__pyx_kwds
  18103. #endif
  18104. ); /*proto*/
  18105. 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.");
  18106. 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};
  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. ) {
  18114. __pyx_t_double_complex __pyx_v_pt1;
  18115. __pyx_t_double_complex __pyx_v_pt2;
  18116. __pyx_t_double_complex __pyx_v_pt3;
  18117. __pyx_t_double_complex __pyx_v_pt4;
  18118. double __pyx_v_t;
  18119. #if !CYTHON_METH_FASTCALL
  18120. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  18121. #endif
  18122. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  18123. PyObject* values[5] = {0,0,0,0,0};
  18124. int __pyx_lineno = 0;
  18125. const char *__pyx_filename = NULL;
  18126. int __pyx_clineno = 0;
  18127. PyObject *__pyx_r = 0;
  18128. __Pyx_RefNannyDeclarations
  18129. __Pyx_RefNannySetupContext("cubicPointAtTC (wrapper)", 0);
  18130. #if !CYTHON_METH_FASTCALL
  18131. #if CYTHON_ASSUME_SAFE_SIZE
  18132. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  18133. #else
  18134. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  18135. #endif
  18136. #endif
  18137. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  18138. {
  18139. 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};
  18140. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  18141. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1094, __pyx_L3_error)
  18142. if (__pyx_kwds_len > 0) {
  18143. switch (__pyx_nargs) {
  18144. case 5:
  18145. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  18146. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1094, __pyx_L3_error)
  18147. CYTHON_FALLTHROUGH;
  18148. case 4:
  18149. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  18150. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1094, __pyx_L3_error)
  18151. CYTHON_FALLTHROUGH;
  18152. case 3:
  18153. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  18154. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1094, __pyx_L3_error)
  18155. CYTHON_FALLTHROUGH;
  18156. case 2:
  18157. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  18158. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1094, __pyx_L3_error)
  18159. CYTHON_FALLTHROUGH;
  18160. case 1:
  18161. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  18162. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1094, __pyx_L3_error)
  18163. CYTHON_FALLTHROUGH;
  18164. case 0: break;
  18165. default: goto __pyx_L5_argtuple_error;
  18166. }
  18167. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  18168. 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)
  18169. for (Py_ssize_t i = __pyx_nargs; i < 5; i++) {
  18170. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("cubicPointAtTC", 1, 5, 5, i); __PYX_ERR(0, 1094, __pyx_L3_error) }
  18171. }
  18172. } else if (unlikely(__pyx_nargs != 5)) {
  18173. goto __pyx_L5_argtuple_error;
  18174. } else {
  18175. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  18176. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1094, __pyx_L3_error)
  18177. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  18178. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1094, __pyx_L3_error)
  18179. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  18180. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1094, __pyx_L3_error)
  18181. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  18182. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1094, __pyx_L3_error)
  18183. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  18184. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1094, __pyx_L3_error)
  18185. }
  18186. __pyx_v_pt1 = __Pyx_PyComplex_As___pyx_t_double_complex(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1103, __pyx_L3_error)
  18187. __pyx_v_pt2 = __Pyx_PyComplex_As___pyx_t_double_complex(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1103, __pyx_L3_error)
  18188. __pyx_v_pt3 = __Pyx_PyComplex_As___pyx_t_double_complex(values[2]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1103, __pyx_L3_error)
  18189. __pyx_v_pt4 = __Pyx_PyComplex_As___pyx_t_double_complex(values[3]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1103, __pyx_L3_error)
  18190. __pyx_v_t = __Pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1103, __pyx_L3_error)
  18191. }
  18192. goto __pyx_L6_skip;
  18193. __pyx_L5_argtuple_error:;
  18194. __Pyx_RaiseArgtupleInvalid("cubicPointAtTC", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 1094, __pyx_L3_error)
  18195. __pyx_L6_skip:;
  18196. goto __pyx_L4_argument_unpacking_done;
  18197. __pyx_L3_error:;
  18198. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  18199. Py_XDECREF(values[__pyx_temp]);
  18200. }
  18201. __Pyx_AddTraceback("fontTools.misc.bezierTools.cubicPointAtTC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  18202. __Pyx_RefNannyFinishContext();
  18203. return NULL;
  18204. __pyx_L4_argument_unpacking_done:;
  18205. __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);
  18206. /* function exit code */
  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_RefNannyFinishContext();
  18211. return __pyx_r;
  18212. }
  18213. 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) {
  18214. double __pyx_v_t2;
  18215. double __pyx_v__1_t;
  18216. double __pyx_v__1_t_2;
  18217. PyObject *__pyx_r = NULL;
  18218. __Pyx_RefNannyDeclarations
  18219. __pyx_t_double_complex __pyx_t_1;
  18220. PyObject *__pyx_t_2 = NULL;
  18221. int __pyx_lineno = 0;
  18222. const char *__pyx_filename = NULL;
  18223. int __pyx_clineno = 0;
  18224. __Pyx_RefNannySetupContext("cubicPointAtTC", 0);
  18225. /* "fontTools/misc/bezierTools.py":1113
  18226. * A complex number with the coordinates of the point.
  18227. * """
  18228. * t2 = t * t # <<<<<<<<<<<<<<
  18229. * _1_t = 1 - t
  18230. * _1_t_2 = _1_t * _1_t
  18231. */
  18232. __pyx_v_t2 = (__pyx_v_t * __pyx_v_t);
  18233. /* "fontTools/misc/bezierTools.py":1114
  18234. * """
  18235. * t2 = t * t
  18236. * _1_t = 1 - t # <<<<<<<<<<<<<<
  18237. * _1_t_2 = _1_t * _1_t
  18238. * return _1_t_2 * _1_t * pt1 + 3 * (_1_t_2 * t * pt2 + _1_t * t2 * pt3) + t2 * t * pt4
  18239. */
  18240. __pyx_v__1_t = (1.0 - __pyx_v_t);
  18241. /* "fontTools/misc/bezierTools.py":1115
  18242. * t2 = t * t
  18243. * _1_t = 1 - t
  18244. * _1_t_2 = _1_t * _1_t # <<<<<<<<<<<<<<
  18245. * return _1_t_2 * _1_t * pt1 + 3 * (_1_t_2 * t * pt2 + _1_t * t2 * pt3) + t2 * t * pt4
  18246. *
  18247. */
  18248. __pyx_v__1_t_2 = (__pyx_v__1_t * __pyx_v__1_t);
  18249. /* "fontTools/misc/bezierTools.py":1116
  18250. * _1_t = 1 - t
  18251. * _1_t_2 = _1_t * _1_t
  18252. * return _1_t_2 * _1_t * pt1 + 3 * (_1_t_2 * t * pt2 + _1_t * t2 * pt3) + t2 * t * pt4 # <<<<<<<<<<<<<<
  18253. *
  18254. *
  18255. */
  18256. __Pyx_XDECREF(__pyx_r);
  18257. __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));
  18258. __pyx_t_2 = __pyx_PyComplex_FromComplex(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1116, __pyx_L1_error)
  18259. __Pyx_GOTREF(__pyx_t_2);
  18260. __pyx_r = __pyx_t_2;
  18261. __pyx_t_2 = 0;
  18262. goto __pyx_L0;
  18263. /* "fontTools/misc/bezierTools.py":1094
  18264. *
  18265. *
  18266. * @cython.returns(cython.complex) # <<<<<<<<<<<<<<
  18267. * @cython.locals(
  18268. * t=cython.double,
  18269. */
  18270. /* function exit code */
  18271. __pyx_L1_error:;
  18272. __Pyx_XDECREF(__pyx_t_2);
  18273. __Pyx_AddTraceback("fontTools.misc.bezierTools.cubicPointAtTC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  18274. __pyx_r = NULL;
  18275. __pyx_L0:;
  18276. __Pyx_XGIVEREF(__pyx_r);
  18277. __Pyx_RefNannyFinishContext();
  18278. return __pyx_r;
  18279. }
  18280. /* "fontTools/misc/bezierTools.py":1119
  18281. *
  18282. *
  18283. * def segmentPointAtT(seg, t): # <<<<<<<<<<<<<<
  18284. * if len(seg) == 2:
  18285. * return linePointAtT(*seg, t)
  18286. */
  18287. /* Python wrapper */
  18288. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_67segmentPointAtT(PyObject *__pyx_self,
  18289. #if CYTHON_METH_FASTCALL
  18290. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  18291. #else
  18292. PyObject *__pyx_args, PyObject *__pyx_kwds
  18293. #endif
  18294. ); /*proto*/
  18295. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_66segmentPointAtT, "segmentPointAtT(seg, t)");
  18296. 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};
  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. ) {
  18304. PyObject *__pyx_v_seg = 0;
  18305. PyObject *__pyx_v_t = 0;
  18306. #if !CYTHON_METH_FASTCALL
  18307. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  18308. #endif
  18309. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  18310. PyObject* values[2] = {0,0};
  18311. int __pyx_lineno = 0;
  18312. const char *__pyx_filename = NULL;
  18313. int __pyx_clineno = 0;
  18314. PyObject *__pyx_r = 0;
  18315. __Pyx_RefNannyDeclarations
  18316. __Pyx_RefNannySetupContext("segmentPointAtT (wrapper)", 0);
  18317. #if !CYTHON_METH_FASTCALL
  18318. #if CYTHON_ASSUME_SAFE_SIZE
  18319. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  18320. #else
  18321. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  18322. #endif
  18323. #endif
  18324. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  18325. {
  18326. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_seg,&__pyx_mstate_global->__pyx_n_u_t,0};
  18327. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  18328. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1119, __pyx_L3_error)
  18329. if (__pyx_kwds_len > 0) {
  18330. switch (__pyx_nargs) {
  18331. case 2:
  18332. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  18333. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1119, __pyx_L3_error)
  18334. CYTHON_FALLTHROUGH;
  18335. case 1:
  18336. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  18337. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1119, __pyx_L3_error)
  18338. CYTHON_FALLTHROUGH;
  18339. case 0: break;
  18340. default: goto __pyx_L5_argtuple_error;
  18341. }
  18342. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  18343. 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)
  18344. for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
  18345. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("segmentPointAtT", 1, 2, 2, i); __PYX_ERR(0, 1119, __pyx_L3_error) }
  18346. }
  18347. } else if (unlikely(__pyx_nargs != 2)) {
  18348. goto __pyx_L5_argtuple_error;
  18349. } else {
  18350. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  18351. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1119, __pyx_L3_error)
  18352. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  18353. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1119, __pyx_L3_error)
  18354. }
  18355. __pyx_v_seg = values[0];
  18356. __pyx_v_t = values[1];
  18357. }
  18358. goto __pyx_L6_skip;
  18359. __pyx_L5_argtuple_error:;
  18360. __Pyx_RaiseArgtupleInvalid("segmentPointAtT", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1119, __pyx_L3_error)
  18361. __pyx_L6_skip:;
  18362. goto __pyx_L4_argument_unpacking_done;
  18363. __pyx_L3_error:;
  18364. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  18365. Py_XDECREF(values[__pyx_temp]);
  18366. }
  18367. __Pyx_AddTraceback("fontTools.misc.bezierTools.segmentPointAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  18368. __Pyx_RefNannyFinishContext();
  18369. return NULL;
  18370. __pyx_L4_argument_unpacking_done:;
  18371. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_66segmentPointAtT(__pyx_self, __pyx_v_seg, __pyx_v_t);
  18372. /* function exit code */
  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_RefNannyFinishContext();
  18377. return __pyx_r;
  18378. }
  18379. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_66segmentPointAtT(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_seg, PyObject *__pyx_v_t) {
  18380. PyObject *__pyx_r = NULL;
  18381. __Pyx_RefNannyDeclarations
  18382. Py_ssize_t __pyx_t_1;
  18383. int __pyx_t_2;
  18384. PyObject *__pyx_t_3 = NULL;
  18385. PyObject *__pyx_t_4 = NULL;
  18386. PyObject *__pyx_t_5 = NULL;
  18387. PyObject *__pyx_t_6 = NULL;
  18388. size_t __pyx_t_7;
  18389. int __pyx_lineno = 0;
  18390. const char *__pyx_filename = NULL;
  18391. int __pyx_clineno = 0;
  18392. __Pyx_RefNannySetupContext("segmentPointAtT", 0);
  18393. /* "fontTools/misc/bezierTools.py":1120
  18394. *
  18395. * def segmentPointAtT(seg, t):
  18396. * if len(seg) == 2: # <<<<<<<<<<<<<<
  18397. * return linePointAtT(*seg, t)
  18398. * elif len(seg) == 3:
  18399. */
  18400. __pyx_t_1 = PyObject_Length(__pyx_v_seg); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1120, __pyx_L1_error)
  18401. __pyx_t_2 = (__pyx_t_1 == 2);
  18402. if (__pyx_t_2) {
  18403. /* "fontTools/misc/bezierTools.py":1121
  18404. * def segmentPointAtT(seg, t):
  18405. * if len(seg) == 2:
  18406. * return linePointAtT(*seg, t) # <<<<<<<<<<<<<<
  18407. * elif len(seg) == 3:
  18408. * return quadraticPointAtT(*seg, t)
  18409. */
  18410. __Pyx_XDECREF(__pyx_r);
  18411. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_linePointAtT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1121, __pyx_L1_error)
  18412. __Pyx_GOTREF(__pyx_t_3);
  18413. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_seg); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1121, __pyx_L1_error)
  18414. __Pyx_GOTREF(__pyx_t_4);
  18415. __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1121, __pyx_L1_error)
  18416. __Pyx_GOTREF(__pyx_t_5);
  18417. __Pyx_INCREF(__pyx_v_t);
  18418. __Pyx_GIVEREF(__pyx_v_t);
  18419. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_t) != (0)) __PYX_ERR(0, 1121, __pyx_L1_error);
  18420. __pyx_t_6 = PyNumber_Add(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1121, __pyx_L1_error)
  18421. __Pyx_GOTREF(__pyx_t_6);
  18422. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  18423. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  18424. __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)
  18425. __Pyx_GOTREF(__pyx_t_5);
  18426. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18427. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  18428. __pyx_r = __pyx_t_5;
  18429. __pyx_t_5 = 0;
  18430. goto __pyx_L0;
  18431. /* "fontTools/misc/bezierTools.py":1120
  18432. *
  18433. * def segmentPointAtT(seg, t):
  18434. * if len(seg) == 2: # <<<<<<<<<<<<<<
  18435. * return linePointAtT(*seg, t)
  18436. * elif len(seg) == 3:
  18437. */
  18438. }
  18439. /* "fontTools/misc/bezierTools.py":1122
  18440. * if len(seg) == 2:
  18441. * return linePointAtT(*seg, t)
  18442. * elif len(seg) == 3: # <<<<<<<<<<<<<<
  18443. * return quadraticPointAtT(*seg, t)
  18444. * elif len(seg) == 4:
  18445. */
  18446. __pyx_t_1 = PyObject_Length(__pyx_v_seg); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1122, __pyx_L1_error)
  18447. __pyx_t_2 = (__pyx_t_1 == 3);
  18448. if (__pyx_t_2) {
  18449. /* "fontTools/misc/bezierTools.py":1123
  18450. * return linePointAtT(*seg, t)
  18451. * elif len(seg) == 3:
  18452. * return quadraticPointAtT(*seg, t) # <<<<<<<<<<<<<<
  18453. * elif len(seg) == 4:
  18454. * return cubicPointAtT(*seg, t)
  18455. */
  18456. __Pyx_XDECREF(__pyx_r);
  18457. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_quadraticPointAtT); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1123, __pyx_L1_error)
  18458. __Pyx_GOTREF(__pyx_t_5);
  18459. __pyx_t_6 = __Pyx_PySequence_Tuple(__pyx_v_seg); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1123, __pyx_L1_error)
  18460. __Pyx_GOTREF(__pyx_t_6);
  18461. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1123, __pyx_L1_error)
  18462. __Pyx_GOTREF(__pyx_t_3);
  18463. __Pyx_INCREF(__pyx_v_t);
  18464. __Pyx_GIVEREF(__pyx_v_t);
  18465. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_t) != (0)) __PYX_ERR(0, 1123, __pyx_L1_error);
  18466. __pyx_t_4 = PyNumber_Add(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1123, __pyx_L1_error)
  18467. __Pyx_GOTREF(__pyx_t_4);
  18468. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  18469. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18470. __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)
  18471. __Pyx_GOTREF(__pyx_t_3);
  18472. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  18473. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  18474. __pyx_r = __pyx_t_3;
  18475. __pyx_t_3 = 0;
  18476. goto __pyx_L0;
  18477. /* "fontTools/misc/bezierTools.py":1122
  18478. * if len(seg) == 2:
  18479. * return linePointAtT(*seg, t)
  18480. * elif len(seg) == 3: # <<<<<<<<<<<<<<
  18481. * return quadraticPointAtT(*seg, t)
  18482. * elif len(seg) == 4:
  18483. */
  18484. }
  18485. /* "fontTools/misc/bezierTools.py":1124
  18486. * elif len(seg) == 3:
  18487. * return quadraticPointAtT(*seg, t)
  18488. * elif len(seg) == 4: # <<<<<<<<<<<<<<
  18489. * return cubicPointAtT(*seg, t)
  18490. * raise ValueError("Unknown curve degree")
  18491. */
  18492. __pyx_t_1 = PyObject_Length(__pyx_v_seg); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1124, __pyx_L1_error)
  18493. __pyx_t_2 = (__pyx_t_1 == 4);
  18494. if (__pyx_t_2) {
  18495. /* "fontTools/misc/bezierTools.py":1125
  18496. * return quadraticPointAtT(*seg, t)
  18497. * elif len(seg) == 4:
  18498. * return cubicPointAtT(*seg, t) # <<<<<<<<<<<<<<
  18499. * raise ValueError("Unknown curve degree")
  18500. *
  18501. */
  18502. __Pyx_XDECREF(__pyx_r);
  18503. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cubicPointAtT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1125, __pyx_L1_error)
  18504. __Pyx_GOTREF(__pyx_t_3);
  18505. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_seg); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1125, __pyx_L1_error)
  18506. __Pyx_GOTREF(__pyx_t_4);
  18507. __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1125, __pyx_L1_error)
  18508. __Pyx_GOTREF(__pyx_t_5);
  18509. __Pyx_INCREF(__pyx_v_t);
  18510. __Pyx_GIVEREF(__pyx_v_t);
  18511. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_t) != (0)) __PYX_ERR(0, 1125, __pyx_L1_error);
  18512. __pyx_t_6 = PyNumber_Add(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1125, __pyx_L1_error)
  18513. __Pyx_GOTREF(__pyx_t_6);
  18514. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  18515. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  18516. __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)
  18517. __Pyx_GOTREF(__pyx_t_5);
  18518. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18519. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  18520. __pyx_r = __pyx_t_5;
  18521. __pyx_t_5 = 0;
  18522. goto __pyx_L0;
  18523. /* "fontTools/misc/bezierTools.py":1124
  18524. * elif len(seg) == 3:
  18525. * return quadraticPointAtT(*seg, t)
  18526. * elif len(seg) == 4: # <<<<<<<<<<<<<<
  18527. * return cubicPointAtT(*seg, t)
  18528. * raise ValueError("Unknown curve degree")
  18529. */
  18530. }
  18531. /* "fontTools/misc/bezierTools.py":1126
  18532. * elif len(seg) == 4:
  18533. * return cubicPointAtT(*seg, t)
  18534. * raise ValueError("Unknown curve degree") # <<<<<<<<<<<<<<
  18535. *
  18536. *
  18537. */
  18538. __pyx_t_6 = NULL;
  18539. __pyx_t_7 = 1;
  18540. {
  18541. PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Unknown_curve_degree};
  18542. __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));
  18543. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  18544. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1126, __pyx_L1_error)
  18545. __Pyx_GOTREF(__pyx_t_5);
  18546. }
  18547. __Pyx_Raise(__pyx_t_5, 0, 0, 0);
  18548. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  18549. __PYX_ERR(0, 1126, __pyx_L1_error)
  18550. /* "fontTools/misc/bezierTools.py":1119
  18551. *
  18552. *
  18553. * def segmentPointAtT(seg, t): # <<<<<<<<<<<<<<
  18554. * if len(seg) == 2:
  18555. * return linePointAtT(*seg, t)
  18556. */
  18557. /* function exit code */
  18558. __pyx_L1_error:;
  18559. __Pyx_XDECREF(__pyx_t_3);
  18560. __Pyx_XDECREF(__pyx_t_4);
  18561. __Pyx_XDECREF(__pyx_t_5);
  18562. __Pyx_XDECREF(__pyx_t_6);
  18563. __Pyx_AddTraceback("fontTools.misc.bezierTools.segmentPointAtT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  18564. __pyx_r = NULL;
  18565. __pyx_L0:;
  18566. __Pyx_XGIVEREF(__pyx_r);
  18567. __Pyx_RefNannyFinishContext();
  18568. return __pyx_r;
  18569. }
  18570. /* "fontTools/misc/bezierTools.py":1134
  18571. *
  18572. *
  18573. * def _line_t_of_pt(s, e, pt): # <<<<<<<<<<<<<<
  18574. * sx, sy = s
  18575. * ex, ey = e
  18576. */
  18577. /* Python wrapper */
  18578. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_69_line_t_of_pt(PyObject *__pyx_self,
  18579. #if CYTHON_METH_FASTCALL
  18580. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  18581. #else
  18582. PyObject *__pyx_args, PyObject *__pyx_kwds
  18583. #endif
  18584. ); /*proto*/
  18585. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_68_line_t_of_pt, "_line_t_of_pt(s, e, pt)");
  18586. 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};
  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. ) {
  18594. PyObject *__pyx_v_s = 0;
  18595. PyObject *__pyx_v_e = 0;
  18596. PyObject *__pyx_v_pt = 0;
  18597. #if !CYTHON_METH_FASTCALL
  18598. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  18599. #endif
  18600. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  18601. PyObject* values[3] = {0,0,0};
  18602. int __pyx_lineno = 0;
  18603. const char *__pyx_filename = NULL;
  18604. int __pyx_clineno = 0;
  18605. PyObject *__pyx_r = 0;
  18606. __Pyx_RefNannyDeclarations
  18607. __Pyx_RefNannySetupContext("_line_t_of_pt (wrapper)", 0);
  18608. #if !CYTHON_METH_FASTCALL
  18609. #if CYTHON_ASSUME_SAFE_SIZE
  18610. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  18611. #else
  18612. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  18613. #endif
  18614. #endif
  18615. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  18616. {
  18617. 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};
  18618. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  18619. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1134, __pyx_L3_error)
  18620. if (__pyx_kwds_len > 0) {
  18621. switch (__pyx_nargs) {
  18622. case 3:
  18623. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  18624. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1134, __pyx_L3_error)
  18625. CYTHON_FALLTHROUGH;
  18626. case 2:
  18627. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  18628. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1134, __pyx_L3_error)
  18629. CYTHON_FALLTHROUGH;
  18630. case 1:
  18631. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  18632. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1134, __pyx_L3_error)
  18633. CYTHON_FALLTHROUGH;
  18634. case 0: break;
  18635. default: goto __pyx_L5_argtuple_error;
  18636. }
  18637. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  18638. 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)
  18639. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  18640. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_line_t_of_pt", 1, 3, 3, i); __PYX_ERR(0, 1134, __pyx_L3_error) }
  18641. }
  18642. } else if (unlikely(__pyx_nargs != 3)) {
  18643. goto __pyx_L5_argtuple_error;
  18644. } else {
  18645. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  18646. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1134, __pyx_L3_error)
  18647. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  18648. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1134, __pyx_L3_error)
  18649. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  18650. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1134, __pyx_L3_error)
  18651. }
  18652. __pyx_v_s = values[0];
  18653. __pyx_v_e = values[1];
  18654. __pyx_v_pt = values[2];
  18655. }
  18656. goto __pyx_L6_skip;
  18657. __pyx_L5_argtuple_error:;
  18658. __Pyx_RaiseArgtupleInvalid("_line_t_of_pt", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1134, __pyx_L3_error)
  18659. __pyx_L6_skip:;
  18660. goto __pyx_L4_argument_unpacking_done;
  18661. __pyx_L3_error:;
  18662. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  18663. Py_XDECREF(values[__pyx_temp]);
  18664. }
  18665. __Pyx_AddTraceback("fontTools.misc.bezierTools._line_t_of_pt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  18666. __Pyx_RefNannyFinishContext();
  18667. return NULL;
  18668. __pyx_L4_argument_unpacking_done:;
  18669. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_68_line_t_of_pt(__pyx_self, __pyx_v_s, __pyx_v_e, __pyx_v_pt);
  18670. /* function exit code */
  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_RefNannyFinishContext();
  18675. return __pyx_r;
  18676. }
  18677. 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) {
  18678. PyObject *__pyx_v_sx = NULL;
  18679. PyObject *__pyx_v_sy = NULL;
  18680. PyObject *__pyx_v_ex = NULL;
  18681. PyObject *__pyx_v_ey = NULL;
  18682. PyObject *__pyx_v_px = NULL;
  18683. PyObject *__pyx_v_py = NULL;
  18684. PyObject *__pyx_r = NULL;
  18685. __Pyx_RefNannyDeclarations
  18686. PyObject *__pyx_t_1 = NULL;
  18687. PyObject *__pyx_t_2 = NULL;
  18688. PyObject *__pyx_t_3 = NULL;
  18689. PyObject *(*__pyx_t_4)(PyObject *);
  18690. int __pyx_t_5;
  18691. int __pyx_t_6;
  18692. int __pyx_lineno = 0;
  18693. const char *__pyx_filename = NULL;
  18694. int __pyx_clineno = 0;
  18695. __Pyx_RefNannySetupContext("_line_t_of_pt", 0);
  18696. /* "fontTools/misc/bezierTools.py":1135
  18697. *
  18698. * def _line_t_of_pt(s, e, pt):
  18699. * sx, sy = s # <<<<<<<<<<<<<<
  18700. * ex, ey = e
  18701. * px, py = pt
  18702. */
  18703. if ((likely(PyTuple_CheckExact(__pyx_v_s))) || (PyList_CheckExact(__pyx_v_s))) {
  18704. PyObject* sequence = __pyx_v_s;
  18705. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  18706. if (unlikely(size != 2)) {
  18707. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  18708. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  18709. __PYX_ERR(0, 1135, __pyx_L1_error)
  18710. }
  18711. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  18712. if (likely(PyTuple_CheckExact(sequence))) {
  18713. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  18714. __Pyx_INCREF(__pyx_t_1);
  18715. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  18716. __Pyx_INCREF(__pyx_t_2);
  18717. } else {
  18718. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  18719. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1135, __pyx_L1_error)
  18720. __Pyx_XGOTREF(__pyx_t_1);
  18721. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  18722. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1135, __pyx_L1_error)
  18723. __Pyx_XGOTREF(__pyx_t_2);
  18724. }
  18725. #else
  18726. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1135, __pyx_L1_error)
  18727. __Pyx_GOTREF(__pyx_t_1);
  18728. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1135, __pyx_L1_error)
  18729. __Pyx_GOTREF(__pyx_t_2);
  18730. #endif
  18731. } else {
  18732. Py_ssize_t index = -1;
  18733. __pyx_t_3 = PyObject_GetIter(__pyx_v_s); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1135, __pyx_L1_error)
  18734. __Pyx_GOTREF(__pyx_t_3);
  18735. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  18736. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
  18737. __Pyx_GOTREF(__pyx_t_1);
  18738. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  18739. __Pyx_GOTREF(__pyx_t_2);
  18740. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 1135, __pyx_L1_error)
  18741. __pyx_t_4 = NULL;
  18742. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18743. goto __pyx_L4_unpacking_done;
  18744. __pyx_L3_unpacking_failed:;
  18745. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18746. __pyx_t_4 = NULL;
  18747. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  18748. __PYX_ERR(0, 1135, __pyx_L1_error)
  18749. __pyx_L4_unpacking_done:;
  18750. }
  18751. __pyx_v_sx = __pyx_t_1;
  18752. __pyx_t_1 = 0;
  18753. __pyx_v_sy = __pyx_t_2;
  18754. __pyx_t_2 = 0;
  18755. /* "fontTools/misc/bezierTools.py":1136
  18756. * def _line_t_of_pt(s, e, pt):
  18757. * sx, sy = s
  18758. * ex, ey = e # <<<<<<<<<<<<<<
  18759. * px, py = pt
  18760. * if abs(sx - ex) < epsilon and abs(sy - ey) < epsilon:
  18761. */
  18762. if ((likely(PyTuple_CheckExact(__pyx_v_e))) || (PyList_CheckExact(__pyx_v_e))) {
  18763. PyObject* sequence = __pyx_v_e;
  18764. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  18765. if (unlikely(size != 2)) {
  18766. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  18767. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  18768. __PYX_ERR(0, 1136, __pyx_L1_error)
  18769. }
  18770. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  18771. if (likely(PyTuple_CheckExact(sequence))) {
  18772. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  18773. __Pyx_INCREF(__pyx_t_2);
  18774. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  18775. __Pyx_INCREF(__pyx_t_1);
  18776. } else {
  18777. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  18778. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1136, __pyx_L1_error)
  18779. __Pyx_XGOTREF(__pyx_t_2);
  18780. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  18781. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1136, __pyx_L1_error)
  18782. __Pyx_XGOTREF(__pyx_t_1);
  18783. }
  18784. #else
  18785. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1136, __pyx_L1_error)
  18786. __Pyx_GOTREF(__pyx_t_2);
  18787. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1136, __pyx_L1_error)
  18788. __Pyx_GOTREF(__pyx_t_1);
  18789. #endif
  18790. } else {
  18791. Py_ssize_t index = -1;
  18792. __pyx_t_3 = PyObject_GetIter(__pyx_v_e); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1136, __pyx_L1_error)
  18793. __Pyx_GOTREF(__pyx_t_3);
  18794. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  18795. index = 0; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
  18796. __Pyx_GOTREF(__pyx_t_2);
  18797. index = 1; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
  18798. __Pyx_GOTREF(__pyx_t_1);
  18799. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 1136, __pyx_L1_error)
  18800. __pyx_t_4 = NULL;
  18801. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18802. goto __pyx_L6_unpacking_done;
  18803. __pyx_L5_unpacking_failed:;
  18804. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18805. __pyx_t_4 = NULL;
  18806. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  18807. __PYX_ERR(0, 1136, __pyx_L1_error)
  18808. __pyx_L6_unpacking_done:;
  18809. }
  18810. __pyx_v_ex = __pyx_t_2;
  18811. __pyx_t_2 = 0;
  18812. __pyx_v_ey = __pyx_t_1;
  18813. __pyx_t_1 = 0;
  18814. /* "fontTools/misc/bezierTools.py":1137
  18815. * sx, sy = s
  18816. * ex, ey = e
  18817. * px, py = pt # <<<<<<<<<<<<<<
  18818. * if abs(sx - ex) < epsilon and abs(sy - ey) < epsilon:
  18819. * # Line is a point!
  18820. */
  18821. if ((likely(PyTuple_CheckExact(__pyx_v_pt))) || (PyList_CheckExact(__pyx_v_pt))) {
  18822. PyObject* sequence = __pyx_v_pt;
  18823. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  18824. if (unlikely(size != 2)) {
  18825. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  18826. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  18827. __PYX_ERR(0, 1137, __pyx_L1_error)
  18828. }
  18829. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  18830. if (likely(PyTuple_CheckExact(sequence))) {
  18831. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  18832. __Pyx_INCREF(__pyx_t_1);
  18833. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  18834. __Pyx_INCREF(__pyx_t_2);
  18835. } else {
  18836. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  18837. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1137, __pyx_L1_error)
  18838. __Pyx_XGOTREF(__pyx_t_1);
  18839. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  18840. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1137, __pyx_L1_error)
  18841. __Pyx_XGOTREF(__pyx_t_2);
  18842. }
  18843. #else
  18844. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1137, __pyx_L1_error)
  18845. __Pyx_GOTREF(__pyx_t_1);
  18846. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1137, __pyx_L1_error)
  18847. __Pyx_GOTREF(__pyx_t_2);
  18848. #endif
  18849. } else {
  18850. Py_ssize_t index = -1;
  18851. __pyx_t_3 = PyObject_GetIter(__pyx_v_pt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1137, __pyx_L1_error)
  18852. __Pyx_GOTREF(__pyx_t_3);
  18853. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  18854. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
  18855. __Pyx_GOTREF(__pyx_t_1);
  18856. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
  18857. __Pyx_GOTREF(__pyx_t_2);
  18858. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 1137, __pyx_L1_error)
  18859. __pyx_t_4 = NULL;
  18860. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18861. goto __pyx_L8_unpacking_done;
  18862. __pyx_L7_unpacking_failed:;
  18863. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18864. __pyx_t_4 = NULL;
  18865. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  18866. __PYX_ERR(0, 1137, __pyx_L1_error)
  18867. __pyx_L8_unpacking_done:;
  18868. }
  18869. __pyx_v_px = __pyx_t_1;
  18870. __pyx_t_1 = 0;
  18871. __pyx_v_py = __pyx_t_2;
  18872. __pyx_t_2 = 0;
  18873. /* "fontTools/misc/bezierTools.py":1138
  18874. * ex, ey = e
  18875. * px, py = pt
  18876. * if abs(sx - ex) < epsilon and abs(sy - ey) < epsilon: # <<<<<<<<<<<<<<
  18877. * # Line is a point!
  18878. * return -1
  18879. */
  18880. __pyx_t_2 = PyNumber_Subtract(__pyx_v_sx, __pyx_v_ex); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1138, __pyx_L1_error)
  18881. __Pyx_GOTREF(__pyx_t_2);
  18882. __pyx_t_1 = __Pyx_PyNumber_Absolute(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1138, __pyx_L1_error)
  18883. __Pyx_GOTREF(__pyx_t_1);
  18884. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18885. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1138, __pyx_L1_error)
  18886. __Pyx_GOTREF(__pyx_t_2);
  18887. __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)
  18888. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18889. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18890. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1138, __pyx_L1_error)
  18891. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18892. if (__pyx_t_6) {
  18893. } else {
  18894. __pyx_t_5 = __pyx_t_6;
  18895. goto __pyx_L10_bool_binop_done;
  18896. }
  18897. __pyx_t_3 = PyNumber_Subtract(__pyx_v_sy, __pyx_v_ey); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1138, __pyx_L1_error)
  18898. __Pyx_GOTREF(__pyx_t_3);
  18899. __pyx_t_2 = __Pyx_PyNumber_Absolute(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1138, __pyx_L1_error)
  18900. __Pyx_GOTREF(__pyx_t_2);
  18901. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18902. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_epsilon); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1138, __pyx_L1_error)
  18903. __Pyx_GOTREF(__pyx_t_3);
  18904. __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)
  18905. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18906. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18907. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1138, __pyx_L1_error)
  18908. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18909. __pyx_t_5 = __pyx_t_6;
  18910. __pyx_L10_bool_binop_done:;
  18911. if (__pyx_t_5) {
  18912. /* "fontTools/misc/bezierTools.py":1140
  18913. * if abs(sx - ex) < epsilon and abs(sy - ey) < epsilon:
  18914. * # Line is a point!
  18915. * return -1 # <<<<<<<<<<<<<<
  18916. * # Use the largest
  18917. * if abs(sx - ex) > abs(sy - ey):
  18918. */
  18919. __Pyx_XDECREF(__pyx_r);
  18920. __Pyx_INCREF(__pyx_mstate_global->__pyx_int_neg_1);
  18921. __pyx_r = __pyx_mstate_global->__pyx_int_neg_1;
  18922. goto __pyx_L0;
  18923. /* "fontTools/misc/bezierTools.py":1138
  18924. * ex, ey = e
  18925. * px, py = pt
  18926. * if abs(sx - ex) < epsilon and abs(sy - ey) < epsilon: # <<<<<<<<<<<<<<
  18927. * # Line is a point!
  18928. * return -1
  18929. */
  18930. }
  18931. /* "fontTools/misc/bezierTools.py":1142
  18932. * return -1
  18933. * # Use the largest
  18934. * if abs(sx - ex) > abs(sy - ey): # <<<<<<<<<<<<<<
  18935. * return (px - sx) / (ex - sx)
  18936. * else:
  18937. */
  18938. __pyx_t_1 = PyNumber_Subtract(__pyx_v_sx, __pyx_v_ex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1142, __pyx_L1_error)
  18939. __Pyx_GOTREF(__pyx_t_1);
  18940. __pyx_t_3 = __Pyx_PyNumber_Absolute(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1142, __pyx_L1_error)
  18941. __Pyx_GOTREF(__pyx_t_3);
  18942. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18943. __pyx_t_1 = PyNumber_Subtract(__pyx_v_sy, __pyx_v_ey); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1142, __pyx_L1_error)
  18944. __Pyx_GOTREF(__pyx_t_1);
  18945. __pyx_t_2 = __Pyx_PyNumber_Absolute(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1142, __pyx_L1_error)
  18946. __Pyx_GOTREF(__pyx_t_2);
  18947. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18948. __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)
  18949. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18950. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18951. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1142, __pyx_L1_error)
  18952. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18953. if (__pyx_t_5) {
  18954. /* "fontTools/misc/bezierTools.py":1143
  18955. * # Use the largest
  18956. * if abs(sx - ex) > abs(sy - ey):
  18957. * return (px - sx) / (ex - sx) # <<<<<<<<<<<<<<
  18958. * else:
  18959. * return (py - sy) / (ey - sy)
  18960. */
  18961. __Pyx_XDECREF(__pyx_r);
  18962. __pyx_t_1 = PyNumber_Subtract(__pyx_v_px, __pyx_v_sx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1143, __pyx_L1_error)
  18963. __Pyx_GOTREF(__pyx_t_1);
  18964. __pyx_t_2 = PyNumber_Subtract(__pyx_v_ex, __pyx_v_sx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1143, __pyx_L1_error)
  18965. __Pyx_GOTREF(__pyx_t_2);
  18966. __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1143, __pyx_L1_error)
  18967. __Pyx_GOTREF(__pyx_t_3);
  18968. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  18969. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18970. __pyx_r = __pyx_t_3;
  18971. __pyx_t_3 = 0;
  18972. goto __pyx_L0;
  18973. /* "fontTools/misc/bezierTools.py":1142
  18974. * return -1
  18975. * # Use the largest
  18976. * if abs(sx - ex) > abs(sy - ey): # <<<<<<<<<<<<<<
  18977. * return (px - sx) / (ex - sx)
  18978. * else:
  18979. */
  18980. }
  18981. /* "fontTools/misc/bezierTools.py":1145
  18982. * return (px - sx) / (ex - sx)
  18983. * else:
  18984. * return (py - sy) / (ey - sy) # <<<<<<<<<<<<<<
  18985. *
  18986. *
  18987. */
  18988. /*else*/ {
  18989. __Pyx_XDECREF(__pyx_r);
  18990. __pyx_t_3 = PyNumber_Subtract(__pyx_v_py, __pyx_v_sy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1145, __pyx_L1_error)
  18991. __Pyx_GOTREF(__pyx_t_3);
  18992. __pyx_t_2 = PyNumber_Subtract(__pyx_v_ey, __pyx_v_sy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1145, __pyx_L1_error)
  18993. __Pyx_GOTREF(__pyx_t_2);
  18994. __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1145, __pyx_L1_error)
  18995. __Pyx_GOTREF(__pyx_t_1);
  18996. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  18997. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  18998. __pyx_r = __pyx_t_1;
  18999. __pyx_t_1 = 0;
  19000. goto __pyx_L0;
  19001. }
  19002. /* "fontTools/misc/bezierTools.py":1134
  19003. *
  19004. *
  19005. * def _line_t_of_pt(s, e, pt): # <<<<<<<<<<<<<<
  19006. * sx, sy = s
  19007. * ex, ey = e
  19008. */
  19009. /* function exit code */
  19010. __pyx_L1_error:;
  19011. __Pyx_XDECREF(__pyx_t_1);
  19012. __Pyx_XDECREF(__pyx_t_2);
  19013. __Pyx_XDECREF(__pyx_t_3);
  19014. __Pyx_AddTraceback("fontTools.misc.bezierTools._line_t_of_pt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  19015. __pyx_r = NULL;
  19016. __pyx_L0:;
  19017. __Pyx_XDECREF(__pyx_v_sx);
  19018. __Pyx_XDECREF(__pyx_v_sy);
  19019. __Pyx_XDECREF(__pyx_v_ex);
  19020. __Pyx_XDECREF(__pyx_v_ey);
  19021. __Pyx_XDECREF(__pyx_v_px);
  19022. __Pyx_XDECREF(__pyx_v_py);
  19023. __Pyx_XGIVEREF(__pyx_r);
  19024. __Pyx_RefNannyFinishContext();
  19025. return __pyx_r;
  19026. }
  19027. /* "fontTools/misc/bezierTools.py":1148
  19028. *
  19029. *
  19030. * def _both_points_are_on_same_side_of_origin(a, b, origin): # <<<<<<<<<<<<<<
  19031. * xDiff = (a[0] - origin[0]) * (b[0] - origin[0])
  19032. * yDiff = (a[1] - origin[1]) * (b[1] - origin[1])
  19033. */
  19034. /* Python wrapper */
  19035. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_71_both_points_are_on_same_side_of_origin(PyObject *__pyx_self,
  19036. #if CYTHON_METH_FASTCALL
  19037. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  19038. #else
  19039. PyObject *__pyx_args, PyObject *__pyx_kwds
  19040. #endif
  19041. ); /*proto*/
  19042. 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)");
  19043. 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};
  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. ) {
  19051. PyObject *__pyx_v_a = 0;
  19052. PyObject *__pyx_v_b = 0;
  19053. PyObject *__pyx_v_origin = 0;
  19054. #if !CYTHON_METH_FASTCALL
  19055. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  19056. #endif
  19057. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  19058. PyObject* values[3] = {0,0,0};
  19059. int __pyx_lineno = 0;
  19060. const char *__pyx_filename = NULL;
  19061. int __pyx_clineno = 0;
  19062. PyObject *__pyx_r = 0;
  19063. __Pyx_RefNannyDeclarations
  19064. __Pyx_RefNannySetupContext("_both_points_are_on_same_side_of_origin (wrapper)", 0);
  19065. #if !CYTHON_METH_FASTCALL
  19066. #if CYTHON_ASSUME_SAFE_SIZE
  19067. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  19068. #else
  19069. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  19070. #endif
  19071. #endif
  19072. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  19073. {
  19074. 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};
  19075. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  19076. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1148, __pyx_L3_error)
  19077. if (__pyx_kwds_len > 0) {
  19078. switch (__pyx_nargs) {
  19079. case 3:
  19080. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  19081. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1148, __pyx_L3_error)
  19082. CYTHON_FALLTHROUGH;
  19083. case 2:
  19084. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  19085. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1148, __pyx_L3_error)
  19086. CYTHON_FALLTHROUGH;
  19087. case 1:
  19088. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  19089. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1148, __pyx_L3_error)
  19090. CYTHON_FALLTHROUGH;
  19091. case 0: break;
  19092. default: goto __pyx_L5_argtuple_error;
  19093. }
  19094. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  19095. 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)
  19096. for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
  19097. 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) }
  19098. }
  19099. } else if (unlikely(__pyx_nargs != 3)) {
  19100. goto __pyx_L5_argtuple_error;
  19101. } else {
  19102. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  19103. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1148, __pyx_L3_error)
  19104. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  19105. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1148, __pyx_L3_error)
  19106. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  19107. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1148, __pyx_L3_error)
  19108. }
  19109. __pyx_v_a = values[0];
  19110. __pyx_v_b = values[1];
  19111. __pyx_v_origin = values[2];
  19112. }
  19113. goto __pyx_L6_skip;
  19114. __pyx_L5_argtuple_error:;
  19115. __Pyx_RaiseArgtupleInvalid("_both_points_are_on_same_side_of_origin", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 1148, __pyx_L3_error)
  19116. __pyx_L6_skip:;
  19117. goto __pyx_L4_argument_unpacking_done;
  19118. __pyx_L3_error:;
  19119. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  19120. Py_XDECREF(values[__pyx_temp]);
  19121. }
  19122. __Pyx_AddTraceback("fontTools.misc.bezierTools._both_points_are_on_same_side_of_origin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  19123. __Pyx_RefNannyFinishContext();
  19124. return NULL;
  19125. __pyx_L4_argument_unpacking_done:;
  19126. __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);
  19127. /* function exit code */
  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_RefNannyFinishContext();
  19132. return __pyx_r;
  19133. }
  19134. 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) {
  19135. PyObject *__pyx_v_xDiff = NULL;
  19136. PyObject *__pyx_v_yDiff = NULL;
  19137. PyObject *__pyx_r = NULL;
  19138. __Pyx_RefNannyDeclarations
  19139. PyObject *__pyx_t_1 = NULL;
  19140. PyObject *__pyx_t_2 = NULL;
  19141. PyObject *__pyx_t_3 = NULL;
  19142. PyObject *__pyx_t_4 = NULL;
  19143. int __pyx_t_5;
  19144. int __pyx_t_6;
  19145. int __pyx_lineno = 0;
  19146. const char *__pyx_filename = NULL;
  19147. int __pyx_clineno = 0;
  19148. __Pyx_RefNannySetupContext("_both_points_are_on_same_side_of_origin", 0);
  19149. /* "fontTools/misc/bezierTools.py":1149
  19150. *
  19151. * def _both_points_are_on_same_side_of_origin(a, b, origin):
  19152. * xDiff = (a[0] - origin[0]) * (b[0] - origin[0]) # <<<<<<<<<<<<<<
  19153. * yDiff = (a[1] - origin[1]) * (b[1] - origin[1])
  19154. * return not (xDiff <= 0.0 and yDiff <= 0.0)
  19155. */
  19156. __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)
  19157. __Pyx_GOTREF(__pyx_t_1);
  19158. __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)
  19159. __Pyx_GOTREF(__pyx_t_2);
  19160. __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1149, __pyx_L1_error)
  19161. __Pyx_GOTREF(__pyx_t_3);
  19162. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19163. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  19164. __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)
  19165. __Pyx_GOTREF(__pyx_t_2);
  19166. __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)
  19167. __Pyx_GOTREF(__pyx_t_1);
  19168. __pyx_t_4 = PyNumber_Subtract(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1149, __pyx_L1_error)
  19169. __Pyx_GOTREF(__pyx_t_4);
  19170. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  19171. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19172. __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1149, __pyx_L1_error)
  19173. __Pyx_GOTREF(__pyx_t_1);
  19174. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19175. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  19176. __pyx_v_xDiff = __pyx_t_1;
  19177. __pyx_t_1 = 0;
  19178. /* "fontTools/misc/bezierTools.py":1150
  19179. * def _both_points_are_on_same_side_of_origin(a, b, origin):
  19180. * xDiff = (a[0] - origin[0]) * (b[0] - origin[0])
  19181. * yDiff = (a[1] - origin[1]) * (b[1] - origin[1]) # <<<<<<<<<<<<<<
  19182. * return not (xDiff <= 0.0 and yDiff <= 0.0)
  19183. *
  19184. */
  19185. __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)
  19186. __Pyx_GOTREF(__pyx_t_1);
  19187. __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)
  19188. __Pyx_GOTREF(__pyx_t_4);
  19189. __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1150, __pyx_L1_error)
  19190. __Pyx_GOTREF(__pyx_t_3);
  19191. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19192. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  19193. __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)
  19194. __Pyx_GOTREF(__pyx_t_4);
  19195. __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)
  19196. __Pyx_GOTREF(__pyx_t_1);
  19197. __pyx_t_2 = PyNumber_Subtract(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1150, __pyx_L1_error)
  19198. __Pyx_GOTREF(__pyx_t_2);
  19199. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  19200. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19201. __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1150, __pyx_L1_error)
  19202. __Pyx_GOTREF(__pyx_t_1);
  19203. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19204. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  19205. __pyx_v_yDiff = __pyx_t_1;
  19206. __pyx_t_1 = 0;
  19207. /* "fontTools/misc/bezierTools.py":1151
  19208. * xDiff = (a[0] - origin[0]) * (b[0] - origin[0])
  19209. * yDiff = (a[1] - origin[1]) * (b[1] - origin[1])
  19210. * return not (xDiff <= 0.0 and yDiff <= 0.0) # <<<<<<<<<<<<<<
  19211. *
  19212. *
  19213. */
  19214. __Pyx_XDECREF(__pyx_r);
  19215. __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)
  19216. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1151, __pyx_L1_error)
  19217. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19218. if (__pyx_t_6) {
  19219. } else {
  19220. __pyx_t_5 = __pyx_t_6;
  19221. goto __pyx_L3_bool_binop_done;
  19222. }
  19223. __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)
  19224. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1151, __pyx_L1_error)
  19225. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19226. __pyx_t_5 = __pyx_t_6;
  19227. __pyx_L3_bool_binop_done:;
  19228. __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_5)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1151, __pyx_L1_error)
  19229. __Pyx_GOTREF(__pyx_t_1);
  19230. __pyx_r = __pyx_t_1;
  19231. __pyx_t_1 = 0;
  19232. goto __pyx_L0;
  19233. /* "fontTools/misc/bezierTools.py":1148
  19234. *
  19235. *
  19236. * def _both_points_are_on_same_side_of_origin(a, b, origin): # <<<<<<<<<<<<<<
  19237. * xDiff = (a[0] - origin[0]) * (b[0] - origin[0])
  19238. * yDiff = (a[1] - origin[1]) * (b[1] - origin[1])
  19239. */
  19240. /* function exit code */
  19241. __pyx_L1_error:;
  19242. __Pyx_XDECREF(__pyx_t_1);
  19243. __Pyx_XDECREF(__pyx_t_2);
  19244. __Pyx_XDECREF(__pyx_t_3);
  19245. __Pyx_XDECREF(__pyx_t_4);
  19246. __Pyx_AddTraceback("fontTools.misc.bezierTools._both_points_are_on_same_side_of_origin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  19247. __pyx_r = NULL;
  19248. __pyx_L0:;
  19249. __Pyx_XDECREF(__pyx_v_xDiff);
  19250. __Pyx_XDECREF(__pyx_v_yDiff);
  19251. __Pyx_XGIVEREF(__pyx_r);
  19252. __Pyx_RefNannyFinishContext();
  19253. return __pyx_r;
  19254. }
  19255. /* "fontTools/misc/bezierTools.py":1154
  19256. *
  19257. *
  19258. * def lineLineIntersections(s1, e1, s2, e2): # <<<<<<<<<<<<<<
  19259. * """Finds intersections between two line segments.
  19260. *
  19261. */
  19262. /* Python wrapper */
  19263. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_73lineLineIntersections(PyObject *__pyx_self,
  19264. #if CYTHON_METH_FASTCALL
  19265. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  19266. #else
  19267. PyObject *__pyx_args, PyObject *__pyx_kwds
  19268. #endif
  19269. ); /*proto*/
  19270. 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)");
  19271. 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};
  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. ) {
  19279. PyObject *__pyx_v_s1 = 0;
  19280. PyObject *__pyx_v_e1 = 0;
  19281. PyObject *__pyx_v_s2 = 0;
  19282. PyObject *__pyx_v_e2 = 0;
  19283. #if !CYTHON_METH_FASTCALL
  19284. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  19285. #endif
  19286. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  19287. PyObject* values[4] = {0,0,0,0};
  19288. int __pyx_lineno = 0;
  19289. const char *__pyx_filename = NULL;
  19290. int __pyx_clineno = 0;
  19291. PyObject *__pyx_r = 0;
  19292. __Pyx_RefNannyDeclarations
  19293. __Pyx_RefNannySetupContext("lineLineIntersections (wrapper)", 0);
  19294. #if !CYTHON_METH_FASTCALL
  19295. #if CYTHON_ASSUME_SAFE_SIZE
  19296. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  19297. #else
  19298. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  19299. #endif
  19300. #endif
  19301. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  19302. {
  19303. 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};
  19304. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  19305. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1154, __pyx_L3_error)
  19306. if (__pyx_kwds_len > 0) {
  19307. switch (__pyx_nargs) {
  19308. case 4:
  19309. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  19310. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1154, __pyx_L3_error)
  19311. CYTHON_FALLTHROUGH;
  19312. case 3:
  19313. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  19314. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1154, __pyx_L3_error)
  19315. CYTHON_FALLTHROUGH;
  19316. case 2:
  19317. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  19318. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1154, __pyx_L3_error)
  19319. CYTHON_FALLTHROUGH;
  19320. case 1:
  19321. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  19322. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1154, __pyx_L3_error)
  19323. CYTHON_FALLTHROUGH;
  19324. case 0: break;
  19325. default: goto __pyx_L5_argtuple_error;
  19326. }
  19327. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  19328. 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)
  19329. for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
  19330. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lineLineIntersections", 1, 4, 4, i); __PYX_ERR(0, 1154, __pyx_L3_error) }
  19331. }
  19332. } else if (unlikely(__pyx_nargs != 4)) {
  19333. goto __pyx_L5_argtuple_error;
  19334. } else {
  19335. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  19336. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1154, __pyx_L3_error)
  19337. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  19338. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1154, __pyx_L3_error)
  19339. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  19340. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1154, __pyx_L3_error)
  19341. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  19342. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1154, __pyx_L3_error)
  19343. }
  19344. __pyx_v_s1 = values[0];
  19345. __pyx_v_e1 = values[1];
  19346. __pyx_v_s2 = values[2];
  19347. __pyx_v_e2 = values[3];
  19348. }
  19349. goto __pyx_L6_skip;
  19350. __pyx_L5_argtuple_error:;
  19351. __Pyx_RaiseArgtupleInvalid("lineLineIntersections", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 1154, __pyx_L3_error)
  19352. __pyx_L6_skip:;
  19353. goto __pyx_L4_argument_unpacking_done;
  19354. __pyx_L3_error:;
  19355. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  19356. Py_XDECREF(values[__pyx_temp]);
  19357. }
  19358. __Pyx_AddTraceback("fontTools.misc.bezierTools.lineLineIntersections", __pyx_clineno, __pyx_lineno, __pyx_filename);
  19359. __Pyx_RefNannyFinishContext();
  19360. return NULL;
  19361. __pyx_L4_argument_unpacking_done:;
  19362. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_72lineLineIntersections(__pyx_self, __pyx_v_s1, __pyx_v_e1, __pyx_v_s2, __pyx_v_e2);
  19363. /* function exit code */
  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_RefNannyFinishContext();
  19368. return __pyx_r;
  19369. }
  19370. 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) {
  19371. PyObject *__pyx_v_s1x = NULL;
  19372. PyObject *__pyx_v_s1y = NULL;
  19373. PyObject *__pyx_v_e1x = NULL;
  19374. PyObject *__pyx_v_e1y = NULL;
  19375. PyObject *__pyx_v_s2x = NULL;
  19376. PyObject *__pyx_v_s2y = NULL;
  19377. PyObject *__pyx_v_e2x = NULL;
  19378. PyObject *__pyx_v_e2y = NULL;
  19379. PyObject *__pyx_v_x = NULL;
  19380. PyObject *__pyx_v_slope34 = NULL;
  19381. PyObject *__pyx_v_y = NULL;
  19382. PyObject *__pyx_v_pt = NULL;
  19383. PyObject *__pyx_v_slope12 = NULL;
  19384. PyObject *__pyx_r = NULL;
  19385. __Pyx_RefNannyDeclarations
  19386. PyObject *__pyx_t_1 = NULL;
  19387. PyObject *__pyx_t_2 = NULL;
  19388. PyObject *__pyx_t_3 = NULL;
  19389. PyObject *(*__pyx_t_4)(PyObject *);
  19390. int __pyx_t_5;
  19391. PyObject *__pyx_t_6 = NULL;
  19392. size_t __pyx_t_7;
  19393. int __pyx_t_8;
  19394. int __pyx_t_9;
  19395. PyObject *__pyx_t_10 = NULL;
  19396. PyObject *__pyx_t_11 = NULL;
  19397. PyObject *__pyx_t_12 = NULL;
  19398. int __pyx_lineno = 0;
  19399. const char *__pyx_filename = NULL;
  19400. int __pyx_clineno = 0;
  19401. __Pyx_RefNannySetupContext("lineLineIntersections", 0);
  19402. /* "fontTools/misc/bezierTools.py":1177
  19403. * (0.45069111555824465, 0.5408153767394238)
  19404. * """
  19405. * s1x, s1y = s1 # <<<<<<<<<<<<<<
  19406. * e1x, e1y = e1
  19407. * s2x, s2y = s2
  19408. */
  19409. if ((likely(PyTuple_CheckExact(__pyx_v_s1))) || (PyList_CheckExact(__pyx_v_s1))) {
  19410. PyObject* sequence = __pyx_v_s1;
  19411. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  19412. if (unlikely(size != 2)) {
  19413. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  19414. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  19415. __PYX_ERR(0, 1177, __pyx_L1_error)
  19416. }
  19417. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  19418. if (likely(PyTuple_CheckExact(sequence))) {
  19419. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  19420. __Pyx_INCREF(__pyx_t_1);
  19421. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  19422. __Pyx_INCREF(__pyx_t_2);
  19423. } else {
  19424. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  19425. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1177, __pyx_L1_error)
  19426. __Pyx_XGOTREF(__pyx_t_1);
  19427. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  19428. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1177, __pyx_L1_error)
  19429. __Pyx_XGOTREF(__pyx_t_2);
  19430. }
  19431. #else
  19432. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1177, __pyx_L1_error)
  19433. __Pyx_GOTREF(__pyx_t_1);
  19434. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1177, __pyx_L1_error)
  19435. __Pyx_GOTREF(__pyx_t_2);
  19436. #endif
  19437. } else {
  19438. Py_ssize_t index = -1;
  19439. __pyx_t_3 = PyObject_GetIter(__pyx_v_s1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1177, __pyx_L1_error)
  19440. __Pyx_GOTREF(__pyx_t_3);
  19441. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  19442. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
  19443. __Pyx_GOTREF(__pyx_t_1);
  19444. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
  19445. __Pyx_GOTREF(__pyx_t_2);
  19446. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 1177, __pyx_L1_error)
  19447. __pyx_t_4 = NULL;
  19448. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19449. goto __pyx_L4_unpacking_done;
  19450. __pyx_L3_unpacking_failed:;
  19451. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19452. __pyx_t_4 = NULL;
  19453. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  19454. __PYX_ERR(0, 1177, __pyx_L1_error)
  19455. __pyx_L4_unpacking_done:;
  19456. }
  19457. __pyx_v_s1x = __pyx_t_1;
  19458. __pyx_t_1 = 0;
  19459. __pyx_v_s1y = __pyx_t_2;
  19460. __pyx_t_2 = 0;
  19461. /* "fontTools/misc/bezierTools.py":1178
  19462. * """
  19463. * s1x, s1y = s1
  19464. * e1x, e1y = e1 # <<<<<<<<<<<<<<
  19465. * s2x, s2y = s2
  19466. * e2x, e2y = e2
  19467. */
  19468. if ((likely(PyTuple_CheckExact(__pyx_v_e1))) || (PyList_CheckExact(__pyx_v_e1))) {
  19469. PyObject* sequence = __pyx_v_e1;
  19470. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  19471. if (unlikely(size != 2)) {
  19472. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  19473. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  19474. __PYX_ERR(0, 1178, __pyx_L1_error)
  19475. }
  19476. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  19477. if (likely(PyTuple_CheckExact(sequence))) {
  19478. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  19479. __Pyx_INCREF(__pyx_t_2);
  19480. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  19481. __Pyx_INCREF(__pyx_t_1);
  19482. } else {
  19483. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  19484. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1178, __pyx_L1_error)
  19485. __Pyx_XGOTREF(__pyx_t_2);
  19486. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  19487. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1178, __pyx_L1_error)
  19488. __Pyx_XGOTREF(__pyx_t_1);
  19489. }
  19490. #else
  19491. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1178, __pyx_L1_error)
  19492. __Pyx_GOTREF(__pyx_t_2);
  19493. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1178, __pyx_L1_error)
  19494. __Pyx_GOTREF(__pyx_t_1);
  19495. #endif
  19496. } else {
  19497. Py_ssize_t index = -1;
  19498. __pyx_t_3 = PyObject_GetIter(__pyx_v_e1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1178, __pyx_L1_error)
  19499. __Pyx_GOTREF(__pyx_t_3);
  19500. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  19501. index = 0; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
  19502. __Pyx_GOTREF(__pyx_t_2);
  19503. index = 1; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
  19504. __Pyx_GOTREF(__pyx_t_1);
  19505. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 1178, __pyx_L1_error)
  19506. __pyx_t_4 = NULL;
  19507. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19508. goto __pyx_L6_unpacking_done;
  19509. __pyx_L5_unpacking_failed:;
  19510. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19511. __pyx_t_4 = NULL;
  19512. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  19513. __PYX_ERR(0, 1178, __pyx_L1_error)
  19514. __pyx_L6_unpacking_done:;
  19515. }
  19516. __pyx_v_e1x = __pyx_t_2;
  19517. __pyx_t_2 = 0;
  19518. __pyx_v_e1y = __pyx_t_1;
  19519. __pyx_t_1 = 0;
  19520. /* "fontTools/misc/bezierTools.py":1179
  19521. * s1x, s1y = s1
  19522. * e1x, e1y = e1
  19523. * s2x, s2y = s2 # <<<<<<<<<<<<<<
  19524. * e2x, e2y = e2
  19525. * if (
  19526. */
  19527. if ((likely(PyTuple_CheckExact(__pyx_v_s2))) || (PyList_CheckExact(__pyx_v_s2))) {
  19528. PyObject* sequence = __pyx_v_s2;
  19529. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  19530. if (unlikely(size != 2)) {
  19531. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  19532. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  19533. __PYX_ERR(0, 1179, __pyx_L1_error)
  19534. }
  19535. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  19536. if (likely(PyTuple_CheckExact(sequence))) {
  19537. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  19538. __Pyx_INCREF(__pyx_t_1);
  19539. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  19540. __Pyx_INCREF(__pyx_t_2);
  19541. } else {
  19542. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  19543. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1179, __pyx_L1_error)
  19544. __Pyx_XGOTREF(__pyx_t_1);
  19545. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  19546. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1179, __pyx_L1_error)
  19547. __Pyx_XGOTREF(__pyx_t_2);
  19548. }
  19549. #else
  19550. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1179, __pyx_L1_error)
  19551. __Pyx_GOTREF(__pyx_t_1);
  19552. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1179, __pyx_L1_error)
  19553. __Pyx_GOTREF(__pyx_t_2);
  19554. #endif
  19555. } else {
  19556. Py_ssize_t index = -1;
  19557. __pyx_t_3 = PyObject_GetIter(__pyx_v_s2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1179, __pyx_L1_error)
  19558. __Pyx_GOTREF(__pyx_t_3);
  19559. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  19560. index = 0; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
  19561. __Pyx_GOTREF(__pyx_t_1);
  19562. index = 1; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
  19563. __Pyx_GOTREF(__pyx_t_2);
  19564. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 1179, __pyx_L1_error)
  19565. __pyx_t_4 = NULL;
  19566. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19567. goto __pyx_L8_unpacking_done;
  19568. __pyx_L7_unpacking_failed:;
  19569. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19570. __pyx_t_4 = NULL;
  19571. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  19572. __PYX_ERR(0, 1179, __pyx_L1_error)
  19573. __pyx_L8_unpacking_done:;
  19574. }
  19575. __pyx_v_s2x = __pyx_t_1;
  19576. __pyx_t_1 = 0;
  19577. __pyx_v_s2y = __pyx_t_2;
  19578. __pyx_t_2 = 0;
  19579. /* "fontTools/misc/bezierTools.py":1180
  19580. * e1x, e1y = e1
  19581. * s2x, s2y = s2
  19582. * e2x, e2y = e2 # <<<<<<<<<<<<<<
  19583. * if (
  19584. * math.isclose(s2x, e2x) and math.isclose(s1x, e1x) and not math.isclose(s1x, s2x)
  19585. */
  19586. if ((likely(PyTuple_CheckExact(__pyx_v_e2))) || (PyList_CheckExact(__pyx_v_e2))) {
  19587. PyObject* sequence = __pyx_v_e2;
  19588. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  19589. if (unlikely(size != 2)) {
  19590. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  19591. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  19592. __PYX_ERR(0, 1180, __pyx_L1_error)
  19593. }
  19594. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  19595. if (likely(PyTuple_CheckExact(sequence))) {
  19596. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  19597. __Pyx_INCREF(__pyx_t_2);
  19598. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  19599. __Pyx_INCREF(__pyx_t_1);
  19600. } else {
  19601. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  19602. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1180, __pyx_L1_error)
  19603. __Pyx_XGOTREF(__pyx_t_2);
  19604. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  19605. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1180, __pyx_L1_error)
  19606. __Pyx_XGOTREF(__pyx_t_1);
  19607. }
  19608. #else
  19609. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1180, __pyx_L1_error)
  19610. __Pyx_GOTREF(__pyx_t_2);
  19611. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1180, __pyx_L1_error)
  19612. __Pyx_GOTREF(__pyx_t_1);
  19613. #endif
  19614. } else {
  19615. Py_ssize_t index = -1;
  19616. __pyx_t_3 = PyObject_GetIter(__pyx_v_e2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1180, __pyx_L1_error)
  19617. __Pyx_GOTREF(__pyx_t_3);
  19618. __pyx_t_4 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3);
  19619. index = 0; __pyx_t_2 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L9_unpacking_failed;
  19620. __Pyx_GOTREF(__pyx_t_2);
  19621. index = 1; __pyx_t_1 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L9_unpacking_failed;
  19622. __Pyx_GOTREF(__pyx_t_1);
  19623. if (__Pyx_IternextUnpackEndCheck(__pyx_t_4(__pyx_t_3), 2) < (0)) __PYX_ERR(0, 1180, __pyx_L1_error)
  19624. __pyx_t_4 = NULL;
  19625. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19626. goto __pyx_L10_unpacking_done;
  19627. __pyx_L9_unpacking_failed:;
  19628. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19629. __pyx_t_4 = NULL;
  19630. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  19631. __PYX_ERR(0, 1180, __pyx_L1_error)
  19632. __pyx_L10_unpacking_done:;
  19633. }
  19634. __pyx_v_e2x = __pyx_t_2;
  19635. __pyx_t_2 = 0;
  19636. __pyx_v_e2y = __pyx_t_1;
  19637. __pyx_t_1 = 0;
  19638. /* "fontTools/misc/bezierTools.py":1182
  19639. * e2x, e2y = e2
  19640. * if (
  19641. * math.isclose(s2x, e2x) and math.isclose(s1x, e1x) and not math.isclose(s1x, s2x) # <<<<<<<<<<<<<<
  19642. * ): # Parallel vertical
  19643. * return []
  19644. */
  19645. __pyx_t_2 = NULL;
  19646. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1182, __pyx_L1_error)
  19647. __Pyx_GOTREF(__pyx_t_3);
  19648. __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)
  19649. __Pyx_GOTREF(__pyx_t_6);
  19650. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19651. __pyx_t_7 = 1;
  19652. #if CYTHON_UNPACK_METHODS
  19653. if (unlikely(PyMethod_Check(__pyx_t_6))) {
  19654. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
  19655. assert(__pyx_t_2);
  19656. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
  19657. __Pyx_INCREF(__pyx_t_2);
  19658. __Pyx_INCREF(__pyx__function);
  19659. __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
  19660. __pyx_t_7 = 0;
  19661. }
  19662. #endif
  19663. {
  19664. PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_s2x, __pyx_v_e2x};
  19665. __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));
  19666. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  19667. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  19668. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1182, __pyx_L1_error)
  19669. __Pyx_GOTREF(__pyx_t_1);
  19670. }
  19671. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1182, __pyx_L1_error)
  19672. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19673. if (__pyx_t_8) {
  19674. } else {
  19675. __pyx_t_5 = __pyx_t_8;
  19676. goto __pyx_L12_bool_binop_done;
  19677. }
  19678. __pyx_t_6 = NULL;
  19679. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1182, __pyx_L1_error)
  19680. __Pyx_GOTREF(__pyx_t_2);
  19681. __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)
  19682. __Pyx_GOTREF(__pyx_t_3);
  19683. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  19684. __pyx_t_7 = 1;
  19685. #if CYTHON_UNPACK_METHODS
  19686. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  19687. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
  19688. assert(__pyx_t_6);
  19689. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  19690. __Pyx_INCREF(__pyx_t_6);
  19691. __Pyx_INCREF(__pyx__function);
  19692. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  19693. __pyx_t_7 = 0;
  19694. }
  19695. #endif
  19696. {
  19697. PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_s1x, __pyx_v_e1x};
  19698. __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));
  19699. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  19700. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19701. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1182, __pyx_L1_error)
  19702. __Pyx_GOTREF(__pyx_t_1);
  19703. }
  19704. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1182, __pyx_L1_error)
  19705. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19706. if (__pyx_t_8) {
  19707. } else {
  19708. __pyx_t_5 = __pyx_t_8;
  19709. goto __pyx_L12_bool_binop_done;
  19710. }
  19711. __pyx_t_3 = NULL;
  19712. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1182, __pyx_L1_error)
  19713. __Pyx_GOTREF(__pyx_t_6);
  19714. __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)
  19715. __Pyx_GOTREF(__pyx_t_2);
  19716. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  19717. __pyx_t_7 = 1;
  19718. #if CYTHON_UNPACK_METHODS
  19719. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  19720. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  19721. assert(__pyx_t_3);
  19722. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  19723. __Pyx_INCREF(__pyx_t_3);
  19724. __Pyx_INCREF(__pyx__function);
  19725. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  19726. __pyx_t_7 = 0;
  19727. }
  19728. #endif
  19729. {
  19730. PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_s1x, __pyx_v_s2x};
  19731. __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));
  19732. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  19733. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  19734. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1182, __pyx_L1_error)
  19735. __Pyx_GOTREF(__pyx_t_1);
  19736. }
  19737. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1182, __pyx_L1_error)
  19738. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19739. __pyx_t_9 = (!__pyx_t_8);
  19740. __pyx_t_5 = __pyx_t_9;
  19741. __pyx_L12_bool_binop_done:;
  19742. /* "fontTools/misc/bezierTools.py":1181
  19743. * s2x, s2y = s2
  19744. * e2x, e2y = e2
  19745. * if ( # <<<<<<<<<<<<<<
  19746. * math.isclose(s2x, e2x) and math.isclose(s1x, e1x) and not math.isclose(s1x, s2x)
  19747. * ): # Parallel vertical
  19748. */
  19749. if (__pyx_t_5) {
  19750. /* "fontTools/misc/bezierTools.py":1184
  19751. * math.isclose(s2x, e2x) and math.isclose(s1x, e1x) and not math.isclose(s1x, s2x)
  19752. * ): # Parallel vertical
  19753. * return [] # <<<<<<<<<<<<<<
  19754. * if (
  19755. * math.isclose(s2y, e2y) and math.isclose(s1y, e1y) and not math.isclose(s1y, s2y)
  19756. */
  19757. __Pyx_XDECREF(__pyx_r);
  19758. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1184, __pyx_L1_error)
  19759. __Pyx_GOTREF(__pyx_t_1);
  19760. __pyx_r = __pyx_t_1;
  19761. __pyx_t_1 = 0;
  19762. goto __pyx_L0;
  19763. /* "fontTools/misc/bezierTools.py":1181
  19764. * s2x, s2y = s2
  19765. * e2x, e2y = e2
  19766. * if ( # <<<<<<<<<<<<<<
  19767. * math.isclose(s2x, e2x) and math.isclose(s1x, e1x) and not math.isclose(s1x, s2x)
  19768. * ): # Parallel vertical
  19769. */
  19770. }
  19771. /* "fontTools/misc/bezierTools.py":1186
  19772. * return []
  19773. * if (
  19774. * math.isclose(s2y, e2y) and math.isclose(s1y, e1y) and not math.isclose(s1y, s2y) # <<<<<<<<<<<<<<
  19775. * ): # Parallel horizontal
  19776. * return []
  19777. */
  19778. __pyx_t_2 = NULL;
  19779. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1186, __pyx_L1_error)
  19780. __Pyx_GOTREF(__pyx_t_3);
  19781. __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)
  19782. __Pyx_GOTREF(__pyx_t_6);
  19783. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19784. __pyx_t_7 = 1;
  19785. #if CYTHON_UNPACK_METHODS
  19786. if (unlikely(PyMethod_Check(__pyx_t_6))) {
  19787. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
  19788. assert(__pyx_t_2);
  19789. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
  19790. __Pyx_INCREF(__pyx_t_2);
  19791. __Pyx_INCREF(__pyx__function);
  19792. __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
  19793. __pyx_t_7 = 0;
  19794. }
  19795. #endif
  19796. {
  19797. PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_s2y, __pyx_v_e2y};
  19798. __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));
  19799. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  19800. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  19801. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1186, __pyx_L1_error)
  19802. __Pyx_GOTREF(__pyx_t_1);
  19803. }
  19804. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 1186, __pyx_L1_error)
  19805. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19806. if (__pyx_t_9) {
  19807. } else {
  19808. __pyx_t_5 = __pyx_t_9;
  19809. goto __pyx_L16_bool_binop_done;
  19810. }
  19811. __pyx_t_6 = NULL;
  19812. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1186, __pyx_L1_error)
  19813. __Pyx_GOTREF(__pyx_t_2);
  19814. __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)
  19815. __Pyx_GOTREF(__pyx_t_3);
  19816. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  19817. __pyx_t_7 = 1;
  19818. #if CYTHON_UNPACK_METHODS
  19819. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  19820. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
  19821. assert(__pyx_t_6);
  19822. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  19823. __Pyx_INCREF(__pyx_t_6);
  19824. __Pyx_INCREF(__pyx__function);
  19825. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  19826. __pyx_t_7 = 0;
  19827. }
  19828. #endif
  19829. {
  19830. PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_s1y, __pyx_v_e1y};
  19831. __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));
  19832. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  19833. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19834. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1186, __pyx_L1_error)
  19835. __Pyx_GOTREF(__pyx_t_1);
  19836. }
  19837. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 1186, __pyx_L1_error)
  19838. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19839. if (__pyx_t_9) {
  19840. } else {
  19841. __pyx_t_5 = __pyx_t_9;
  19842. goto __pyx_L16_bool_binop_done;
  19843. }
  19844. __pyx_t_3 = NULL;
  19845. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1186, __pyx_L1_error)
  19846. __Pyx_GOTREF(__pyx_t_6);
  19847. __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)
  19848. __Pyx_GOTREF(__pyx_t_2);
  19849. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  19850. __pyx_t_7 = 1;
  19851. #if CYTHON_UNPACK_METHODS
  19852. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  19853. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  19854. assert(__pyx_t_3);
  19855. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  19856. __Pyx_INCREF(__pyx_t_3);
  19857. __Pyx_INCREF(__pyx__function);
  19858. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  19859. __pyx_t_7 = 0;
  19860. }
  19861. #endif
  19862. {
  19863. PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_s1y, __pyx_v_s2y};
  19864. __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));
  19865. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  19866. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  19867. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1186, __pyx_L1_error)
  19868. __Pyx_GOTREF(__pyx_t_1);
  19869. }
  19870. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 1186, __pyx_L1_error)
  19871. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19872. __pyx_t_8 = (!__pyx_t_9);
  19873. __pyx_t_5 = __pyx_t_8;
  19874. __pyx_L16_bool_binop_done:;
  19875. /* "fontTools/misc/bezierTools.py":1185
  19876. * ): # Parallel vertical
  19877. * return []
  19878. * if ( # <<<<<<<<<<<<<<
  19879. * math.isclose(s2y, e2y) and math.isclose(s1y, e1y) and not math.isclose(s1y, s2y)
  19880. * ): # Parallel horizontal
  19881. */
  19882. if (__pyx_t_5) {
  19883. /* "fontTools/misc/bezierTools.py":1188
  19884. * math.isclose(s2y, e2y) and math.isclose(s1y, e1y) and not math.isclose(s1y, s2y)
  19885. * ): # Parallel horizontal
  19886. * return [] # <<<<<<<<<<<<<<
  19887. * if math.isclose(s2x, e2x) and math.isclose(s2y, e2y): # Line segment is tiny
  19888. * return []
  19889. */
  19890. __Pyx_XDECREF(__pyx_r);
  19891. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1188, __pyx_L1_error)
  19892. __Pyx_GOTREF(__pyx_t_1);
  19893. __pyx_r = __pyx_t_1;
  19894. __pyx_t_1 = 0;
  19895. goto __pyx_L0;
  19896. /* "fontTools/misc/bezierTools.py":1185
  19897. * ): # Parallel vertical
  19898. * return []
  19899. * if ( # <<<<<<<<<<<<<<
  19900. * math.isclose(s2y, e2y) and math.isclose(s1y, e1y) and not math.isclose(s1y, s2y)
  19901. * ): # Parallel horizontal
  19902. */
  19903. }
  19904. /* "fontTools/misc/bezierTools.py":1189
  19905. * ): # Parallel horizontal
  19906. * return []
  19907. * if math.isclose(s2x, e2x) and math.isclose(s2y, e2y): # Line segment is tiny # <<<<<<<<<<<<<<
  19908. * return []
  19909. * if math.isclose(s1x, e1x) and math.isclose(s1y, e1y): # Line segment is tiny
  19910. */
  19911. __pyx_t_2 = NULL;
  19912. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1189, __pyx_L1_error)
  19913. __Pyx_GOTREF(__pyx_t_3);
  19914. __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)
  19915. __Pyx_GOTREF(__pyx_t_6);
  19916. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19917. __pyx_t_7 = 1;
  19918. #if CYTHON_UNPACK_METHODS
  19919. if (unlikely(PyMethod_Check(__pyx_t_6))) {
  19920. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
  19921. assert(__pyx_t_2);
  19922. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
  19923. __Pyx_INCREF(__pyx_t_2);
  19924. __Pyx_INCREF(__pyx__function);
  19925. __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
  19926. __pyx_t_7 = 0;
  19927. }
  19928. #endif
  19929. {
  19930. PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_s2x, __pyx_v_e2x};
  19931. __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));
  19932. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  19933. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  19934. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1189, __pyx_L1_error)
  19935. __Pyx_GOTREF(__pyx_t_1);
  19936. }
  19937. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1189, __pyx_L1_error)
  19938. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19939. if (__pyx_t_8) {
  19940. } else {
  19941. __pyx_t_5 = __pyx_t_8;
  19942. goto __pyx_L20_bool_binop_done;
  19943. }
  19944. __pyx_t_6 = NULL;
  19945. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1189, __pyx_L1_error)
  19946. __Pyx_GOTREF(__pyx_t_2);
  19947. __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)
  19948. __Pyx_GOTREF(__pyx_t_3);
  19949. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  19950. __pyx_t_7 = 1;
  19951. #if CYTHON_UNPACK_METHODS
  19952. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  19953. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
  19954. assert(__pyx_t_6);
  19955. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  19956. __Pyx_INCREF(__pyx_t_6);
  19957. __Pyx_INCREF(__pyx__function);
  19958. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  19959. __pyx_t_7 = 0;
  19960. }
  19961. #endif
  19962. {
  19963. PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_s2y, __pyx_v_e2y};
  19964. __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));
  19965. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  19966. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  19967. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1189, __pyx_L1_error)
  19968. __Pyx_GOTREF(__pyx_t_1);
  19969. }
  19970. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1189, __pyx_L1_error)
  19971. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19972. __pyx_t_5 = __pyx_t_8;
  19973. __pyx_L20_bool_binop_done:;
  19974. if (__pyx_t_5) {
  19975. /* "fontTools/misc/bezierTools.py":1190
  19976. * return []
  19977. * if math.isclose(s2x, e2x) and math.isclose(s2y, e2y): # Line segment is tiny
  19978. * return [] # <<<<<<<<<<<<<<
  19979. * if math.isclose(s1x, e1x) and math.isclose(s1y, e1y): # Line segment is tiny
  19980. * return []
  19981. */
  19982. __Pyx_XDECREF(__pyx_r);
  19983. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1190, __pyx_L1_error)
  19984. __Pyx_GOTREF(__pyx_t_1);
  19985. __pyx_r = __pyx_t_1;
  19986. __pyx_t_1 = 0;
  19987. goto __pyx_L0;
  19988. /* "fontTools/misc/bezierTools.py":1189
  19989. * ): # Parallel horizontal
  19990. * return []
  19991. * if math.isclose(s2x, e2x) and math.isclose(s2y, e2y): # Line segment is tiny # <<<<<<<<<<<<<<
  19992. * return []
  19993. * if math.isclose(s1x, e1x) and math.isclose(s1y, e1y): # Line segment is tiny
  19994. */
  19995. }
  19996. /* "fontTools/misc/bezierTools.py":1191
  19997. * if math.isclose(s2x, e2x) and math.isclose(s2y, e2y): # Line segment is tiny
  19998. * return []
  19999. * if math.isclose(s1x, e1x) and math.isclose(s1y, e1y): # Line segment is tiny # <<<<<<<<<<<<<<
  20000. * return []
  20001. * if math.isclose(e1x, s1x):
  20002. */
  20003. __pyx_t_3 = NULL;
  20004. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1191, __pyx_L1_error)
  20005. __Pyx_GOTREF(__pyx_t_6);
  20006. __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)
  20007. __Pyx_GOTREF(__pyx_t_2);
  20008. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20009. __pyx_t_7 = 1;
  20010. #if CYTHON_UNPACK_METHODS
  20011. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  20012. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  20013. assert(__pyx_t_3);
  20014. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  20015. __Pyx_INCREF(__pyx_t_3);
  20016. __Pyx_INCREF(__pyx__function);
  20017. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  20018. __pyx_t_7 = 0;
  20019. }
  20020. #endif
  20021. {
  20022. PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_v_s1x, __pyx_v_e1x};
  20023. __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));
  20024. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  20025. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  20026. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1191, __pyx_L1_error)
  20027. __Pyx_GOTREF(__pyx_t_1);
  20028. }
  20029. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1191, __pyx_L1_error)
  20030. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20031. if (__pyx_t_8) {
  20032. } else {
  20033. __pyx_t_5 = __pyx_t_8;
  20034. goto __pyx_L23_bool_binop_done;
  20035. }
  20036. __pyx_t_2 = NULL;
  20037. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1191, __pyx_L1_error)
  20038. __Pyx_GOTREF(__pyx_t_3);
  20039. __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)
  20040. __Pyx_GOTREF(__pyx_t_6);
  20041. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20042. __pyx_t_7 = 1;
  20043. #if CYTHON_UNPACK_METHODS
  20044. if (unlikely(PyMethod_Check(__pyx_t_6))) {
  20045. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
  20046. assert(__pyx_t_2);
  20047. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
  20048. __Pyx_INCREF(__pyx_t_2);
  20049. __Pyx_INCREF(__pyx__function);
  20050. __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
  20051. __pyx_t_7 = 0;
  20052. }
  20053. #endif
  20054. {
  20055. PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_s1y, __pyx_v_e1y};
  20056. __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));
  20057. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  20058. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20059. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1191, __pyx_L1_error)
  20060. __Pyx_GOTREF(__pyx_t_1);
  20061. }
  20062. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1191, __pyx_L1_error)
  20063. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20064. __pyx_t_5 = __pyx_t_8;
  20065. __pyx_L23_bool_binop_done:;
  20066. if (__pyx_t_5) {
  20067. /* "fontTools/misc/bezierTools.py":1192
  20068. * return []
  20069. * if math.isclose(s1x, e1x) and math.isclose(s1y, e1y): # Line segment is tiny
  20070. * return [] # <<<<<<<<<<<<<<
  20071. * if math.isclose(e1x, s1x):
  20072. * x = s1x
  20073. */
  20074. __Pyx_XDECREF(__pyx_r);
  20075. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1192, __pyx_L1_error)
  20076. __Pyx_GOTREF(__pyx_t_1);
  20077. __pyx_r = __pyx_t_1;
  20078. __pyx_t_1 = 0;
  20079. goto __pyx_L0;
  20080. /* "fontTools/misc/bezierTools.py":1191
  20081. * if math.isclose(s2x, e2x) and math.isclose(s2y, e2y): # Line segment is tiny
  20082. * return []
  20083. * if math.isclose(s1x, e1x) and math.isclose(s1y, e1y): # Line segment is tiny # <<<<<<<<<<<<<<
  20084. * return []
  20085. * if math.isclose(e1x, s1x):
  20086. */
  20087. }
  20088. /* "fontTools/misc/bezierTools.py":1193
  20089. * if math.isclose(s1x, e1x) and math.isclose(s1y, e1y): # Line segment is tiny
  20090. * return []
  20091. * if math.isclose(e1x, s1x): # <<<<<<<<<<<<<<
  20092. * x = s1x
  20093. * slope34 = (e2y - s2y) / (e2x - s2x)
  20094. */
  20095. __pyx_t_6 = NULL;
  20096. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1193, __pyx_L1_error)
  20097. __Pyx_GOTREF(__pyx_t_2);
  20098. __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)
  20099. __Pyx_GOTREF(__pyx_t_3);
  20100. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  20101. __pyx_t_7 = 1;
  20102. #if CYTHON_UNPACK_METHODS
  20103. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  20104. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
  20105. assert(__pyx_t_6);
  20106. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  20107. __Pyx_INCREF(__pyx_t_6);
  20108. __Pyx_INCREF(__pyx__function);
  20109. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  20110. __pyx_t_7 = 0;
  20111. }
  20112. #endif
  20113. {
  20114. PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_e1x, __pyx_v_s1x};
  20115. __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));
  20116. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  20117. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20118. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1193, __pyx_L1_error)
  20119. __Pyx_GOTREF(__pyx_t_1);
  20120. }
  20121. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1193, __pyx_L1_error)
  20122. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20123. if (__pyx_t_5) {
  20124. /* "fontTools/misc/bezierTools.py":1194
  20125. * return []
  20126. * if math.isclose(e1x, s1x):
  20127. * x = s1x # <<<<<<<<<<<<<<
  20128. * slope34 = (e2y - s2y) / (e2x - s2x)
  20129. * y = slope34 * (x - s2x) + s2y
  20130. */
  20131. __Pyx_INCREF(__pyx_v_s1x);
  20132. __pyx_v_x = __pyx_v_s1x;
  20133. /* "fontTools/misc/bezierTools.py":1195
  20134. * if math.isclose(e1x, s1x):
  20135. * x = s1x
  20136. * slope34 = (e2y - s2y) / (e2x - s2x) # <<<<<<<<<<<<<<
  20137. * y = slope34 * (x - s2x) + s2y
  20138. * pt = (x, y)
  20139. */
  20140. __pyx_t_1 = PyNumber_Subtract(__pyx_v_e2y, __pyx_v_s2y); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1195, __pyx_L1_error)
  20141. __Pyx_GOTREF(__pyx_t_1);
  20142. __pyx_t_3 = PyNumber_Subtract(__pyx_v_e2x, __pyx_v_s2x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1195, __pyx_L1_error)
  20143. __Pyx_GOTREF(__pyx_t_3);
  20144. __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1195, __pyx_L1_error)
  20145. __Pyx_GOTREF(__pyx_t_6);
  20146. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20147. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20148. __pyx_v_slope34 = __pyx_t_6;
  20149. __pyx_t_6 = 0;
  20150. /* "fontTools/misc/bezierTools.py":1196
  20151. * x = s1x
  20152. * slope34 = (e2y - s2y) / (e2x - s2x)
  20153. * y = slope34 * (x - s2x) + s2y # <<<<<<<<<<<<<<
  20154. * pt = (x, y)
  20155. * return [
  20156. */
  20157. __pyx_t_6 = PyNumber_Subtract(__pyx_v_x, __pyx_v_s2x); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1196, __pyx_L1_error)
  20158. __Pyx_GOTREF(__pyx_t_6);
  20159. __pyx_t_3 = PyNumber_Multiply(__pyx_v_slope34, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1196, __pyx_L1_error)
  20160. __Pyx_GOTREF(__pyx_t_3);
  20161. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20162. __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_v_s2y); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1196, __pyx_L1_error)
  20163. __Pyx_GOTREF(__pyx_t_6);
  20164. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20165. __pyx_v_y = __pyx_t_6;
  20166. __pyx_t_6 = 0;
  20167. /* "fontTools/misc/bezierTools.py":1197
  20168. * slope34 = (e2y - s2y) / (e2x - s2x)
  20169. * y = slope34 * (x - s2x) + s2y
  20170. * pt = (x, y) # <<<<<<<<<<<<<<
  20171. * return [
  20172. * Intersection(
  20173. */
  20174. __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1197, __pyx_L1_error)
  20175. __Pyx_GOTREF(__pyx_t_6);
  20176. __Pyx_INCREF(__pyx_v_x);
  20177. __Pyx_GIVEREF(__pyx_v_x);
  20178. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_x) != (0)) __PYX_ERR(0, 1197, __pyx_L1_error);
  20179. __Pyx_INCREF(__pyx_v_y);
  20180. __Pyx_GIVEREF(__pyx_v_y);
  20181. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_y) != (0)) __PYX_ERR(0, 1197, __pyx_L1_error);
  20182. __pyx_v_pt = ((PyObject*)__pyx_t_6);
  20183. __pyx_t_6 = 0;
  20184. /* "fontTools/misc/bezierTools.py":1198
  20185. * y = slope34 * (x - s2x) + s2y
  20186. * pt = (x, y)
  20187. * return [ # <<<<<<<<<<<<<<
  20188. * Intersection(
  20189. * pt=pt, t1=_line_t_of_pt(s1, e1, pt), t2=_line_t_of_pt(s2, e2, pt)
  20190. */
  20191. __Pyx_XDECREF(__pyx_r);
  20192. /* "fontTools/misc/bezierTools.py":1199
  20193. * pt = (x, y)
  20194. * return [
  20195. * Intersection( # <<<<<<<<<<<<<<
  20196. * pt=pt, t1=_line_t_of_pt(s1, e1, pt), t2=_line_t_of_pt(s2, e2, pt)
  20197. * )
  20198. */
  20199. __pyx_t_3 = NULL;
  20200. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Intersection); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1199, __pyx_L1_error)
  20201. __Pyx_GOTREF(__pyx_t_1);
  20202. /* "fontTools/misc/bezierTools.py":1200
  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. */
  20209. __pyx_t_10 = NULL;
  20210. __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)
  20211. __Pyx_GOTREF(__pyx_t_11);
  20212. __pyx_t_7 = 1;
  20213. #if CYTHON_UNPACK_METHODS
  20214. if (unlikely(PyMethod_Check(__pyx_t_11))) {
  20215. __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_11);
  20216. assert(__pyx_t_10);
  20217. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
  20218. __Pyx_INCREF(__pyx_t_10);
  20219. __Pyx_INCREF(__pyx__function);
  20220. __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
  20221. __pyx_t_7 = 0;
  20222. }
  20223. #endif
  20224. {
  20225. PyObject *__pyx_callargs[4] = {__pyx_t_10, __pyx_v_s1, __pyx_v_e1, __pyx_v_pt};
  20226. __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));
  20227. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  20228. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  20229. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1200, __pyx_L1_error)
  20230. __Pyx_GOTREF(__pyx_t_2);
  20231. }
  20232. __pyx_t_10 = NULL;
  20233. __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)
  20234. __Pyx_GOTREF(__pyx_t_12);
  20235. __pyx_t_7 = 1;
  20236. #if CYTHON_UNPACK_METHODS
  20237. if (unlikely(PyMethod_Check(__pyx_t_12))) {
  20238. __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_12);
  20239. assert(__pyx_t_10);
  20240. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_12);
  20241. __Pyx_INCREF(__pyx_t_10);
  20242. __Pyx_INCREF(__pyx__function);
  20243. __Pyx_DECREF_SET(__pyx_t_12, __pyx__function);
  20244. __pyx_t_7 = 0;
  20245. }
  20246. #endif
  20247. {
  20248. PyObject *__pyx_callargs[4] = {__pyx_t_10, __pyx_v_s2, __pyx_v_e2, __pyx_v_pt};
  20249. __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));
  20250. __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
  20251. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  20252. if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1200, __pyx_L1_error)
  20253. __Pyx_GOTREF(__pyx_t_11);
  20254. }
  20255. __pyx_t_7 = 1;
  20256. #if CYTHON_UNPACK_METHODS
  20257. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  20258. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
  20259. assert(__pyx_t_3);
  20260. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  20261. __Pyx_INCREF(__pyx_t_3);
  20262. __Pyx_INCREF(__pyx__function);
  20263. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  20264. __pyx_t_7 = 0;
  20265. }
  20266. #endif
  20267. {
  20268. PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_3, NULL};
  20269. __pyx_t_12 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1199, __pyx_L1_error)
  20270. __Pyx_GOTREF(__pyx_t_12);
  20271. 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)
  20272. 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)
  20273. 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)
  20274. __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);
  20275. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  20276. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  20277. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  20278. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  20279. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20280. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1199, __pyx_L1_error)
  20281. __Pyx_GOTREF(__pyx_t_6);
  20282. }
  20283. /* "fontTools/misc/bezierTools.py":1198
  20284. * y = slope34 * (x - s2x) + s2y
  20285. * pt = (x, y)
  20286. * return [ # <<<<<<<<<<<<<<
  20287. * Intersection(
  20288. * pt=pt, t1=_line_t_of_pt(s1, e1, pt), t2=_line_t_of_pt(s2, e2, pt)
  20289. */
  20290. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1198, __pyx_L1_error)
  20291. __Pyx_GOTREF(__pyx_t_1);
  20292. __Pyx_GIVEREF(__pyx_t_6);
  20293. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 1198, __pyx_L1_error);
  20294. __pyx_t_6 = 0;
  20295. __pyx_r = __pyx_t_1;
  20296. __pyx_t_1 = 0;
  20297. goto __pyx_L0;
  20298. /* "fontTools/misc/bezierTools.py":1193
  20299. * if math.isclose(s1x, e1x) and math.isclose(s1y, e1y): # Line segment is tiny
  20300. * return []
  20301. * if math.isclose(e1x, s1x): # <<<<<<<<<<<<<<
  20302. * x = s1x
  20303. * slope34 = (e2y - s2y) / (e2x - s2x)
  20304. */
  20305. }
  20306. /* "fontTools/misc/bezierTools.py":1203
  20307. * )
  20308. * ]
  20309. * if math.isclose(s2x, e2x): # <<<<<<<<<<<<<<
  20310. * x = s2x
  20311. * slope12 = (e1y - s1y) / (e1x - s1x)
  20312. */
  20313. __pyx_t_6 = NULL;
  20314. __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1203, __pyx_L1_error)
  20315. __Pyx_GOTREF(__pyx_t_12);
  20316. __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)
  20317. __Pyx_GOTREF(__pyx_t_11);
  20318. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  20319. __pyx_t_7 = 1;
  20320. #if CYTHON_UNPACK_METHODS
  20321. if (unlikely(PyMethod_Check(__pyx_t_11))) {
  20322. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_11);
  20323. assert(__pyx_t_6);
  20324. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
  20325. __Pyx_INCREF(__pyx_t_6);
  20326. __Pyx_INCREF(__pyx__function);
  20327. __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
  20328. __pyx_t_7 = 0;
  20329. }
  20330. #endif
  20331. {
  20332. PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_s2x, __pyx_v_e2x};
  20333. __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));
  20334. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  20335. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  20336. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1203, __pyx_L1_error)
  20337. __Pyx_GOTREF(__pyx_t_1);
  20338. }
  20339. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1203, __pyx_L1_error)
  20340. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20341. if (__pyx_t_5) {
  20342. /* "fontTools/misc/bezierTools.py":1204
  20343. * ]
  20344. * if math.isclose(s2x, e2x):
  20345. * x = s2x # <<<<<<<<<<<<<<
  20346. * slope12 = (e1y - s1y) / (e1x - s1x)
  20347. * y = slope12 * (x - s1x) + s1y
  20348. */
  20349. __Pyx_INCREF(__pyx_v_s2x);
  20350. __pyx_v_x = __pyx_v_s2x;
  20351. /* "fontTools/misc/bezierTools.py":1205
  20352. * if math.isclose(s2x, e2x):
  20353. * x = s2x
  20354. * slope12 = (e1y - s1y) / (e1x - s1x) # <<<<<<<<<<<<<<
  20355. * y = slope12 * (x - s1x) + s1y
  20356. * pt = (x, y)
  20357. */
  20358. __pyx_t_1 = PyNumber_Subtract(__pyx_v_e1y, __pyx_v_s1y); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1205, __pyx_L1_error)
  20359. __Pyx_GOTREF(__pyx_t_1);
  20360. __pyx_t_11 = PyNumber_Subtract(__pyx_v_e1x, __pyx_v_s1x); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1205, __pyx_L1_error)
  20361. __Pyx_GOTREF(__pyx_t_11);
  20362. __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1205, __pyx_L1_error)
  20363. __Pyx_GOTREF(__pyx_t_6);
  20364. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20365. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  20366. __pyx_v_slope12 = __pyx_t_6;
  20367. __pyx_t_6 = 0;
  20368. /* "fontTools/misc/bezierTools.py":1206
  20369. * x = s2x
  20370. * slope12 = (e1y - s1y) / (e1x - s1x)
  20371. * y = slope12 * (x - s1x) + s1y # <<<<<<<<<<<<<<
  20372. * pt = (x, y)
  20373. * return [
  20374. */
  20375. __pyx_t_6 = PyNumber_Subtract(__pyx_v_x, __pyx_v_s1x); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1206, __pyx_L1_error)
  20376. __Pyx_GOTREF(__pyx_t_6);
  20377. __pyx_t_11 = PyNumber_Multiply(__pyx_v_slope12, __pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1206, __pyx_L1_error)
  20378. __Pyx_GOTREF(__pyx_t_11);
  20379. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20380. __pyx_t_6 = PyNumber_Add(__pyx_t_11, __pyx_v_s1y); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1206, __pyx_L1_error)
  20381. __Pyx_GOTREF(__pyx_t_6);
  20382. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  20383. __pyx_v_y = __pyx_t_6;
  20384. __pyx_t_6 = 0;
  20385. /* "fontTools/misc/bezierTools.py":1207
  20386. * slope12 = (e1y - s1y) / (e1x - s1x)
  20387. * y = slope12 * (x - s1x) + s1y
  20388. * pt = (x, y) # <<<<<<<<<<<<<<
  20389. * return [
  20390. * Intersection(
  20391. */
  20392. __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1207, __pyx_L1_error)
  20393. __Pyx_GOTREF(__pyx_t_6);
  20394. __Pyx_INCREF(__pyx_v_x);
  20395. __Pyx_GIVEREF(__pyx_v_x);
  20396. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_x) != (0)) __PYX_ERR(0, 1207, __pyx_L1_error);
  20397. __Pyx_INCREF(__pyx_v_y);
  20398. __Pyx_GIVEREF(__pyx_v_y);
  20399. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_y) != (0)) __PYX_ERR(0, 1207, __pyx_L1_error);
  20400. __pyx_v_pt = ((PyObject*)__pyx_t_6);
  20401. __pyx_t_6 = 0;
  20402. /* "fontTools/misc/bezierTools.py":1208
  20403. * y = slope12 * (x - s1x) + s1y
  20404. * pt = (x, y)
  20405. * return [ # <<<<<<<<<<<<<<
  20406. * Intersection(
  20407. * pt=pt, t1=_line_t_of_pt(s1, e1, pt), t2=_line_t_of_pt(s2, e2, pt)
  20408. */
  20409. __Pyx_XDECREF(__pyx_r);
  20410. /* "fontTools/misc/bezierTools.py":1209
  20411. * pt = (x, y)
  20412. * return [
  20413. * Intersection( # <<<<<<<<<<<<<<
  20414. * pt=pt, t1=_line_t_of_pt(s1, e1, pt), t2=_line_t_of_pt(s2, e2, pt)
  20415. * )
  20416. */
  20417. __pyx_t_11 = NULL;
  20418. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Intersection); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1209, __pyx_L1_error)
  20419. __Pyx_GOTREF(__pyx_t_1);
  20420. /* "fontTools/misc/bezierTools.py":1210
  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. */
  20427. __pyx_t_2 = NULL;
  20428. __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)
  20429. __Pyx_GOTREF(__pyx_t_3);
  20430. __pyx_t_7 = 1;
  20431. #if CYTHON_UNPACK_METHODS
  20432. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  20433. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  20434. assert(__pyx_t_2);
  20435. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  20436. __Pyx_INCREF(__pyx_t_2);
  20437. __Pyx_INCREF(__pyx__function);
  20438. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  20439. __pyx_t_7 = 0;
  20440. }
  20441. #endif
  20442. {
  20443. PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_s1, __pyx_v_e1, __pyx_v_pt};
  20444. __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));
  20445. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  20446. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20447. if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1210, __pyx_L1_error)
  20448. __Pyx_GOTREF(__pyx_t_12);
  20449. }
  20450. __pyx_t_2 = NULL;
  20451. __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)
  20452. __Pyx_GOTREF(__pyx_t_10);
  20453. __pyx_t_7 = 1;
  20454. #if CYTHON_UNPACK_METHODS
  20455. if (unlikely(PyMethod_Check(__pyx_t_10))) {
  20456. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10);
  20457. assert(__pyx_t_2);
  20458. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_10);
  20459. __Pyx_INCREF(__pyx_t_2);
  20460. __Pyx_INCREF(__pyx__function);
  20461. __Pyx_DECREF_SET(__pyx_t_10, __pyx__function);
  20462. __pyx_t_7 = 0;
  20463. }
  20464. #endif
  20465. {
  20466. PyObject *__pyx_callargs[4] = {__pyx_t_2, __pyx_v_s2, __pyx_v_e2, __pyx_v_pt};
  20467. __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));
  20468. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  20469. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  20470. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1210, __pyx_L1_error)
  20471. __Pyx_GOTREF(__pyx_t_3);
  20472. }
  20473. __pyx_t_7 = 1;
  20474. #if CYTHON_UNPACK_METHODS
  20475. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  20476. __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_1);
  20477. assert(__pyx_t_11);
  20478. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  20479. __Pyx_INCREF(__pyx_t_11);
  20480. __Pyx_INCREF(__pyx__function);
  20481. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  20482. __pyx_t_7 = 0;
  20483. }
  20484. #endif
  20485. {
  20486. PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_11, NULL};
  20487. __pyx_t_10 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1209, __pyx_L1_error)
  20488. __Pyx_GOTREF(__pyx_t_10);
  20489. 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)
  20490. 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)
  20491. 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)
  20492. __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);
  20493. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  20494. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  20495. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20496. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  20497. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20498. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1209, __pyx_L1_error)
  20499. __Pyx_GOTREF(__pyx_t_6);
  20500. }
  20501. /* "fontTools/misc/bezierTools.py":1208
  20502. * y = slope12 * (x - s1x) + s1y
  20503. * pt = (x, y)
  20504. * return [ # <<<<<<<<<<<<<<
  20505. * Intersection(
  20506. * pt=pt, t1=_line_t_of_pt(s1, e1, pt), t2=_line_t_of_pt(s2, e2, pt)
  20507. */
  20508. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1208, __pyx_L1_error)
  20509. __Pyx_GOTREF(__pyx_t_1);
  20510. __Pyx_GIVEREF(__pyx_t_6);
  20511. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 1208, __pyx_L1_error);
  20512. __pyx_t_6 = 0;
  20513. __pyx_r = __pyx_t_1;
  20514. __pyx_t_1 = 0;
  20515. goto __pyx_L0;
  20516. /* "fontTools/misc/bezierTools.py":1203
  20517. * )
  20518. * ]
  20519. * if math.isclose(s2x, e2x): # <<<<<<<<<<<<<<
  20520. * x = s2x
  20521. * slope12 = (e1y - s1y) / (e1x - s1x)
  20522. */
  20523. }
  20524. /* "fontTools/misc/bezierTools.py":1214
  20525. * ]
  20526. *
  20527. * slope12 = (e1y - s1y) / (e1x - s1x) # <<<<<<<<<<<<<<
  20528. * slope34 = (e2y - s2y) / (e2x - s2x)
  20529. * if math.isclose(slope12, slope34):
  20530. */
  20531. __pyx_t_1 = PyNumber_Subtract(__pyx_v_e1y, __pyx_v_s1y); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1214, __pyx_L1_error)
  20532. __Pyx_GOTREF(__pyx_t_1);
  20533. __pyx_t_6 = PyNumber_Subtract(__pyx_v_e1x, __pyx_v_s1x); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1214, __pyx_L1_error)
  20534. __Pyx_GOTREF(__pyx_t_6);
  20535. __pyx_t_10 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1214, __pyx_L1_error)
  20536. __Pyx_GOTREF(__pyx_t_10);
  20537. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20538. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20539. __pyx_v_slope12 = __pyx_t_10;
  20540. __pyx_t_10 = 0;
  20541. /* "fontTools/misc/bezierTools.py":1215
  20542. *
  20543. * slope12 = (e1y - s1y) / (e1x - s1x)
  20544. * slope34 = (e2y - s2y) / (e2x - s2x) # <<<<<<<<<<<<<<
  20545. * if math.isclose(slope12, slope34):
  20546. * return []
  20547. */
  20548. __pyx_t_10 = PyNumber_Subtract(__pyx_v_e2y, __pyx_v_s2y); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1215, __pyx_L1_error)
  20549. __Pyx_GOTREF(__pyx_t_10);
  20550. __pyx_t_6 = PyNumber_Subtract(__pyx_v_e2x, __pyx_v_s2x); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1215, __pyx_L1_error)
  20551. __Pyx_GOTREF(__pyx_t_6);
  20552. __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_10, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1215, __pyx_L1_error)
  20553. __Pyx_GOTREF(__pyx_t_1);
  20554. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  20555. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20556. __pyx_v_slope34 = __pyx_t_1;
  20557. __pyx_t_1 = 0;
  20558. /* "fontTools/misc/bezierTools.py":1216
  20559. * slope12 = (e1y - s1y) / (e1x - s1x)
  20560. * slope34 = (e2y - s2y) / (e2x - s2x)
  20561. * if math.isclose(slope12, slope34): # <<<<<<<<<<<<<<
  20562. * return []
  20563. * x = (slope12 * s1x - s1y - slope34 * s2x + s2y) / (slope12 - slope34)
  20564. */
  20565. __pyx_t_6 = NULL;
  20566. __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1216, __pyx_L1_error)
  20567. __Pyx_GOTREF(__pyx_t_10);
  20568. __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)
  20569. __Pyx_GOTREF(__pyx_t_3);
  20570. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  20571. __pyx_t_7 = 1;
  20572. #if CYTHON_UNPACK_METHODS
  20573. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  20574. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
  20575. assert(__pyx_t_6);
  20576. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  20577. __Pyx_INCREF(__pyx_t_6);
  20578. __Pyx_INCREF(__pyx__function);
  20579. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  20580. __pyx_t_7 = 0;
  20581. }
  20582. #endif
  20583. {
  20584. PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_v_slope12, __pyx_v_slope34};
  20585. __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));
  20586. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  20587. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20588. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1216, __pyx_L1_error)
  20589. __Pyx_GOTREF(__pyx_t_1);
  20590. }
  20591. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1216, __pyx_L1_error)
  20592. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20593. if (__pyx_t_5) {
  20594. /* "fontTools/misc/bezierTools.py":1217
  20595. * slope34 = (e2y - s2y) / (e2x - s2x)
  20596. * if math.isclose(slope12, slope34):
  20597. * return [] # <<<<<<<<<<<<<<
  20598. * x = (slope12 * s1x - s1y - slope34 * s2x + s2y) / (slope12 - slope34)
  20599. * y = slope12 * (x - s1x) + s1y
  20600. */
  20601. __Pyx_XDECREF(__pyx_r);
  20602. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1217, __pyx_L1_error)
  20603. __Pyx_GOTREF(__pyx_t_1);
  20604. __pyx_r = __pyx_t_1;
  20605. __pyx_t_1 = 0;
  20606. goto __pyx_L0;
  20607. /* "fontTools/misc/bezierTools.py":1216
  20608. * slope12 = (e1y - s1y) / (e1x - s1x)
  20609. * slope34 = (e2y - s2y) / (e2x - s2x)
  20610. * if math.isclose(slope12, slope34): # <<<<<<<<<<<<<<
  20611. * return []
  20612. * x = (slope12 * s1x - s1y - slope34 * s2x + s2y) / (slope12 - slope34)
  20613. */
  20614. }
  20615. /* "fontTools/misc/bezierTools.py":1218
  20616. * if math.isclose(slope12, slope34):
  20617. * return []
  20618. * x = (slope12 * s1x - s1y - slope34 * s2x + s2y) / (slope12 - slope34) # <<<<<<<<<<<<<<
  20619. * y = slope12 * (x - s1x) + s1y
  20620. * pt = (x, y)
  20621. */
  20622. __pyx_t_1 = PyNumber_Multiply(__pyx_v_slope12, __pyx_v_s1x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1218, __pyx_L1_error)
  20623. __Pyx_GOTREF(__pyx_t_1);
  20624. __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_v_s1y); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1218, __pyx_L1_error)
  20625. __Pyx_GOTREF(__pyx_t_3);
  20626. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20627. __pyx_t_1 = PyNumber_Multiply(__pyx_v_slope34, __pyx_v_s2x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1218, __pyx_L1_error)
  20628. __Pyx_GOTREF(__pyx_t_1);
  20629. __pyx_t_6 = PyNumber_Subtract(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1218, __pyx_L1_error)
  20630. __Pyx_GOTREF(__pyx_t_6);
  20631. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20632. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20633. __pyx_t_1 = PyNumber_Add(__pyx_t_6, __pyx_v_s2y); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1218, __pyx_L1_error)
  20634. __Pyx_GOTREF(__pyx_t_1);
  20635. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20636. __pyx_t_6 = PyNumber_Subtract(__pyx_v_slope12, __pyx_v_slope34); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1218, __pyx_L1_error)
  20637. __Pyx_GOTREF(__pyx_t_6);
  20638. __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1218, __pyx_L1_error)
  20639. __Pyx_GOTREF(__pyx_t_3);
  20640. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20641. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20642. __pyx_v_x = __pyx_t_3;
  20643. __pyx_t_3 = 0;
  20644. /* "fontTools/misc/bezierTools.py":1219
  20645. * return []
  20646. * x = (slope12 * s1x - s1y - slope34 * s2x + s2y) / (slope12 - slope34)
  20647. * y = slope12 * (x - s1x) + s1y # <<<<<<<<<<<<<<
  20648. * pt = (x, y)
  20649. * if _both_points_are_on_same_side_of_origin(
  20650. */
  20651. __pyx_t_3 = PyNumber_Subtract(__pyx_v_x, __pyx_v_s1x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1219, __pyx_L1_error)
  20652. __Pyx_GOTREF(__pyx_t_3);
  20653. __pyx_t_6 = PyNumber_Multiply(__pyx_v_slope12, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1219, __pyx_L1_error)
  20654. __Pyx_GOTREF(__pyx_t_6);
  20655. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20656. __pyx_t_3 = PyNumber_Add(__pyx_t_6, __pyx_v_s1y); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1219, __pyx_L1_error)
  20657. __Pyx_GOTREF(__pyx_t_3);
  20658. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20659. __pyx_v_y = __pyx_t_3;
  20660. __pyx_t_3 = 0;
  20661. /* "fontTools/misc/bezierTools.py":1220
  20662. * x = (slope12 * s1x - s1y - slope34 * s2x + s2y) / (slope12 - slope34)
  20663. * y = slope12 * (x - s1x) + s1y
  20664. * pt = (x, y) # <<<<<<<<<<<<<<
  20665. * if _both_points_are_on_same_side_of_origin(
  20666. * pt, e1, s1
  20667. */
  20668. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1220, __pyx_L1_error)
  20669. __Pyx_GOTREF(__pyx_t_3);
  20670. __Pyx_INCREF(__pyx_v_x);
  20671. __Pyx_GIVEREF(__pyx_v_x);
  20672. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x) != (0)) __PYX_ERR(0, 1220, __pyx_L1_error);
  20673. __Pyx_INCREF(__pyx_v_y);
  20674. __Pyx_GIVEREF(__pyx_v_y);
  20675. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_y) != (0)) __PYX_ERR(0, 1220, __pyx_L1_error);
  20676. __pyx_v_pt = ((PyObject*)__pyx_t_3);
  20677. __pyx_t_3 = 0;
  20678. /* "fontTools/misc/bezierTools.py":1221
  20679. * y = slope12 * (x - s1x) + s1y
  20680. * pt = (x, y)
  20681. * if _both_points_are_on_same_side_of_origin( # <<<<<<<<<<<<<<
  20682. * pt, e1, s1
  20683. * ) and _both_points_are_on_same_side_of_origin(pt, s2, e2):
  20684. */
  20685. __pyx_t_6 = NULL;
  20686. __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)
  20687. __Pyx_GOTREF(__pyx_t_1);
  20688. /* "fontTools/misc/bezierTools.py":1222
  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. * return [
  20694. */
  20695. __pyx_t_7 = 1;
  20696. #if CYTHON_UNPACK_METHODS
  20697. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  20698. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
  20699. assert(__pyx_t_6);
  20700. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  20701. __Pyx_INCREF(__pyx_t_6);
  20702. __Pyx_INCREF(__pyx__function);
  20703. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  20704. __pyx_t_7 = 0;
  20705. }
  20706. #endif
  20707. {
  20708. PyObject *__pyx_callargs[4] = {__pyx_t_6, __pyx_v_pt, __pyx_v_e1, __pyx_v_s1};
  20709. __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));
  20710. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  20711. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20712. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1221, __pyx_L1_error)
  20713. __Pyx_GOTREF(__pyx_t_3);
  20714. }
  20715. /* "fontTools/misc/bezierTools.py":1221
  20716. * y = slope12 * (x - s1x) + s1y
  20717. * pt = (x, y)
  20718. * if _both_points_are_on_same_side_of_origin( # <<<<<<<<<<<<<<
  20719. * pt, e1, s1
  20720. * ) and _both_points_are_on_same_side_of_origin(pt, s2, e2):
  20721. */
  20722. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1221, __pyx_L1_error)
  20723. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20724. if (__pyx_t_8) {
  20725. } else {
  20726. __pyx_t_5 = __pyx_t_8;
  20727. goto __pyx_L29_bool_binop_done;
  20728. }
  20729. /* "fontTools/misc/bezierTools.py":1223
  20730. * if _both_points_are_on_same_side_of_origin(
  20731. * pt, e1, s1
  20732. * ) and _both_points_are_on_same_side_of_origin(pt, s2, e2): # <<<<<<<<<<<<<<
  20733. * return [
  20734. * Intersection(
  20735. */
  20736. __pyx_t_1 = NULL;
  20737. __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)
  20738. __Pyx_GOTREF(__pyx_t_6);
  20739. __pyx_t_7 = 1;
  20740. #if CYTHON_UNPACK_METHODS
  20741. if (unlikely(PyMethod_Check(__pyx_t_6))) {
  20742. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
  20743. assert(__pyx_t_1);
  20744. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
  20745. __Pyx_INCREF(__pyx_t_1);
  20746. __Pyx_INCREF(__pyx__function);
  20747. __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
  20748. __pyx_t_7 = 0;
  20749. }
  20750. #endif
  20751. {
  20752. PyObject *__pyx_callargs[4] = {__pyx_t_1, __pyx_v_pt, __pyx_v_s2, __pyx_v_e2};
  20753. __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));
  20754. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  20755. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  20756. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1223, __pyx_L1_error)
  20757. __Pyx_GOTREF(__pyx_t_3);
  20758. }
  20759. __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1223, __pyx_L1_error)
  20760. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  20761. __pyx_t_5 = __pyx_t_8;
  20762. __pyx_L29_bool_binop_done:;
  20763. /* "fontTools/misc/bezierTools.py":1221
  20764. * y = slope12 * (x - s1x) + s1y
  20765. * pt = (x, y)
  20766. * if _both_points_are_on_same_side_of_origin( # <<<<<<<<<<<<<<
  20767. * pt, e1, s1
  20768. * ) and _both_points_are_on_same_side_of_origin(pt, s2, e2):
  20769. */
  20770. if (__pyx_t_5) {
  20771. /* "fontTools/misc/bezierTools.py":1224
  20772. * pt, e1, s1
  20773. * ) and _both_points_are_on_same_side_of_origin(pt, s2, e2):
  20774. * return [ # <<<<<<<<<<<<<<
  20775. * Intersection(
  20776. * pt=pt, t1=_line_t_of_pt(s1, e1, pt), t2=_line_t_of_pt(s2, e2, pt)
  20777. */
  20778. __Pyx_XDECREF(__pyx_r);
  20779. /* "fontTools/misc/bezierTools.py":1225
  20780. * ) and _both_points_are_on_same_side_of_origin(pt, s2, e2):
  20781. * return [
  20782. * Intersection( # <<<<<<<<<<<<<<
  20783. * pt=pt, t1=_line_t_of_pt(s1, e1, pt), t2=_line_t_of_pt(s2, e2, pt)
  20784. * )
  20785. */
  20786. __pyx_t_6 = NULL;
  20787. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_Intersection); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1225, __pyx_L1_error)
  20788. __Pyx_GOTREF(__pyx_t_1);
  20789. /* "fontTools/misc/bezierTools.py":1226
  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. */
  20796. __pyx_t_12 = NULL;
  20797. __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)
  20798. __Pyx_GOTREF(__pyx_t_11);
  20799. __pyx_t_7 = 1;
  20800. #if CYTHON_UNPACK_METHODS
  20801. if (unlikely(PyMethod_Check(__pyx_t_11))) {
  20802. __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
  20803. assert(__pyx_t_12);
  20804. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_11);
  20805. __Pyx_INCREF(__pyx_t_12);
  20806. __Pyx_INCREF(__pyx__function);
  20807. __Pyx_DECREF_SET(__pyx_t_11, __pyx__function);
  20808. __pyx_t_7 = 0;
  20809. }
  20810. #endif
  20811. {
  20812. PyObject *__pyx_callargs[4] = {__pyx_t_12, __pyx_v_s1, __pyx_v_e1, __pyx_v_pt};
  20813. __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));
  20814. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  20815. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  20816. if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1226, __pyx_L1_error)
  20817. __Pyx_GOTREF(__pyx_t_10);
  20818. }
  20819. __pyx_t_12 = NULL;
  20820. __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)
  20821. __Pyx_GOTREF(__pyx_t_2);
  20822. __pyx_t_7 = 1;
  20823. #if CYTHON_UNPACK_METHODS
  20824. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  20825. __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2);
  20826. assert(__pyx_t_12);
  20827. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  20828. __Pyx_INCREF(__pyx_t_12);
  20829. __Pyx_INCREF(__pyx__function);
  20830. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  20831. __pyx_t_7 = 0;
  20832. }
  20833. #endif
  20834. {
  20835. PyObject *__pyx_callargs[4] = {__pyx_t_12, __pyx_v_s2, __pyx_v_e2, __pyx_v_pt};
  20836. __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));
  20837. __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
  20838. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  20839. if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1226, __pyx_L1_error)
  20840. __Pyx_GOTREF(__pyx_t_11);
  20841. }
  20842. __pyx_t_7 = 1;
  20843. #if CYTHON_UNPACK_METHODS
  20844. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  20845. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
  20846. assert(__pyx_t_6);
  20847. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  20848. __Pyx_INCREF(__pyx_t_6);
  20849. __Pyx_INCREF(__pyx__function);
  20850. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  20851. __pyx_t_7 = 0;
  20852. }
  20853. #endif
  20854. {
  20855. PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_6, NULL};
  20856. __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1225, __pyx_L1_error)
  20857. __Pyx_GOTREF(__pyx_t_2);
  20858. 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)
  20859. 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)
  20860. 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)
  20861. __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);
  20862. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  20863. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  20864. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  20865. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  20866. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  20867. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1225, __pyx_L1_error)
  20868. __Pyx_GOTREF(__pyx_t_3);
  20869. }
  20870. /* "fontTools/misc/bezierTools.py":1224
  20871. * pt, e1, s1
  20872. * ) and _both_points_are_on_same_side_of_origin(pt, s2, e2):
  20873. * return [ # <<<<<<<<<<<<<<
  20874. * Intersection(
  20875. * pt=pt, t1=_line_t_of_pt(s1, e1, pt), t2=_line_t_of_pt(s2, e2, pt)
  20876. */
  20877. __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1224, __pyx_L1_error)
  20878. __Pyx_GOTREF(__pyx_t_1);
  20879. __Pyx_GIVEREF(__pyx_t_3);
  20880. if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 1224, __pyx_L1_error);
  20881. __pyx_t_3 = 0;
  20882. __pyx_r = __pyx_t_1;
  20883. __pyx_t_1 = 0;
  20884. goto __pyx_L0;
  20885. /* "fontTools/misc/bezierTools.py":1221
  20886. * y = slope12 * (x - s1x) + s1y
  20887. * pt = (x, y)
  20888. * if _both_points_are_on_same_side_of_origin( # <<<<<<<<<<<<<<
  20889. * pt, e1, s1
  20890. * ) and _both_points_are_on_same_side_of_origin(pt, s2, e2):
  20891. */
  20892. }
  20893. /* "fontTools/misc/bezierTools.py":1229
  20894. * )
  20895. * ]
  20896. * return [] # <<<<<<<<<<<<<<
  20897. *
  20898. *
  20899. */
  20900. __Pyx_XDECREF(__pyx_r);
  20901. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1229, __pyx_L1_error)
  20902. __Pyx_GOTREF(__pyx_t_1);
  20903. __pyx_r = __pyx_t_1;
  20904. __pyx_t_1 = 0;
  20905. goto __pyx_L0;
  20906. /* "fontTools/misc/bezierTools.py":1154
  20907. *
  20908. *
  20909. * def lineLineIntersections(s1, e1, s2, e2): # <<<<<<<<<<<<<<
  20910. * """Finds intersections between two line segments.
  20911. *
  20912. */
  20913. /* function exit code */
  20914. __pyx_L1_error:;
  20915. __Pyx_XDECREF(__pyx_t_1);
  20916. __Pyx_XDECREF(__pyx_t_2);
  20917. __Pyx_XDECREF(__pyx_t_3);
  20918. __Pyx_XDECREF(__pyx_t_6);
  20919. __Pyx_XDECREF(__pyx_t_10);
  20920. __Pyx_XDECREF(__pyx_t_11);
  20921. __Pyx_XDECREF(__pyx_t_12);
  20922. __Pyx_AddTraceback("fontTools.misc.bezierTools.lineLineIntersections", __pyx_clineno, __pyx_lineno, __pyx_filename);
  20923. __pyx_r = NULL;
  20924. __pyx_L0:;
  20925. __Pyx_XDECREF(__pyx_v_s1x);
  20926. __Pyx_XDECREF(__pyx_v_s1y);
  20927. __Pyx_XDECREF(__pyx_v_e1x);
  20928. __Pyx_XDECREF(__pyx_v_e1y);
  20929. __Pyx_XDECREF(__pyx_v_s2x);
  20930. __Pyx_XDECREF(__pyx_v_s2y);
  20931. __Pyx_XDECREF(__pyx_v_e2x);
  20932. __Pyx_XDECREF(__pyx_v_e2y);
  20933. __Pyx_XDECREF(__pyx_v_x);
  20934. __Pyx_XDECREF(__pyx_v_slope34);
  20935. __Pyx_XDECREF(__pyx_v_y);
  20936. __Pyx_XDECREF(__pyx_v_pt);
  20937. __Pyx_XDECREF(__pyx_v_slope12);
  20938. __Pyx_XGIVEREF(__pyx_r);
  20939. __Pyx_RefNannyFinishContext();
  20940. return __pyx_r;
  20941. }
  20942. /* "fontTools/misc/bezierTools.py":1232
  20943. *
  20944. *
  20945. * def _alignment_transformation(segment): # <<<<<<<<<<<<<<
  20946. * # Returns a transformation which aligns a segment horizontally at the
  20947. * # origin. Apply this transformation to curves and root-find to find
  20948. */
  20949. /* Python wrapper */
  20950. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_75_alignment_transformation(PyObject *__pyx_self,
  20951. #if CYTHON_METH_FASTCALL
  20952. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  20953. #else
  20954. PyObject *__pyx_args, PyObject *__pyx_kwds
  20955. #endif
  20956. ); /*proto*/
  20957. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_74_alignment_transformation, "_alignment_transformation(segment)");
  20958. 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};
  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. ) {
  20966. PyObject *__pyx_v_segment = 0;
  20967. #if !CYTHON_METH_FASTCALL
  20968. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  20969. #endif
  20970. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  20971. PyObject* values[1] = {0};
  20972. int __pyx_lineno = 0;
  20973. const char *__pyx_filename = NULL;
  20974. int __pyx_clineno = 0;
  20975. PyObject *__pyx_r = 0;
  20976. __Pyx_RefNannyDeclarations
  20977. __Pyx_RefNannySetupContext("_alignment_transformation (wrapper)", 0);
  20978. #if !CYTHON_METH_FASTCALL
  20979. #if CYTHON_ASSUME_SAFE_SIZE
  20980. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  20981. #else
  20982. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  20983. #endif
  20984. #endif
  20985. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  20986. {
  20987. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_segment,0};
  20988. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  20989. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1232, __pyx_L3_error)
  20990. if (__pyx_kwds_len > 0) {
  20991. switch (__pyx_nargs) {
  20992. case 1:
  20993. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  20994. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1232, __pyx_L3_error)
  20995. CYTHON_FALLTHROUGH;
  20996. case 0: break;
  20997. default: goto __pyx_L5_argtuple_error;
  20998. }
  20999. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  21000. 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)
  21001. for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
  21002. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_alignment_transformation", 1, 1, 1, i); __PYX_ERR(0, 1232, __pyx_L3_error) }
  21003. }
  21004. } else if (unlikely(__pyx_nargs != 1)) {
  21005. goto __pyx_L5_argtuple_error;
  21006. } else {
  21007. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  21008. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1232, __pyx_L3_error)
  21009. }
  21010. __pyx_v_segment = values[0];
  21011. }
  21012. goto __pyx_L6_skip;
  21013. __pyx_L5_argtuple_error:;
  21014. __Pyx_RaiseArgtupleInvalid("_alignment_transformation", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1232, __pyx_L3_error)
  21015. __pyx_L6_skip:;
  21016. goto __pyx_L4_argument_unpacking_done;
  21017. __pyx_L3_error:;
  21018. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  21019. Py_XDECREF(values[__pyx_temp]);
  21020. }
  21021. __Pyx_AddTraceback("fontTools.misc.bezierTools._alignment_transformation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  21022. __Pyx_RefNannyFinishContext();
  21023. return NULL;
  21024. __pyx_L4_argument_unpacking_done:;
  21025. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_74_alignment_transformation(__pyx_self, __pyx_v_segment);
  21026. /* function exit code */
  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_RefNannyFinishContext();
  21031. return __pyx_r;
  21032. }
  21033. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_74_alignment_transformation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_segment) {
  21034. PyObject *__pyx_v_start = NULL;
  21035. PyObject *__pyx_v_end = NULL;
  21036. PyObject *__pyx_v_angle = NULL;
  21037. PyObject *__pyx_r = NULL;
  21038. __Pyx_RefNannyDeclarations
  21039. PyObject *__pyx_t_1 = NULL;
  21040. PyObject *__pyx_t_2 = NULL;
  21041. PyObject *__pyx_t_3 = NULL;
  21042. PyObject *__pyx_t_4 = NULL;
  21043. PyObject *__pyx_t_5 = NULL;
  21044. PyObject *__pyx_t_6 = NULL;
  21045. PyObject *__pyx_t_7 = NULL;
  21046. size_t __pyx_t_8;
  21047. int __pyx_lineno = 0;
  21048. const char *__pyx_filename = NULL;
  21049. int __pyx_clineno = 0;
  21050. __Pyx_RefNannySetupContext("_alignment_transformation", 0);
  21051. /* "fontTools/misc/bezierTools.py":1236
  21052. * # origin. Apply this transformation to curves and root-find to find
  21053. * # intersections with the segment.
  21054. * start = segment[0] # <<<<<<<<<<<<<<
  21055. * end = segment[-1]
  21056. * angle = math.atan2(end[1] - start[1], end[0] - start[0])
  21057. */
  21058. __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)
  21059. __Pyx_GOTREF(__pyx_t_1);
  21060. __pyx_v_start = __pyx_t_1;
  21061. __pyx_t_1 = 0;
  21062. /* "fontTools/misc/bezierTools.py":1237
  21063. * # intersections with the segment.
  21064. * start = segment[0]
  21065. * end = segment[-1] # <<<<<<<<<<<<<<
  21066. * angle = math.atan2(end[1] - start[1], end[0] - start[0])
  21067. * return Identity.rotate(-angle).translate(-start[0], -start[1])
  21068. */
  21069. __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)
  21070. __Pyx_GOTREF(__pyx_t_1);
  21071. __pyx_v_end = __pyx_t_1;
  21072. __pyx_t_1 = 0;
  21073. /* "fontTools/misc/bezierTools.py":1238
  21074. * start = segment[0]
  21075. * end = segment[-1]
  21076. * angle = math.atan2(end[1] - start[1], end[0] - start[0]) # <<<<<<<<<<<<<<
  21077. * return Identity.rotate(-angle).translate(-start[0], -start[1])
  21078. *
  21079. */
  21080. __pyx_t_2 = NULL;
  21081. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1238, __pyx_L1_error)
  21082. __Pyx_GOTREF(__pyx_t_3);
  21083. __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)
  21084. __Pyx_GOTREF(__pyx_t_4);
  21085. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21086. __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)
  21087. __Pyx_GOTREF(__pyx_t_3);
  21088. __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)
  21089. __Pyx_GOTREF(__pyx_t_5);
  21090. __pyx_t_6 = PyNumber_Subtract(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1238, __pyx_L1_error)
  21091. __Pyx_GOTREF(__pyx_t_6);
  21092. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21093. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  21094. __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)
  21095. __Pyx_GOTREF(__pyx_t_5);
  21096. __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)
  21097. __Pyx_GOTREF(__pyx_t_3);
  21098. __pyx_t_7 = PyNumber_Subtract(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1238, __pyx_L1_error)
  21099. __Pyx_GOTREF(__pyx_t_7);
  21100. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  21101. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21102. __pyx_t_8 = 1;
  21103. #if CYTHON_UNPACK_METHODS
  21104. if (unlikely(PyMethod_Check(__pyx_t_4))) {
  21105. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
  21106. assert(__pyx_t_2);
  21107. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
  21108. __Pyx_INCREF(__pyx_t_2);
  21109. __Pyx_INCREF(__pyx__function);
  21110. __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
  21111. __pyx_t_8 = 0;
  21112. }
  21113. #endif
  21114. {
  21115. PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_t_6, __pyx_t_7};
  21116. __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));
  21117. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  21118. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  21119. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  21120. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  21121. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1238, __pyx_L1_error)
  21122. __Pyx_GOTREF(__pyx_t_1);
  21123. }
  21124. __pyx_v_angle = __pyx_t_1;
  21125. __pyx_t_1 = 0;
  21126. /* "fontTools/misc/bezierTools.py":1239
  21127. * end = segment[-1]
  21128. * angle = math.atan2(end[1] - start[1], end[0] - start[0])
  21129. * return Identity.rotate(-angle).translate(-start[0], -start[1]) # <<<<<<<<<<<<<<
  21130. *
  21131. *
  21132. */
  21133. __Pyx_XDECREF(__pyx_r);
  21134. __pyx_t_6 = NULL;
  21135. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_Identity); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1239, __pyx_L1_error)
  21136. __Pyx_GOTREF(__pyx_t_2);
  21137. __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)
  21138. __Pyx_GOTREF(__pyx_t_3);
  21139. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21140. __pyx_t_2 = PyNumber_Negative(__pyx_v_angle); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1239, __pyx_L1_error)
  21141. __Pyx_GOTREF(__pyx_t_2);
  21142. __pyx_t_8 = 1;
  21143. #if CYTHON_UNPACK_METHODS
  21144. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  21145. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
  21146. assert(__pyx_t_6);
  21147. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  21148. __Pyx_INCREF(__pyx_t_6);
  21149. __Pyx_INCREF(__pyx__function);
  21150. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  21151. __pyx_t_8 = 0;
  21152. }
  21153. #endif
  21154. {
  21155. PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_2};
  21156. __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));
  21157. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  21158. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21159. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21160. if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1239, __pyx_L1_error)
  21161. __Pyx_GOTREF(__pyx_t_7);
  21162. }
  21163. __pyx_t_4 = __pyx_t_7;
  21164. __Pyx_INCREF(__pyx_t_4);
  21165. __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)
  21166. __Pyx_GOTREF(__pyx_t_3);
  21167. __pyx_t_2 = PyNumber_Negative(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1239, __pyx_L1_error)
  21168. __Pyx_GOTREF(__pyx_t_2);
  21169. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21170. __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)
  21171. __Pyx_GOTREF(__pyx_t_3);
  21172. __pyx_t_6 = PyNumber_Negative(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1239, __pyx_L1_error)
  21173. __Pyx_GOTREF(__pyx_t_6);
  21174. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21175. __pyx_t_8 = 0;
  21176. {
  21177. PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_2, __pyx_t_6};
  21178. __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));
  21179. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  21180. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21181. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  21182. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  21183. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1239, __pyx_L1_error)
  21184. __Pyx_GOTREF(__pyx_t_1);
  21185. }
  21186. __pyx_r = __pyx_t_1;
  21187. __pyx_t_1 = 0;
  21188. goto __pyx_L0;
  21189. /* "fontTools/misc/bezierTools.py":1232
  21190. *
  21191. *
  21192. * def _alignment_transformation(segment): # <<<<<<<<<<<<<<
  21193. * # Returns a transformation which aligns a segment horizontally at the
  21194. * # origin. Apply this transformation to curves and root-find to find
  21195. */
  21196. /* function exit code */
  21197. __pyx_L1_error:;
  21198. __Pyx_XDECREF(__pyx_t_1);
  21199. __Pyx_XDECREF(__pyx_t_2);
  21200. __Pyx_XDECREF(__pyx_t_3);
  21201. __Pyx_XDECREF(__pyx_t_4);
  21202. __Pyx_XDECREF(__pyx_t_5);
  21203. __Pyx_XDECREF(__pyx_t_6);
  21204. __Pyx_XDECREF(__pyx_t_7);
  21205. __Pyx_AddTraceback("fontTools.misc.bezierTools._alignment_transformation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  21206. __pyx_r = NULL;
  21207. __pyx_L0:;
  21208. __Pyx_XDECREF(__pyx_v_start);
  21209. __Pyx_XDECREF(__pyx_v_end);
  21210. __Pyx_XDECREF(__pyx_v_angle);
  21211. __Pyx_XGIVEREF(__pyx_r);
  21212. __Pyx_RefNannyFinishContext();
  21213. return __pyx_r;
  21214. }
  21215. /* "fontTools/misc/bezierTools.py":1242
  21216. *
  21217. *
  21218. * def _curve_line_intersections_t(curve, line): # <<<<<<<<<<<<<<
  21219. * aligned_curve = _alignment_transformation(line).transformPoints(curve)
  21220. * if len(curve) == 3:
  21221. */
  21222. /* Python wrapper */
  21223. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_77_curve_line_intersections_t(PyObject *__pyx_self,
  21224. #if CYTHON_METH_FASTCALL
  21225. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  21226. #else
  21227. PyObject *__pyx_args, PyObject *__pyx_kwds
  21228. #endif
  21229. ); /*proto*/
  21230. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_76_curve_line_intersections_t, "_curve_line_intersections_t(curve, line)");
  21231. 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};
  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. ) {
  21239. PyObject *__pyx_v_curve = 0;
  21240. PyObject *__pyx_v_line = 0;
  21241. #if !CYTHON_METH_FASTCALL
  21242. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  21243. #endif
  21244. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  21245. PyObject* values[2] = {0,0};
  21246. int __pyx_lineno = 0;
  21247. const char *__pyx_filename = NULL;
  21248. int __pyx_clineno = 0;
  21249. PyObject *__pyx_r = 0;
  21250. __Pyx_RefNannyDeclarations
  21251. __Pyx_RefNannySetupContext("_curve_line_intersections_t (wrapper)", 0);
  21252. #if !CYTHON_METH_FASTCALL
  21253. #if CYTHON_ASSUME_SAFE_SIZE
  21254. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  21255. #else
  21256. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  21257. #endif
  21258. #endif
  21259. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  21260. {
  21261. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_curve,&__pyx_mstate_global->__pyx_n_u_line,0};
  21262. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  21263. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1242, __pyx_L3_error)
  21264. if (__pyx_kwds_len > 0) {
  21265. switch (__pyx_nargs) {
  21266. case 2:
  21267. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  21268. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1242, __pyx_L3_error)
  21269. CYTHON_FALLTHROUGH;
  21270. case 1:
  21271. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  21272. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1242, __pyx_L3_error)
  21273. CYTHON_FALLTHROUGH;
  21274. case 0: break;
  21275. default: goto __pyx_L5_argtuple_error;
  21276. }
  21277. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  21278. 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)
  21279. for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
  21280. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_curve_line_intersections_t", 1, 2, 2, i); __PYX_ERR(0, 1242, __pyx_L3_error) }
  21281. }
  21282. } else if (unlikely(__pyx_nargs != 2)) {
  21283. goto __pyx_L5_argtuple_error;
  21284. } else {
  21285. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  21286. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1242, __pyx_L3_error)
  21287. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  21288. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1242, __pyx_L3_error)
  21289. }
  21290. __pyx_v_curve = values[0];
  21291. __pyx_v_line = values[1];
  21292. }
  21293. goto __pyx_L6_skip;
  21294. __pyx_L5_argtuple_error:;
  21295. __Pyx_RaiseArgtupleInvalid("_curve_line_intersections_t", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1242, __pyx_L3_error)
  21296. __pyx_L6_skip:;
  21297. goto __pyx_L4_argument_unpacking_done;
  21298. __pyx_L3_error:;
  21299. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  21300. Py_XDECREF(values[__pyx_temp]);
  21301. }
  21302. __Pyx_AddTraceback("fontTools.misc.bezierTools._curve_line_intersections_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  21303. __Pyx_RefNannyFinishContext();
  21304. return NULL;
  21305. __pyx_L4_argument_unpacking_done:;
  21306. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_76_curve_line_intersections_t(__pyx_self, __pyx_v_curve, __pyx_v_line);
  21307. /* function exit code */
  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_RefNannyFinishContext();
  21312. return __pyx_r;
  21313. }
  21314. 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 */
  21315. /* "fontTools/misc/bezierTools.py":1252
  21316. * else:
  21317. * raise ValueError("Unknown curve degree")
  21318. * return sorted(i for i in intersections if 0.0 <= i <= 1) # <<<<<<<<<<<<<<
  21319. *
  21320. *
  21321. */
  21322. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_27_curve_line_intersections_t_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  21323. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr *__pyx_cur_scope;
  21324. PyObject *__pyx_r = NULL;
  21325. __Pyx_RefNannyDeclarations
  21326. int __pyx_lineno = 0;
  21327. const char *__pyx_filename = NULL;
  21328. int __pyx_clineno = 0;
  21329. __Pyx_RefNannySetupContext("genexpr", 0);
  21330. __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);
  21331. if (unlikely(!__pyx_cur_scope)) {
  21332. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr *)Py_None);
  21333. __Pyx_INCREF(Py_None);
  21334. __PYX_ERR(0, 1252, __pyx_L1_error)
  21335. } else {
  21336. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  21337. }
  21338. __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  21339. __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  21340. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  21341. {
  21342. __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)
  21343. __Pyx_DECREF(__pyx_cur_scope);
  21344. __Pyx_RefNannyFinishContext();
  21345. return (PyObject *) gen;
  21346. }
  21347. /* function exit code */
  21348. __pyx_L1_error:;
  21349. __Pyx_AddTraceback("fontTools.misc.bezierTools._curve_line_intersections_t.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  21350. __pyx_r = NULL;
  21351. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  21352. __Pyx_XGIVEREF(__pyx_r);
  21353. __Pyx_RefNannyFinishContext();
  21354. return __pyx_r;
  21355. }
  21356. 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 */
  21357. {
  21358. 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);
  21359. PyObject *__pyx_r = NULL;
  21360. PyObject *__pyx_t_1 = NULL;
  21361. Py_ssize_t __pyx_t_2;
  21362. PyObject *(*__pyx_t_3)(PyObject *);
  21363. PyObject *__pyx_t_4 = NULL;
  21364. int __pyx_t_5;
  21365. int __pyx_lineno = 0;
  21366. const char *__pyx_filename = NULL;
  21367. int __pyx_clineno = 0;
  21368. __Pyx_RefNannyDeclarations
  21369. __Pyx_RefNannySetupContext("genexpr", 0);
  21370. switch (__pyx_generator->resume_label) {
  21371. case 0: goto __pyx_L3_first_run;
  21372. default: /* CPython raises the right error here */
  21373. __Pyx_RefNannyFinishContext();
  21374. return NULL;
  21375. }
  21376. __pyx_L3_first_run:;
  21377. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1252, __pyx_L1_error)
  21378. __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 1252, __pyx_L1_error)
  21379. __Pyx_GOTREF(__pyx_r);
  21380. if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 1252, __pyx_L1_error) }
  21381. if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
  21382. __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
  21383. __pyx_t_2 = 0;
  21384. __pyx_t_3 = NULL;
  21385. } else {
  21386. __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)
  21387. __Pyx_GOTREF(__pyx_t_1);
  21388. __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)
  21389. }
  21390. for (;;) {
  21391. if (likely(!__pyx_t_3)) {
  21392. if (likely(PyList_CheckExact(__pyx_t_1))) {
  21393. {
  21394. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  21395. #if !CYTHON_ASSUME_SAFE_SIZE
  21396. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1252, __pyx_L1_error)
  21397. #endif
  21398. if (__pyx_t_2 >= __pyx_temp) break;
  21399. }
  21400. __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
  21401. ++__pyx_t_2;
  21402. } else {
  21403. {
  21404. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  21405. #if !CYTHON_ASSUME_SAFE_SIZE
  21406. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1252, __pyx_L1_error)
  21407. #endif
  21408. if (__pyx_t_2 >= __pyx_temp) break;
  21409. }
  21410. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  21411. __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
  21412. #else
  21413. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
  21414. #endif
  21415. ++__pyx_t_2;
  21416. }
  21417. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1252, __pyx_L1_error)
  21418. } else {
  21419. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  21420. if (unlikely(!__pyx_t_4)) {
  21421. PyObject* exc_type = PyErr_Occurred();
  21422. if (exc_type) {
  21423. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1252, __pyx_L1_error)
  21424. PyErr_Clear();
  21425. }
  21426. break;
  21427. }
  21428. }
  21429. __Pyx_GOTREF(__pyx_t_4);
  21430. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_i);
  21431. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_i, __pyx_t_4);
  21432. __Pyx_GIVEREF(__pyx_t_4);
  21433. __pyx_t_4 = 0;
  21434. __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)
  21435. if (__Pyx_PyObject_IsTrue(__pyx_t_4)) {
  21436. __Pyx_DECREF(__pyx_t_4);
  21437. __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)
  21438. }
  21439. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1252, __pyx_L1_error)
  21440. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  21441. if (__pyx_t_5) {
  21442. if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_cur_scope->__pyx_v_i))) __PYX_ERR(0, 1252, __pyx_L1_error)
  21443. }
  21444. }
  21445. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  21446. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  21447. /* function exit code */
  21448. goto __pyx_L0;
  21449. __pyx_L1_error:;
  21450. __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  21451. __Pyx_XDECREF(__pyx_t_1);
  21452. __Pyx_XDECREF(__pyx_t_4);
  21453. if (__Pyx_PyErr_Occurred()) {
  21454. __Pyx_Generator_Replace_StopIteration(0);
  21455. __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  21456. }
  21457. __pyx_L0:;
  21458. __Pyx_XGIVEREF(__pyx_r);
  21459. #if !CYTHON_USE_EXC_INFO_STACK
  21460. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  21461. #endif
  21462. __pyx_generator->resume_label = -1;
  21463. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  21464. __Pyx_RefNannyFinishContext();
  21465. return __pyx_r;
  21466. }
  21467. /* "fontTools/misc/bezierTools.py":1242
  21468. *
  21469. *
  21470. * def _curve_line_intersections_t(curve, line): # <<<<<<<<<<<<<<
  21471. * aligned_curve = _alignment_transformation(line).transformPoints(curve)
  21472. * if len(curve) == 3:
  21473. */
  21474. 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) {
  21475. PyObject *__pyx_v_aligned_curve = NULL;
  21476. PyObject *__pyx_v_a = NULL;
  21477. PyObject *__pyx_v_b = NULL;
  21478. PyObject *__pyx_v_c = NULL;
  21479. PyObject *__pyx_v_intersections = NULL;
  21480. PyObject *__pyx_v_d = NULL;
  21481. PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_27_curve_line_intersections_t_2generator4 = 0;
  21482. PyObject *__pyx_r = NULL;
  21483. __Pyx_RefNannyDeclarations
  21484. PyObject *__pyx_t_1 = NULL;
  21485. PyObject *__pyx_t_2 = NULL;
  21486. PyObject *__pyx_t_3 = NULL;
  21487. PyObject *__pyx_t_4 = NULL;
  21488. PyObject *__pyx_t_5 = NULL;
  21489. size_t __pyx_t_6;
  21490. Py_ssize_t __pyx_t_7;
  21491. int __pyx_t_8;
  21492. PyObject *(*__pyx_t_9)(PyObject *);
  21493. PyObject *__pyx_t_10 = NULL;
  21494. PyObject *__pyx_t_11 = NULL;
  21495. int __pyx_lineno = 0;
  21496. const char *__pyx_filename = NULL;
  21497. int __pyx_clineno = 0;
  21498. __Pyx_RefNannySetupContext("_curve_line_intersections_t", 0);
  21499. /* "fontTools/misc/bezierTools.py":1243
  21500. *
  21501. * def _curve_line_intersections_t(curve, line):
  21502. * aligned_curve = _alignment_transformation(line).transformPoints(curve) # <<<<<<<<<<<<<<
  21503. * if len(curve) == 3:
  21504. * a, b, c = calcQuadraticParameters(*aligned_curve)
  21505. */
  21506. __pyx_t_4 = NULL;
  21507. __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)
  21508. __Pyx_GOTREF(__pyx_t_5);
  21509. __pyx_t_6 = 1;
  21510. #if CYTHON_UNPACK_METHODS
  21511. if (unlikely(PyMethod_Check(__pyx_t_5))) {
  21512. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
  21513. assert(__pyx_t_4);
  21514. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
  21515. __Pyx_INCREF(__pyx_t_4);
  21516. __Pyx_INCREF(__pyx__function);
  21517. __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
  21518. __pyx_t_6 = 0;
  21519. }
  21520. #endif
  21521. {
  21522. PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_line};
  21523. __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));
  21524. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  21525. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  21526. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1243, __pyx_L1_error)
  21527. __Pyx_GOTREF(__pyx_t_3);
  21528. }
  21529. __pyx_t_2 = __pyx_t_3;
  21530. __Pyx_INCREF(__pyx_t_2);
  21531. __pyx_t_6 = 0;
  21532. {
  21533. PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_curve};
  21534. __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));
  21535. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  21536. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21537. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1243, __pyx_L1_error)
  21538. __Pyx_GOTREF(__pyx_t_1);
  21539. }
  21540. __pyx_v_aligned_curve = __pyx_t_1;
  21541. __pyx_t_1 = 0;
  21542. /* "fontTools/misc/bezierTools.py":1244
  21543. * def _curve_line_intersections_t(curve, line):
  21544. * aligned_curve = _alignment_transformation(line).transformPoints(curve)
  21545. * if len(curve) == 3: # <<<<<<<<<<<<<<
  21546. * a, b, c = calcQuadraticParameters(*aligned_curve)
  21547. * intersections = solveQuadratic(a[1], b[1], c[1])
  21548. */
  21549. __pyx_t_7 = PyObject_Length(__pyx_v_curve); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1244, __pyx_L1_error)
  21550. __pyx_t_8 = (__pyx_t_7 == 3);
  21551. if (__pyx_t_8) {
  21552. /* "fontTools/misc/bezierTools.py":1245
  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. * elif len(curve) == 4:
  21558. */
  21559. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_calcQuadraticParameters); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1245, __pyx_L1_error)
  21560. __Pyx_GOTREF(__pyx_t_1);
  21561. __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_aligned_curve); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1245, __pyx_L1_error)
  21562. __Pyx_GOTREF(__pyx_t_3);
  21563. __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)
  21564. __Pyx_GOTREF(__pyx_t_2);
  21565. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  21566. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21567. if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
  21568. PyObject* sequence = __pyx_t_2;
  21569. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  21570. if (unlikely(size != 3)) {
  21571. if (size > 3) __Pyx_RaiseTooManyValuesError(3);
  21572. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  21573. __PYX_ERR(0, 1245, __pyx_L1_error)
  21574. }
  21575. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  21576. if (likely(PyTuple_CheckExact(sequence))) {
  21577. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  21578. __Pyx_INCREF(__pyx_t_3);
  21579. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  21580. __Pyx_INCREF(__pyx_t_1);
  21581. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2);
  21582. __Pyx_INCREF(__pyx_t_5);
  21583. } else {
  21584. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  21585. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1245, __pyx_L1_error)
  21586. __Pyx_XGOTREF(__pyx_t_3);
  21587. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  21588. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1245, __pyx_L1_error)
  21589. __Pyx_XGOTREF(__pyx_t_1);
  21590. __pyx_t_5 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  21591. if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1245, __pyx_L1_error)
  21592. __Pyx_XGOTREF(__pyx_t_5);
  21593. }
  21594. #else
  21595. __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1245, __pyx_L1_error)
  21596. __Pyx_GOTREF(__pyx_t_3);
  21597. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1245, __pyx_L1_error)
  21598. __Pyx_GOTREF(__pyx_t_1);
  21599. __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1245, __pyx_L1_error)
  21600. __Pyx_GOTREF(__pyx_t_5);
  21601. #endif
  21602. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21603. } else {
  21604. Py_ssize_t index = -1;
  21605. __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1245, __pyx_L1_error)
  21606. __Pyx_GOTREF(__pyx_t_4);
  21607. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21608. __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4);
  21609. index = 0; __pyx_t_3 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
  21610. __Pyx_GOTREF(__pyx_t_3);
  21611. index = 1; __pyx_t_1 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L4_unpacking_failed;
  21612. __Pyx_GOTREF(__pyx_t_1);
  21613. index = 2; __pyx_t_5 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed;
  21614. __Pyx_GOTREF(__pyx_t_5);
  21615. if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_4), 3) < (0)) __PYX_ERR(0, 1245, __pyx_L1_error)
  21616. __pyx_t_9 = NULL;
  21617. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  21618. goto __pyx_L5_unpacking_done;
  21619. __pyx_L4_unpacking_failed:;
  21620. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  21621. __pyx_t_9 = NULL;
  21622. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  21623. __PYX_ERR(0, 1245, __pyx_L1_error)
  21624. __pyx_L5_unpacking_done:;
  21625. }
  21626. __pyx_v_a = __pyx_t_3;
  21627. __pyx_t_3 = 0;
  21628. __pyx_v_b = __pyx_t_1;
  21629. __pyx_t_1 = 0;
  21630. __pyx_v_c = __pyx_t_5;
  21631. __pyx_t_5 = 0;
  21632. /* "fontTools/misc/bezierTools.py":1246
  21633. * if len(curve) == 3:
  21634. * a, b, c = calcQuadraticParameters(*aligned_curve)
  21635. * intersections = solveQuadratic(a[1], b[1], c[1]) # <<<<<<<<<<<<<<
  21636. * elif len(curve) == 4:
  21637. * a, b, c, d = calcCubicParameters(*aligned_curve)
  21638. */
  21639. __pyx_t_5 = NULL;
  21640. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_solveQuadratic); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1246, __pyx_L1_error)
  21641. __Pyx_GOTREF(__pyx_t_1);
  21642. __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)
  21643. __Pyx_GOTREF(__pyx_t_3);
  21644. __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)
  21645. __Pyx_GOTREF(__pyx_t_4);
  21646. __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)
  21647. __Pyx_GOTREF(__pyx_t_10);
  21648. __pyx_t_6 = 1;
  21649. #if CYTHON_UNPACK_METHODS
  21650. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  21651. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
  21652. assert(__pyx_t_5);
  21653. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  21654. __Pyx_INCREF(__pyx_t_5);
  21655. __Pyx_INCREF(__pyx__function);
  21656. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  21657. __pyx_t_6 = 0;
  21658. }
  21659. #endif
  21660. {
  21661. PyObject *__pyx_callargs[4] = {__pyx_t_5, __pyx_t_3, __pyx_t_4, __pyx_t_10};
  21662. __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));
  21663. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  21664. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  21665. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  21666. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  21667. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  21668. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1246, __pyx_L1_error)
  21669. __Pyx_GOTREF(__pyx_t_2);
  21670. }
  21671. __pyx_v_intersections = __pyx_t_2;
  21672. __pyx_t_2 = 0;
  21673. /* "fontTools/misc/bezierTools.py":1244
  21674. * def _curve_line_intersections_t(curve, line):
  21675. * aligned_curve = _alignment_transformation(line).transformPoints(curve)
  21676. * if len(curve) == 3: # <<<<<<<<<<<<<<
  21677. * a, b, c = calcQuadraticParameters(*aligned_curve)
  21678. * intersections = solveQuadratic(a[1], b[1], c[1])
  21679. */
  21680. goto __pyx_L3;
  21681. }
  21682. /* "fontTools/misc/bezierTools.py":1247
  21683. * a, b, c = calcQuadraticParameters(*aligned_curve)
  21684. * intersections = solveQuadratic(a[1], b[1], c[1])
  21685. * elif len(curve) == 4: # <<<<<<<<<<<<<<
  21686. * a, b, c, d = calcCubicParameters(*aligned_curve)
  21687. * intersections = solveCubic(a[1], b[1], c[1], d[1])
  21688. */
  21689. __pyx_t_7 = PyObject_Length(__pyx_v_curve); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1247, __pyx_L1_error)
  21690. __pyx_t_8 = (__pyx_t_7 == 4);
  21691. if (likely(__pyx_t_8)) {
  21692. /* "fontTools/misc/bezierTools.py":1248
  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. * else:
  21698. */
  21699. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_calcCubicParameters); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1248, __pyx_L1_error)
  21700. __Pyx_GOTREF(__pyx_t_2);
  21701. __pyx_t_1 = __Pyx_PySequence_Tuple(__pyx_v_aligned_curve); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1248, __pyx_L1_error)
  21702. __Pyx_GOTREF(__pyx_t_1);
  21703. __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)
  21704. __Pyx_GOTREF(__pyx_t_10);
  21705. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21706. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  21707. if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) {
  21708. PyObject* sequence = __pyx_t_10;
  21709. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  21710. if (unlikely(size != 4)) {
  21711. if (size > 4) __Pyx_RaiseTooManyValuesError(4);
  21712. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  21713. __PYX_ERR(0, 1248, __pyx_L1_error)
  21714. }
  21715. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  21716. if (likely(PyTuple_CheckExact(sequence))) {
  21717. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
  21718. __Pyx_INCREF(__pyx_t_1);
  21719. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  21720. __Pyx_INCREF(__pyx_t_2);
  21721. __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2);
  21722. __Pyx_INCREF(__pyx_t_4);
  21723. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 3);
  21724. __Pyx_INCREF(__pyx_t_3);
  21725. } else {
  21726. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  21727. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1248, __pyx_L1_error)
  21728. __Pyx_XGOTREF(__pyx_t_1);
  21729. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  21730. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1248, __pyx_L1_error)
  21731. __Pyx_XGOTREF(__pyx_t_2);
  21732. __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 2, __Pyx_ReferenceSharing_SharedReference);
  21733. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1248, __pyx_L1_error)
  21734. __Pyx_XGOTREF(__pyx_t_4);
  21735. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 3, __Pyx_ReferenceSharing_SharedReference);
  21736. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1248, __pyx_L1_error)
  21737. __Pyx_XGOTREF(__pyx_t_3);
  21738. }
  21739. #else
  21740. {
  21741. Py_ssize_t i;
  21742. PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_2,&__pyx_t_4,&__pyx_t_3};
  21743. for (i=0; i < 4; i++) {
  21744. PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1248, __pyx_L1_error)
  21745. __Pyx_GOTREF(item);
  21746. *(temps[i]) = item;
  21747. }
  21748. }
  21749. #endif
  21750. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  21751. } else {
  21752. Py_ssize_t index = -1;
  21753. PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_2,&__pyx_t_4,&__pyx_t_3};
  21754. __pyx_t_5 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1248, __pyx_L1_error)
  21755. __Pyx_GOTREF(__pyx_t_5);
  21756. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  21757. __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
  21758. for (index=0; index < 4; index++) {
  21759. PyObject* item = __pyx_t_9(__pyx_t_5); if (unlikely(!item)) goto __pyx_L6_unpacking_failed;
  21760. __Pyx_GOTREF(item);
  21761. *(temps[index]) = item;
  21762. }
  21763. if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_5), 4) < (0)) __PYX_ERR(0, 1248, __pyx_L1_error)
  21764. __pyx_t_9 = NULL;
  21765. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  21766. goto __pyx_L7_unpacking_done;
  21767. __pyx_L6_unpacking_failed:;
  21768. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  21769. __pyx_t_9 = NULL;
  21770. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  21771. __PYX_ERR(0, 1248, __pyx_L1_error)
  21772. __pyx_L7_unpacking_done:;
  21773. }
  21774. __pyx_v_a = __pyx_t_1;
  21775. __pyx_t_1 = 0;
  21776. __pyx_v_b = __pyx_t_2;
  21777. __pyx_t_2 = 0;
  21778. __pyx_v_c = __pyx_t_4;
  21779. __pyx_t_4 = 0;
  21780. __pyx_v_d = __pyx_t_3;
  21781. __pyx_t_3 = 0;
  21782. /* "fontTools/misc/bezierTools.py":1249
  21783. * elif len(curve) == 4:
  21784. * a, b, c, d = calcCubicParameters(*aligned_curve)
  21785. * intersections = solveCubic(a[1], b[1], c[1], d[1]) # <<<<<<<<<<<<<<
  21786. * else:
  21787. * raise ValueError("Unknown curve degree")
  21788. */
  21789. __pyx_t_3 = NULL;
  21790. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_solveCubic); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1249, __pyx_L1_error)
  21791. __Pyx_GOTREF(__pyx_t_4);
  21792. __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)
  21793. __Pyx_GOTREF(__pyx_t_2);
  21794. __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)
  21795. __Pyx_GOTREF(__pyx_t_1);
  21796. __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)
  21797. __Pyx_GOTREF(__pyx_t_5);
  21798. __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)
  21799. __Pyx_GOTREF(__pyx_t_11);
  21800. __pyx_t_6 = 1;
  21801. #if CYTHON_UNPACK_METHODS
  21802. if (unlikely(PyMethod_Check(__pyx_t_4))) {
  21803. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
  21804. assert(__pyx_t_3);
  21805. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_4);
  21806. __Pyx_INCREF(__pyx_t_3);
  21807. __Pyx_INCREF(__pyx__function);
  21808. __Pyx_DECREF_SET(__pyx_t_4, __pyx__function);
  21809. __pyx_t_6 = 0;
  21810. }
  21811. #endif
  21812. {
  21813. PyObject *__pyx_callargs[5] = {__pyx_t_3, __pyx_t_2, __pyx_t_1, __pyx_t_5, __pyx_t_11};
  21814. __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));
  21815. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  21816. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  21817. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  21818. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  21819. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  21820. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  21821. if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1249, __pyx_L1_error)
  21822. __Pyx_GOTREF(__pyx_t_10);
  21823. }
  21824. __pyx_v_intersections = __pyx_t_10;
  21825. __pyx_t_10 = 0;
  21826. /* "fontTools/misc/bezierTools.py":1247
  21827. * a, b, c = calcQuadraticParameters(*aligned_curve)
  21828. * intersections = solveQuadratic(a[1], b[1], c[1])
  21829. * elif len(curve) == 4: # <<<<<<<<<<<<<<
  21830. * a, b, c, d = calcCubicParameters(*aligned_curve)
  21831. * intersections = solveCubic(a[1], b[1], c[1], d[1])
  21832. */
  21833. goto __pyx_L3;
  21834. }
  21835. /* "fontTools/misc/bezierTools.py":1251
  21836. * intersections = solveCubic(a[1], b[1], c[1], d[1])
  21837. * else:
  21838. * raise ValueError("Unknown curve degree") # <<<<<<<<<<<<<<
  21839. * return sorted(i for i in intersections if 0.0 <= i <= 1)
  21840. *
  21841. */
  21842. /*else*/ {
  21843. __pyx_t_4 = NULL;
  21844. __pyx_t_6 = 1;
  21845. {
  21846. PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Unknown_curve_degree};
  21847. __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));
  21848. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  21849. if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1251, __pyx_L1_error)
  21850. __Pyx_GOTREF(__pyx_t_10);
  21851. }
  21852. __Pyx_Raise(__pyx_t_10, 0, 0, 0);
  21853. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  21854. __PYX_ERR(0, 1251, __pyx_L1_error)
  21855. }
  21856. __pyx_L3:;
  21857. /* "fontTools/misc/bezierTools.py":1252
  21858. * else:
  21859. * raise ValueError("Unknown curve degree")
  21860. * return sorted(i for i in intersections if 0.0 <= i <= 1) # <<<<<<<<<<<<<<
  21861. *
  21862. *
  21863. */
  21864. __Pyx_XDECREF(__pyx_r);
  21865. __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)
  21866. __Pyx_GOTREF(__pyx_t_10);
  21867. __pyx_t_4 = __Pyx_Generator_GetInlinedResult(__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1252, __pyx_L1_error)
  21868. __Pyx_GOTREF(__pyx_t_4);
  21869. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  21870. if (unlikely((PyList_Sort(__pyx_t_4) < 0))) __PYX_ERR(0, 1252, __pyx_L1_error)
  21871. __pyx_r = __pyx_t_4;
  21872. __pyx_t_4 = 0;
  21873. goto __pyx_L0;
  21874. /* "fontTools/misc/bezierTools.py":1242
  21875. *
  21876. *
  21877. * def _curve_line_intersections_t(curve, line): # <<<<<<<<<<<<<<
  21878. * aligned_curve = _alignment_transformation(line).transformPoints(curve)
  21879. * if len(curve) == 3:
  21880. */
  21881. /* function exit code */
  21882. __pyx_L1_error:;
  21883. __Pyx_XDECREF(__pyx_t_1);
  21884. __Pyx_XDECREF(__pyx_t_2);
  21885. __Pyx_XDECREF(__pyx_t_3);
  21886. __Pyx_XDECREF(__pyx_t_4);
  21887. __Pyx_XDECREF(__pyx_t_5);
  21888. __Pyx_XDECREF(__pyx_t_10);
  21889. __Pyx_XDECREF(__pyx_t_11);
  21890. __Pyx_AddTraceback("fontTools.misc.bezierTools._curve_line_intersections_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  21891. __pyx_r = NULL;
  21892. __pyx_L0:;
  21893. __Pyx_XDECREF(__pyx_v_aligned_curve);
  21894. __Pyx_XDECREF(__pyx_v_a);
  21895. __Pyx_XDECREF(__pyx_v_b);
  21896. __Pyx_XDECREF(__pyx_v_c);
  21897. __Pyx_XDECREF(__pyx_v_intersections);
  21898. __Pyx_XDECREF(__pyx_v_d);
  21899. __Pyx_XDECREF(__pyx_gb_9fontTools_4misc_11bezierTools_27_curve_line_intersections_t_2generator4);
  21900. __Pyx_XGIVEREF(__pyx_r);
  21901. __Pyx_RefNannyFinishContext();
  21902. return __pyx_r;
  21903. }
  21904. /* "fontTools/misc/bezierTools.py":1255
  21905. *
  21906. *
  21907. * def curveLineIntersections(curve, line): # <<<<<<<<<<<<<<
  21908. * """Finds intersections between a curve and a line.
  21909. *
  21910. */
  21911. /* Python wrapper */
  21912. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_79curveLineIntersections(PyObject *__pyx_self,
  21913. #if CYTHON_METH_FASTCALL
  21914. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  21915. #else
  21916. PyObject *__pyx_args, PyObject *__pyx_kwds
  21917. #endif
  21918. ); /*proto*/
  21919. 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)");
  21920. 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};
  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. ) {
  21928. PyObject *__pyx_v_curve = 0;
  21929. PyObject *__pyx_v_line = 0;
  21930. #if !CYTHON_METH_FASTCALL
  21931. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  21932. #endif
  21933. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  21934. PyObject* values[2] = {0,0};
  21935. int __pyx_lineno = 0;
  21936. const char *__pyx_filename = NULL;
  21937. int __pyx_clineno = 0;
  21938. PyObject *__pyx_r = 0;
  21939. __Pyx_RefNannyDeclarations
  21940. __Pyx_RefNannySetupContext("curveLineIntersections (wrapper)", 0);
  21941. #if !CYTHON_METH_FASTCALL
  21942. #if CYTHON_ASSUME_SAFE_SIZE
  21943. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  21944. #else
  21945. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  21946. #endif
  21947. #endif
  21948. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  21949. {
  21950. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_curve,&__pyx_mstate_global->__pyx_n_u_line,0};
  21951. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  21952. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1255, __pyx_L3_error)
  21953. if (__pyx_kwds_len > 0) {
  21954. switch (__pyx_nargs) {
  21955. case 2:
  21956. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  21957. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1255, __pyx_L3_error)
  21958. CYTHON_FALLTHROUGH;
  21959. case 1:
  21960. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  21961. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1255, __pyx_L3_error)
  21962. CYTHON_FALLTHROUGH;
  21963. case 0: break;
  21964. default: goto __pyx_L5_argtuple_error;
  21965. }
  21966. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  21967. 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)
  21968. for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
  21969. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("curveLineIntersections", 1, 2, 2, i); __PYX_ERR(0, 1255, __pyx_L3_error) }
  21970. }
  21971. } else if (unlikely(__pyx_nargs != 2)) {
  21972. goto __pyx_L5_argtuple_error;
  21973. } else {
  21974. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  21975. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1255, __pyx_L3_error)
  21976. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  21977. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1255, __pyx_L3_error)
  21978. }
  21979. __pyx_v_curve = values[0];
  21980. __pyx_v_line = values[1];
  21981. }
  21982. goto __pyx_L6_skip;
  21983. __pyx_L5_argtuple_error:;
  21984. __Pyx_RaiseArgtupleInvalid("curveLineIntersections", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1255, __pyx_L3_error)
  21985. __pyx_L6_skip:;
  21986. goto __pyx_L4_argument_unpacking_done;
  21987. __pyx_L3_error:;
  21988. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  21989. Py_XDECREF(values[__pyx_temp]);
  21990. }
  21991. __Pyx_AddTraceback("fontTools.misc.bezierTools.curveLineIntersections", __pyx_clineno, __pyx_lineno, __pyx_filename);
  21992. __Pyx_RefNannyFinishContext();
  21993. return NULL;
  21994. __pyx_L4_argument_unpacking_done:;
  21995. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_78curveLineIntersections(__pyx_self, __pyx_v_curve, __pyx_v_line);
  21996. /* function exit code */
  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_RefNannyFinishContext();
  22001. return __pyx_r;
  22002. }
  22003. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_78curveLineIntersections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_curve, PyObject *__pyx_v_line) {
  22004. PyObject *__pyx_v_pointFinder = NULL;
  22005. PyObject *__pyx_v_intersections = NULL;
  22006. PyObject *__pyx_v_t = NULL;
  22007. PyObject *__pyx_v_pt = NULL;
  22008. PyObject *__pyx_v_line_t = NULL;
  22009. PyObject *__pyx_r = NULL;
  22010. __Pyx_RefNannyDeclarations
  22011. Py_ssize_t __pyx_t_1;
  22012. int __pyx_t_2;
  22013. PyObject *__pyx_t_3 = NULL;
  22014. PyObject *__pyx_t_4 = NULL;
  22015. size_t __pyx_t_5;
  22016. PyObject *__pyx_t_6 = NULL;
  22017. PyObject *(*__pyx_t_7)(PyObject *);
  22018. PyObject *__pyx_t_8 = NULL;
  22019. PyObject *__pyx_t_9 = NULL;
  22020. int __pyx_t_10;
  22021. int __pyx_lineno = 0;
  22022. const char *__pyx_filename = NULL;
  22023. int __pyx_clineno = 0;
  22024. __Pyx_RefNannySetupContext("curveLineIntersections", 0);
  22025. /* "fontTools/misc/bezierTools.py":1276
  22026. * (84.9000930760723, 189.87306176459828)
  22027. * """
  22028. * if len(curve) == 3: # <<<<<<<<<<<<<<
  22029. * pointFinder = quadraticPointAtT
  22030. * elif len(curve) == 4:
  22031. */
  22032. __pyx_t_1 = PyObject_Length(__pyx_v_curve); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1276, __pyx_L1_error)
  22033. __pyx_t_2 = (__pyx_t_1 == 3);
  22034. if (__pyx_t_2) {
  22035. /* "fontTools/misc/bezierTools.py":1277
  22036. * """
  22037. * if len(curve) == 3:
  22038. * pointFinder = quadraticPointAtT # <<<<<<<<<<<<<<
  22039. * elif len(curve) == 4:
  22040. * pointFinder = cubicPointAtT
  22041. */
  22042. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_quadraticPointAtT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1277, __pyx_L1_error)
  22043. __Pyx_GOTREF(__pyx_t_3);
  22044. __pyx_v_pointFinder = __pyx_t_3;
  22045. __pyx_t_3 = 0;
  22046. /* "fontTools/misc/bezierTools.py":1276
  22047. * (84.9000930760723, 189.87306176459828)
  22048. * """
  22049. * if len(curve) == 3: # <<<<<<<<<<<<<<
  22050. * pointFinder = quadraticPointAtT
  22051. * elif len(curve) == 4:
  22052. */
  22053. goto __pyx_L3;
  22054. }
  22055. /* "fontTools/misc/bezierTools.py":1278
  22056. * if len(curve) == 3:
  22057. * pointFinder = quadraticPointAtT
  22058. * elif len(curve) == 4: # <<<<<<<<<<<<<<
  22059. * pointFinder = cubicPointAtT
  22060. * else:
  22061. */
  22062. __pyx_t_1 = PyObject_Length(__pyx_v_curve); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1278, __pyx_L1_error)
  22063. __pyx_t_2 = (__pyx_t_1 == 4);
  22064. if (likely(__pyx_t_2)) {
  22065. /* "fontTools/misc/bezierTools.py":1279
  22066. * pointFinder = quadraticPointAtT
  22067. * elif len(curve) == 4:
  22068. * pointFinder = cubicPointAtT # <<<<<<<<<<<<<<
  22069. * else:
  22070. * raise ValueError("Unknown curve degree")
  22071. */
  22072. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_cubicPointAtT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1279, __pyx_L1_error)
  22073. __Pyx_GOTREF(__pyx_t_3);
  22074. __pyx_v_pointFinder = __pyx_t_3;
  22075. __pyx_t_3 = 0;
  22076. /* "fontTools/misc/bezierTools.py":1278
  22077. * if len(curve) == 3:
  22078. * pointFinder = quadraticPointAtT
  22079. * elif len(curve) == 4: # <<<<<<<<<<<<<<
  22080. * pointFinder = cubicPointAtT
  22081. * else:
  22082. */
  22083. goto __pyx_L3;
  22084. }
  22085. /* "fontTools/misc/bezierTools.py":1281
  22086. * pointFinder = cubicPointAtT
  22087. * else:
  22088. * raise ValueError("Unknown curve degree") # <<<<<<<<<<<<<<
  22089. * intersections = []
  22090. * for t in _curve_line_intersections_t(curve, line):
  22091. */
  22092. /*else*/ {
  22093. __pyx_t_4 = NULL;
  22094. __pyx_t_5 = 1;
  22095. {
  22096. PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Unknown_curve_degree};
  22097. __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));
  22098. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  22099. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1281, __pyx_L1_error)
  22100. __Pyx_GOTREF(__pyx_t_3);
  22101. }
  22102. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  22103. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22104. __PYX_ERR(0, 1281, __pyx_L1_error)
  22105. }
  22106. __pyx_L3:;
  22107. /* "fontTools/misc/bezierTools.py":1282
  22108. * else:
  22109. * raise ValueError("Unknown curve degree")
  22110. * intersections = [] # <<<<<<<<<<<<<<
  22111. * for t in _curve_line_intersections_t(curve, line):
  22112. * pt = pointFinder(*curve, t)
  22113. */
  22114. __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1282, __pyx_L1_error)
  22115. __Pyx_GOTREF(__pyx_t_3);
  22116. __pyx_v_intersections = ((PyObject*)__pyx_t_3);
  22117. __pyx_t_3 = 0;
  22118. /* "fontTools/misc/bezierTools.py":1283
  22119. * raise ValueError("Unknown curve degree")
  22120. * intersections = []
  22121. * for t in _curve_line_intersections_t(curve, line): # <<<<<<<<<<<<<<
  22122. * pt = pointFinder(*curve, t)
  22123. * # Back-project the point onto the line, to avoid problems with
  22124. */
  22125. __pyx_t_4 = NULL;
  22126. __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)
  22127. __Pyx_GOTREF(__pyx_t_6);
  22128. __pyx_t_5 = 1;
  22129. #if CYTHON_UNPACK_METHODS
  22130. if (unlikely(PyMethod_Check(__pyx_t_6))) {
  22131. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
  22132. assert(__pyx_t_4);
  22133. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
  22134. __Pyx_INCREF(__pyx_t_4);
  22135. __Pyx_INCREF(__pyx__function);
  22136. __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
  22137. __pyx_t_5 = 0;
  22138. }
  22139. #endif
  22140. {
  22141. PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_v_curve, __pyx_v_line};
  22142. __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));
  22143. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  22144. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  22145. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1283, __pyx_L1_error)
  22146. __Pyx_GOTREF(__pyx_t_3);
  22147. }
  22148. if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
  22149. __pyx_t_6 = __pyx_t_3; __Pyx_INCREF(__pyx_t_6);
  22150. __pyx_t_1 = 0;
  22151. __pyx_t_7 = NULL;
  22152. } else {
  22153. __pyx_t_1 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1283, __pyx_L1_error)
  22154. __Pyx_GOTREF(__pyx_t_6);
  22155. __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)
  22156. }
  22157. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22158. for (;;) {
  22159. if (likely(!__pyx_t_7)) {
  22160. if (likely(PyList_CheckExact(__pyx_t_6))) {
  22161. {
  22162. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
  22163. #if !CYTHON_ASSUME_SAFE_SIZE
  22164. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1283, __pyx_L1_error)
  22165. #endif
  22166. if (__pyx_t_1 >= __pyx_temp) break;
  22167. }
  22168. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(__pyx_t_6, __pyx_t_1, __Pyx_ReferenceSharing_OwnStrongReference);
  22169. ++__pyx_t_1;
  22170. } else {
  22171. {
  22172. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
  22173. #if !CYTHON_ASSUME_SAFE_SIZE
  22174. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1283, __pyx_L1_error)
  22175. #endif
  22176. if (__pyx_t_1 >= __pyx_temp) break;
  22177. }
  22178. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  22179. __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_1));
  22180. #else
  22181. __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_1);
  22182. #endif
  22183. ++__pyx_t_1;
  22184. }
  22185. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1283, __pyx_L1_error)
  22186. } else {
  22187. __pyx_t_3 = __pyx_t_7(__pyx_t_6);
  22188. if (unlikely(!__pyx_t_3)) {
  22189. PyObject* exc_type = PyErr_Occurred();
  22190. if (exc_type) {
  22191. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1283, __pyx_L1_error)
  22192. PyErr_Clear();
  22193. }
  22194. break;
  22195. }
  22196. }
  22197. __Pyx_GOTREF(__pyx_t_3);
  22198. __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_3);
  22199. __pyx_t_3 = 0;
  22200. /* "fontTools/misc/bezierTools.py":1284
  22201. * intersections = []
  22202. * for t in _curve_line_intersections_t(curve, line):
  22203. * pt = pointFinder(*curve, t) # <<<<<<<<<<<<<<
  22204. * # Back-project the point onto the line, to avoid problems with
  22205. * # numerical accuracy in the case of vertical and horizontal lines
  22206. */
  22207. __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_curve); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1284, __pyx_L1_error)
  22208. __Pyx_GOTREF(__pyx_t_3);
  22209. __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1284, __pyx_L1_error)
  22210. __Pyx_GOTREF(__pyx_t_4);
  22211. __Pyx_INCREF(__pyx_v_t);
  22212. __Pyx_GIVEREF(__pyx_v_t);
  22213. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_t) != (0)) __PYX_ERR(0, 1284, __pyx_L1_error);
  22214. __pyx_t_8 = PyNumber_Add(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1284, __pyx_L1_error)
  22215. __Pyx_GOTREF(__pyx_t_8);
  22216. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22217. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  22218. __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)
  22219. __Pyx_GOTREF(__pyx_t_4);
  22220. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  22221. __Pyx_XDECREF_SET(__pyx_v_pt, __pyx_t_4);
  22222. __pyx_t_4 = 0;
  22223. /* "fontTools/misc/bezierTools.py":1287
  22224. * # Back-project the point onto the line, to avoid problems with
  22225. * # numerical accuracy in the case of vertical and horizontal lines
  22226. * line_t = _line_t_of_pt(*line, pt) # <<<<<<<<<<<<<<
  22227. * pt = linePointAtT(*line, line_t)
  22228. * intersections.append(Intersection(pt=pt, t1=t, t2=line_t))
  22229. */
  22230. __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)
  22231. __Pyx_GOTREF(__pyx_t_4);
  22232. __pyx_t_8 = __Pyx_PySequence_Tuple(__pyx_v_line); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1287, __pyx_L1_error)
  22233. __Pyx_GOTREF(__pyx_t_8);
  22234. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1287, __pyx_L1_error)
  22235. __Pyx_GOTREF(__pyx_t_3);
  22236. __Pyx_INCREF(__pyx_v_pt);
  22237. __Pyx_GIVEREF(__pyx_v_pt);
  22238. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pt) != (0)) __PYX_ERR(0, 1287, __pyx_L1_error);
  22239. __pyx_t_9 = PyNumber_Add(__pyx_t_8, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1287, __pyx_L1_error)
  22240. __Pyx_GOTREF(__pyx_t_9);
  22241. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  22242. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22243. __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)
  22244. __Pyx_GOTREF(__pyx_t_3);
  22245. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  22246. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  22247. __Pyx_XDECREF_SET(__pyx_v_line_t, __pyx_t_3);
  22248. __pyx_t_3 = 0;
  22249. /* "fontTools/misc/bezierTools.py":1288
  22250. * # numerical accuracy in the case of vertical and horizontal lines
  22251. * line_t = _line_t_of_pt(*line, pt)
  22252. * pt = linePointAtT(*line, line_t) # <<<<<<<<<<<<<<
  22253. * intersections.append(Intersection(pt=pt, t1=t, t2=line_t))
  22254. * return intersections
  22255. */
  22256. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_linePointAtT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1288, __pyx_L1_error)
  22257. __Pyx_GOTREF(__pyx_t_3);
  22258. __pyx_t_9 = __Pyx_PySequence_Tuple(__pyx_v_line); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1288, __pyx_L1_error)
  22259. __Pyx_GOTREF(__pyx_t_9);
  22260. __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1288, __pyx_L1_error)
  22261. __Pyx_GOTREF(__pyx_t_4);
  22262. __Pyx_INCREF(__pyx_v_line_t);
  22263. __Pyx_GIVEREF(__pyx_v_line_t);
  22264. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_line_t) != (0)) __PYX_ERR(0, 1288, __pyx_L1_error);
  22265. __pyx_t_8 = PyNumber_Add(__pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1288, __pyx_L1_error)
  22266. __Pyx_GOTREF(__pyx_t_8);
  22267. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  22268. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  22269. __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)
  22270. __Pyx_GOTREF(__pyx_t_4);
  22271. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22272. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  22273. __Pyx_DECREF_SET(__pyx_v_pt, __pyx_t_4);
  22274. __pyx_t_4 = 0;
  22275. /* "fontTools/misc/bezierTools.py":1289
  22276. * line_t = _line_t_of_pt(*line, pt)
  22277. * pt = linePointAtT(*line, line_t)
  22278. * intersections.append(Intersection(pt=pt, t1=t, t2=line_t)) # <<<<<<<<<<<<<<
  22279. * return intersections
  22280. *
  22281. */
  22282. __pyx_t_8 = NULL;
  22283. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_Intersection); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1289, __pyx_L1_error)
  22284. __Pyx_GOTREF(__pyx_t_3);
  22285. __pyx_t_5 = 1;
  22286. #if CYTHON_UNPACK_METHODS
  22287. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  22288. __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
  22289. assert(__pyx_t_8);
  22290. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  22291. __Pyx_INCREF(__pyx_t_8);
  22292. __Pyx_INCREF(__pyx__function);
  22293. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  22294. __pyx_t_5 = 0;
  22295. }
  22296. #endif
  22297. {
  22298. PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_8, NULL};
  22299. __pyx_t_9 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1289, __pyx_L1_error)
  22300. __Pyx_GOTREF(__pyx_t_9);
  22301. 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)
  22302. 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)
  22303. 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)
  22304. __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);
  22305. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  22306. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  22307. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22308. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1289, __pyx_L1_error)
  22309. __Pyx_GOTREF(__pyx_t_4);
  22310. }
  22311. __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)
  22312. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  22313. /* "fontTools/misc/bezierTools.py":1283
  22314. * raise ValueError("Unknown curve degree")
  22315. * intersections = []
  22316. * for t in _curve_line_intersections_t(curve, line): # <<<<<<<<<<<<<<
  22317. * pt = pointFinder(*curve, t)
  22318. * # Back-project the point onto the line, to avoid problems with
  22319. */
  22320. }
  22321. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  22322. /* "fontTools/misc/bezierTools.py":1290
  22323. * pt = linePointAtT(*line, line_t)
  22324. * intersections.append(Intersection(pt=pt, t1=t, t2=line_t))
  22325. * return intersections # <<<<<<<<<<<<<<
  22326. *
  22327. *
  22328. */
  22329. __Pyx_XDECREF(__pyx_r);
  22330. __Pyx_INCREF(__pyx_v_intersections);
  22331. __pyx_r = __pyx_v_intersections;
  22332. goto __pyx_L0;
  22333. /* "fontTools/misc/bezierTools.py":1255
  22334. *
  22335. *
  22336. * def curveLineIntersections(curve, line): # <<<<<<<<<<<<<<
  22337. * """Finds intersections between a curve and a line.
  22338. *
  22339. */
  22340. /* function exit code */
  22341. __pyx_L1_error:;
  22342. __Pyx_XDECREF(__pyx_t_3);
  22343. __Pyx_XDECREF(__pyx_t_4);
  22344. __Pyx_XDECREF(__pyx_t_6);
  22345. __Pyx_XDECREF(__pyx_t_8);
  22346. __Pyx_XDECREF(__pyx_t_9);
  22347. __Pyx_AddTraceback("fontTools.misc.bezierTools.curveLineIntersections", __pyx_clineno, __pyx_lineno, __pyx_filename);
  22348. __pyx_r = NULL;
  22349. __pyx_L0:;
  22350. __Pyx_XDECREF(__pyx_v_pointFinder);
  22351. __Pyx_XDECREF(__pyx_v_intersections);
  22352. __Pyx_XDECREF(__pyx_v_t);
  22353. __Pyx_XDECREF(__pyx_v_pt);
  22354. __Pyx_XDECREF(__pyx_v_line_t);
  22355. __Pyx_XGIVEREF(__pyx_r);
  22356. __Pyx_RefNannyFinishContext();
  22357. return __pyx_r;
  22358. }
  22359. /* "fontTools/misc/bezierTools.py":1293
  22360. *
  22361. *
  22362. * def _curve_bounds(c): # <<<<<<<<<<<<<<
  22363. * if len(c) == 3:
  22364. * return calcQuadraticBounds(*c)
  22365. */
  22366. /* Python wrapper */
  22367. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_81_curve_bounds(PyObject *__pyx_self,
  22368. #if CYTHON_METH_FASTCALL
  22369. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  22370. #else
  22371. PyObject *__pyx_args, PyObject *__pyx_kwds
  22372. #endif
  22373. ); /*proto*/
  22374. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_80_curve_bounds, "_curve_bounds(c)");
  22375. 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};
  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. ) {
  22383. PyObject *__pyx_v_c = 0;
  22384. #if !CYTHON_METH_FASTCALL
  22385. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  22386. #endif
  22387. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  22388. PyObject* values[1] = {0};
  22389. int __pyx_lineno = 0;
  22390. const char *__pyx_filename = NULL;
  22391. int __pyx_clineno = 0;
  22392. PyObject *__pyx_r = 0;
  22393. __Pyx_RefNannyDeclarations
  22394. __Pyx_RefNannySetupContext("_curve_bounds (wrapper)", 0);
  22395. #if !CYTHON_METH_FASTCALL
  22396. #if CYTHON_ASSUME_SAFE_SIZE
  22397. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  22398. #else
  22399. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  22400. #endif
  22401. #endif
  22402. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  22403. {
  22404. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_c,0};
  22405. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  22406. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1293, __pyx_L3_error)
  22407. if (__pyx_kwds_len > 0) {
  22408. switch (__pyx_nargs) {
  22409. case 1:
  22410. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  22411. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1293, __pyx_L3_error)
  22412. CYTHON_FALLTHROUGH;
  22413. case 0: break;
  22414. default: goto __pyx_L5_argtuple_error;
  22415. }
  22416. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  22417. 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)
  22418. for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
  22419. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_curve_bounds", 1, 1, 1, i); __PYX_ERR(0, 1293, __pyx_L3_error) }
  22420. }
  22421. } else if (unlikely(__pyx_nargs != 1)) {
  22422. goto __pyx_L5_argtuple_error;
  22423. } else {
  22424. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  22425. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1293, __pyx_L3_error)
  22426. }
  22427. __pyx_v_c = values[0];
  22428. }
  22429. goto __pyx_L6_skip;
  22430. __pyx_L5_argtuple_error:;
  22431. __Pyx_RaiseArgtupleInvalid("_curve_bounds", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1293, __pyx_L3_error)
  22432. __pyx_L6_skip:;
  22433. goto __pyx_L4_argument_unpacking_done;
  22434. __pyx_L3_error:;
  22435. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  22436. Py_XDECREF(values[__pyx_temp]);
  22437. }
  22438. __Pyx_AddTraceback("fontTools.misc.bezierTools._curve_bounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  22439. __Pyx_RefNannyFinishContext();
  22440. return NULL;
  22441. __pyx_L4_argument_unpacking_done:;
  22442. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_80_curve_bounds(__pyx_self, __pyx_v_c);
  22443. /* function exit code */
  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_RefNannyFinishContext();
  22448. return __pyx_r;
  22449. }
  22450. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_80_curve_bounds(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_c) {
  22451. PyObject *__pyx_r = NULL;
  22452. __Pyx_RefNannyDeclarations
  22453. Py_ssize_t __pyx_t_1;
  22454. int __pyx_t_2;
  22455. PyObject *__pyx_t_3 = NULL;
  22456. PyObject *__pyx_t_4 = NULL;
  22457. PyObject *__pyx_t_5 = NULL;
  22458. size_t __pyx_t_6;
  22459. int __pyx_lineno = 0;
  22460. const char *__pyx_filename = NULL;
  22461. int __pyx_clineno = 0;
  22462. __Pyx_RefNannySetupContext("_curve_bounds", 0);
  22463. /* "fontTools/misc/bezierTools.py":1294
  22464. *
  22465. * def _curve_bounds(c):
  22466. * if len(c) == 3: # <<<<<<<<<<<<<<
  22467. * return calcQuadraticBounds(*c)
  22468. * elif len(c) == 4:
  22469. */
  22470. __pyx_t_1 = PyObject_Length(__pyx_v_c); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1294, __pyx_L1_error)
  22471. __pyx_t_2 = (__pyx_t_1 == 3);
  22472. if (__pyx_t_2) {
  22473. /* "fontTools/misc/bezierTools.py":1295
  22474. * def _curve_bounds(c):
  22475. * if len(c) == 3:
  22476. * return calcQuadraticBounds(*c) # <<<<<<<<<<<<<<
  22477. * elif len(c) == 4:
  22478. * return calcCubicBounds(*c)
  22479. */
  22480. __Pyx_XDECREF(__pyx_r);
  22481. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_calcQuadraticBounds); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1295, __pyx_L1_error)
  22482. __Pyx_GOTREF(__pyx_t_3);
  22483. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_c); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1295, __pyx_L1_error)
  22484. __Pyx_GOTREF(__pyx_t_4);
  22485. __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)
  22486. __Pyx_GOTREF(__pyx_t_5);
  22487. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22488. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  22489. __pyx_r = __pyx_t_5;
  22490. __pyx_t_5 = 0;
  22491. goto __pyx_L0;
  22492. /* "fontTools/misc/bezierTools.py":1294
  22493. *
  22494. * def _curve_bounds(c):
  22495. * if len(c) == 3: # <<<<<<<<<<<<<<
  22496. * return calcQuadraticBounds(*c)
  22497. * elif len(c) == 4:
  22498. */
  22499. }
  22500. /* "fontTools/misc/bezierTools.py":1296
  22501. * if len(c) == 3:
  22502. * return calcQuadraticBounds(*c)
  22503. * elif len(c) == 4: # <<<<<<<<<<<<<<
  22504. * return calcCubicBounds(*c)
  22505. * raise ValueError("Unknown curve degree")
  22506. */
  22507. __pyx_t_1 = PyObject_Length(__pyx_v_c); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1296, __pyx_L1_error)
  22508. __pyx_t_2 = (__pyx_t_1 == 4);
  22509. if (__pyx_t_2) {
  22510. /* "fontTools/misc/bezierTools.py":1297
  22511. * return calcQuadraticBounds(*c)
  22512. * elif len(c) == 4:
  22513. * return calcCubicBounds(*c) # <<<<<<<<<<<<<<
  22514. * raise ValueError("Unknown curve degree")
  22515. *
  22516. */
  22517. __Pyx_XDECREF(__pyx_r);
  22518. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_calcCubicBounds); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1297, __pyx_L1_error)
  22519. __Pyx_GOTREF(__pyx_t_5);
  22520. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_c); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1297, __pyx_L1_error)
  22521. __Pyx_GOTREF(__pyx_t_4);
  22522. __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)
  22523. __Pyx_GOTREF(__pyx_t_3);
  22524. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  22525. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  22526. __pyx_r = __pyx_t_3;
  22527. __pyx_t_3 = 0;
  22528. goto __pyx_L0;
  22529. /* "fontTools/misc/bezierTools.py":1296
  22530. * if len(c) == 3:
  22531. * return calcQuadraticBounds(*c)
  22532. * elif len(c) == 4: # <<<<<<<<<<<<<<
  22533. * return calcCubicBounds(*c)
  22534. * raise ValueError("Unknown curve degree")
  22535. */
  22536. }
  22537. /* "fontTools/misc/bezierTools.py":1298
  22538. * elif len(c) == 4:
  22539. * return calcCubicBounds(*c)
  22540. * raise ValueError("Unknown curve degree") # <<<<<<<<<<<<<<
  22541. *
  22542. *
  22543. */
  22544. __pyx_t_4 = NULL;
  22545. __pyx_t_6 = 1;
  22546. {
  22547. PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Unknown_curve_degree};
  22548. __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));
  22549. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  22550. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1298, __pyx_L1_error)
  22551. __Pyx_GOTREF(__pyx_t_3);
  22552. }
  22553. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  22554. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22555. __PYX_ERR(0, 1298, __pyx_L1_error)
  22556. /* "fontTools/misc/bezierTools.py":1293
  22557. *
  22558. *
  22559. * def _curve_bounds(c): # <<<<<<<<<<<<<<
  22560. * if len(c) == 3:
  22561. * return calcQuadraticBounds(*c)
  22562. */
  22563. /* function exit code */
  22564. __pyx_L1_error:;
  22565. __Pyx_XDECREF(__pyx_t_3);
  22566. __Pyx_XDECREF(__pyx_t_4);
  22567. __Pyx_XDECREF(__pyx_t_5);
  22568. __Pyx_AddTraceback("fontTools.misc.bezierTools._curve_bounds", __pyx_clineno, __pyx_lineno, __pyx_filename);
  22569. __pyx_r = NULL;
  22570. __pyx_L0:;
  22571. __Pyx_XGIVEREF(__pyx_r);
  22572. __Pyx_RefNannyFinishContext();
  22573. return __pyx_r;
  22574. }
  22575. /* "fontTools/misc/bezierTools.py":1301
  22576. *
  22577. *
  22578. * def _split_segment_at_t(c, t): # <<<<<<<<<<<<<<
  22579. * if len(c) == 2:
  22580. * s, e = c
  22581. */
  22582. /* Python wrapper */
  22583. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_83_split_segment_at_t(PyObject *__pyx_self,
  22584. #if CYTHON_METH_FASTCALL
  22585. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  22586. #else
  22587. PyObject *__pyx_args, PyObject *__pyx_kwds
  22588. #endif
  22589. ); /*proto*/
  22590. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_82_split_segment_at_t, "_split_segment_at_t(c, t)");
  22591. 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};
  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. ) {
  22599. PyObject *__pyx_v_c = 0;
  22600. PyObject *__pyx_v_t = 0;
  22601. #if !CYTHON_METH_FASTCALL
  22602. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  22603. #endif
  22604. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  22605. PyObject* values[2] = {0,0};
  22606. int __pyx_lineno = 0;
  22607. const char *__pyx_filename = NULL;
  22608. int __pyx_clineno = 0;
  22609. PyObject *__pyx_r = 0;
  22610. __Pyx_RefNannyDeclarations
  22611. __Pyx_RefNannySetupContext("_split_segment_at_t (wrapper)", 0);
  22612. #if !CYTHON_METH_FASTCALL
  22613. #if CYTHON_ASSUME_SAFE_SIZE
  22614. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  22615. #else
  22616. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  22617. #endif
  22618. #endif
  22619. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  22620. {
  22621. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_c,&__pyx_mstate_global->__pyx_n_u_t,0};
  22622. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  22623. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1301, __pyx_L3_error)
  22624. if (__pyx_kwds_len > 0) {
  22625. switch (__pyx_nargs) {
  22626. case 2:
  22627. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  22628. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1301, __pyx_L3_error)
  22629. CYTHON_FALLTHROUGH;
  22630. case 1:
  22631. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  22632. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1301, __pyx_L3_error)
  22633. CYTHON_FALLTHROUGH;
  22634. case 0: break;
  22635. default: goto __pyx_L5_argtuple_error;
  22636. }
  22637. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  22638. 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)
  22639. for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
  22640. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_split_segment_at_t", 1, 2, 2, i); __PYX_ERR(0, 1301, __pyx_L3_error) }
  22641. }
  22642. } else if (unlikely(__pyx_nargs != 2)) {
  22643. goto __pyx_L5_argtuple_error;
  22644. } else {
  22645. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  22646. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1301, __pyx_L3_error)
  22647. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  22648. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1301, __pyx_L3_error)
  22649. }
  22650. __pyx_v_c = values[0];
  22651. __pyx_v_t = values[1];
  22652. }
  22653. goto __pyx_L6_skip;
  22654. __pyx_L5_argtuple_error:;
  22655. __Pyx_RaiseArgtupleInvalid("_split_segment_at_t", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1301, __pyx_L3_error)
  22656. __pyx_L6_skip:;
  22657. goto __pyx_L4_argument_unpacking_done;
  22658. __pyx_L3_error:;
  22659. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  22660. Py_XDECREF(values[__pyx_temp]);
  22661. }
  22662. __Pyx_AddTraceback("fontTools.misc.bezierTools._split_segment_at_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  22663. __Pyx_RefNannyFinishContext();
  22664. return NULL;
  22665. __pyx_L4_argument_unpacking_done:;
  22666. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_82_split_segment_at_t(__pyx_self, __pyx_v_c, __pyx_v_t);
  22667. /* function exit code */
  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_RefNannyFinishContext();
  22672. return __pyx_r;
  22673. }
  22674. 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) {
  22675. PyObject *__pyx_v_s = NULL;
  22676. PyObject *__pyx_v_e = NULL;
  22677. PyObject *__pyx_v_midpoint = NULL;
  22678. PyObject *__pyx_r = NULL;
  22679. __Pyx_RefNannyDeclarations
  22680. Py_ssize_t __pyx_t_1;
  22681. int __pyx_t_2;
  22682. PyObject *__pyx_t_3 = NULL;
  22683. PyObject *__pyx_t_4 = NULL;
  22684. PyObject *__pyx_t_5 = NULL;
  22685. PyObject *(*__pyx_t_6)(PyObject *);
  22686. size_t __pyx_t_7;
  22687. PyObject *__pyx_t_8 = NULL;
  22688. int __pyx_lineno = 0;
  22689. const char *__pyx_filename = NULL;
  22690. int __pyx_clineno = 0;
  22691. __Pyx_RefNannySetupContext("_split_segment_at_t", 0);
  22692. /* "fontTools/misc/bezierTools.py":1302
  22693. *
  22694. * def _split_segment_at_t(c, t):
  22695. * if len(c) == 2: # <<<<<<<<<<<<<<
  22696. * s, e = c
  22697. * midpoint = linePointAtT(s, e, t)
  22698. */
  22699. __pyx_t_1 = PyObject_Length(__pyx_v_c); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1302, __pyx_L1_error)
  22700. __pyx_t_2 = (__pyx_t_1 == 2);
  22701. if (__pyx_t_2) {
  22702. /* "fontTools/misc/bezierTools.py":1303
  22703. * def _split_segment_at_t(c, t):
  22704. * if len(c) == 2:
  22705. * s, e = c # <<<<<<<<<<<<<<
  22706. * midpoint = linePointAtT(s, e, t)
  22707. * return [(s, midpoint), (midpoint, e)]
  22708. */
  22709. if ((likely(PyTuple_CheckExact(__pyx_v_c))) || (PyList_CheckExact(__pyx_v_c))) {
  22710. PyObject* sequence = __pyx_v_c;
  22711. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  22712. if (unlikely(size != 2)) {
  22713. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  22714. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  22715. __PYX_ERR(0, 1303, __pyx_L1_error)
  22716. }
  22717. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  22718. if (likely(PyTuple_CheckExact(sequence))) {
  22719. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  22720. __Pyx_INCREF(__pyx_t_3);
  22721. __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
  22722. __Pyx_INCREF(__pyx_t_4);
  22723. } else {
  22724. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  22725. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1303, __pyx_L1_error)
  22726. __Pyx_XGOTREF(__pyx_t_3);
  22727. __pyx_t_4 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  22728. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1303, __pyx_L1_error)
  22729. __Pyx_XGOTREF(__pyx_t_4);
  22730. }
  22731. #else
  22732. __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1303, __pyx_L1_error)
  22733. __Pyx_GOTREF(__pyx_t_3);
  22734. __pyx_t_4 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1303, __pyx_L1_error)
  22735. __Pyx_GOTREF(__pyx_t_4);
  22736. #endif
  22737. } else {
  22738. Py_ssize_t index = -1;
  22739. __pyx_t_5 = PyObject_GetIter(__pyx_v_c); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1303, __pyx_L1_error)
  22740. __Pyx_GOTREF(__pyx_t_5);
  22741. __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5);
  22742. index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
  22743. __Pyx_GOTREF(__pyx_t_3);
  22744. index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
  22745. __Pyx_GOTREF(__pyx_t_4);
  22746. if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < (0)) __PYX_ERR(0, 1303, __pyx_L1_error)
  22747. __pyx_t_6 = NULL;
  22748. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  22749. goto __pyx_L5_unpacking_done;
  22750. __pyx_L4_unpacking_failed:;
  22751. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  22752. __pyx_t_6 = NULL;
  22753. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  22754. __PYX_ERR(0, 1303, __pyx_L1_error)
  22755. __pyx_L5_unpacking_done:;
  22756. }
  22757. __pyx_v_s = __pyx_t_3;
  22758. __pyx_t_3 = 0;
  22759. __pyx_v_e = __pyx_t_4;
  22760. __pyx_t_4 = 0;
  22761. /* "fontTools/misc/bezierTools.py":1304
  22762. * if len(c) == 2:
  22763. * s, e = c
  22764. * midpoint = linePointAtT(s, e, t) # <<<<<<<<<<<<<<
  22765. * return [(s, midpoint), (midpoint, e)]
  22766. * if len(c) == 3:
  22767. */
  22768. __pyx_t_3 = NULL;
  22769. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_linePointAtT); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1304, __pyx_L1_error)
  22770. __Pyx_GOTREF(__pyx_t_5);
  22771. __pyx_t_7 = 1;
  22772. #if CYTHON_UNPACK_METHODS
  22773. if (unlikely(PyMethod_Check(__pyx_t_5))) {
  22774. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
  22775. assert(__pyx_t_3);
  22776. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
  22777. __Pyx_INCREF(__pyx_t_3);
  22778. __Pyx_INCREF(__pyx__function);
  22779. __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
  22780. __pyx_t_7 = 0;
  22781. }
  22782. #endif
  22783. {
  22784. PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_v_s, __pyx_v_e, __pyx_v_t};
  22785. __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));
  22786. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  22787. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  22788. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1304, __pyx_L1_error)
  22789. __Pyx_GOTREF(__pyx_t_4);
  22790. }
  22791. __pyx_v_midpoint = __pyx_t_4;
  22792. __pyx_t_4 = 0;
  22793. /* "fontTools/misc/bezierTools.py":1305
  22794. * s, e = c
  22795. * midpoint = linePointAtT(s, e, t)
  22796. * return [(s, midpoint), (midpoint, e)] # <<<<<<<<<<<<<<
  22797. * if len(c) == 3:
  22798. * return splitQuadraticAtT(*c, t)
  22799. */
  22800. __Pyx_XDECREF(__pyx_r);
  22801. __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1305, __pyx_L1_error)
  22802. __Pyx_GOTREF(__pyx_t_4);
  22803. __Pyx_INCREF(__pyx_v_s);
  22804. __Pyx_GIVEREF(__pyx_v_s);
  22805. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_s) != (0)) __PYX_ERR(0, 1305, __pyx_L1_error);
  22806. __Pyx_INCREF(__pyx_v_midpoint);
  22807. __Pyx_GIVEREF(__pyx_v_midpoint);
  22808. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_midpoint) != (0)) __PYX_ERR(0, 1305, __pyx_L1_error);
  22809. __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1305, __pyx_L1_error)
  22810. __Pyx_GOTREF(__pyx_t_5);
  22811. __Pyx_INCREF(__pyx_v_midpoint);
  22812. __Pyx_GIVEREF(__pyx_v_midpoint);
  22813. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_midpoint) != (0)) __PYX_ERR(0, 1305, __pyx_L1_error);
  22814. __Pyx_INCREF(__pyx_v_e);
  22815. __Pyx_GIVEREF(__pyx_v_e);
  22816. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_e) != (0)) __PYX_ERR(0, 1305, __pyx_L1_error);
  22817. __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1305, __pyx_L1_error)
  22818. __Pyx_GOTREF(__pyx_t_3);
  22819. __Pyx_GIVEREF(__pyx_t_4);
  22820. if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_4) != (0)) __PYX_ERR(0, 1305, __pyx_L1_error);
  22821. __Pyx_GIVEREF(__pyx_t_5);
  22822. if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_5) != (0)) __PYX_ERR(0, 1305, __pyx_L1_error);
  22823. __pyx_t_4 = 0;
  22824. __pyx_t_5 = 0;
  22825. __pyx_r = __pyx_t_3;
  22826. __pyx_t_3 = 0;
  22827. goto __pyx_L0;
  22828. /* "fontTools/misc/bezierTools.py":1302
  22829. *
  22830. * def _split_segment_at_t(c, t):
  22831. * if len(c) == 2: # <<<<<<<<<<<<<<
  22832. * s, e = c
  22833. * midpoint = linePointAtT(s, e, t)
  22834. */
  22835. }
  22836. /* "fontTools/misc/bezierTools.py":1306
  22837. * midpoint = linePointAtT(s, e, t)
  22838. * return [(s, midpoint), (midpoint, e)]
  22839. * if len(c) == 3: # <<<<<<<<<<<<<<
  22840. * return splitQuadraticAtT(*c, t)
  22841. * elif len(c) == 4:
  22842. */
  22843. __pyx_t_1 = PyObject_Length(__pyx_v_c); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1306, __pyx_L1_error)
  22844. __pyx_t_2 = (__pyx_t_1 == 3);
  22845. if (__pyx_t_2) {
  22846. /* "fontTools/misc/bezierTools.py":1307
  22847. * return [(s, midpoint), (midpoint, e)]
  22848. * if len(c) == 3:
  22849. * return splitQuadraticAtT(*c, t) # <<<<<<<<<<<<<<
  22850. * elif len(c) == 4:
  22851. * return splitCubicAtT(*c, t)
  22852. */
  22853. __Pyx_XDECREF(__pyx_r);
  22854. __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)
  22855. __Pyx_GOTREF(__pyx_t_3);
  22856. __pyx_t_5 = __Pyx_PySequence_Tuple(__pyx_v_c); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1307, __pyx_L1_error)
  22857. __Pyx_GOTREF(__pyx_t_5);
  22858. __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1307, __pyx_L1_error)
  22859. __Pyx_GOTREF(__pyx_t_4);
  22860. __Pyx_INCREF(__pyx_v_t);
  22861. __Pyx_GIVEREF(__pyx_v_t);
  22862. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_t) != (0)) __PYX_ERR(0, 1307, __pyx_L1_error);
  22863. __pyx_t_8 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1307, __pyx_L1_error)
  22864. __Pyx_GOTREF(__pyx_t_8);
  22865. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  22866. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  22867. __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)
  22868. __Pyx_GOTREF(__pyx_t_4);
  22869. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22870. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  22871. __pyx_r = __pyx_t_4;
  22872. __pyx_t_4 = 0;
  22873. goto __pyx_L0;
  22874. /* "fontTools/misc/bezierTools.py":1306
  22875. * midpoint = linePointAtT(s, e, t)
  22876. * return [(s, midpoint), (midpoint, e)]
  22877. * if len(c) == 3: # <<<<<<<<<<<<<<
  22878. * return splitQuadraticAtT(*c, t)
  22879. * elif len(c) == 4:
  22880. */
  22881. }
  22882. /* "fontTools/misc/bezierTools.py":1308
  22883. * if len(c) == 3:
  22884. * return splitQuadraticAtT(*c, t)
  22885. * elif len(c) == 4: # <<<<<<<<<<<<<<
  22886. * return splitCubicAtT(*c, t)
  22887. * raise ValueError("Unknown curve degree")
  22888. */
  22889. __pyx_t_1 = PyObject_Length(__pyx_v_c); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1308, __pyx_L1_error)
  22890. __pyx_t_2 = (__pyx_t_1 == 4);
  22891. if (__pyx_t_2) {
  22892. /* "fontTools/misc/bezierTools.py":1309
  22893. * return splitQuadraticAtT(*c, t)
  22894. * elif len(c) == 4:
  22895. * return splitCubicAtT(*c, t) # <<<<<<<<<<<<<<
  22896. * raise ValueError("Unknown curve degree")
  22897. *
  22898. */
  22899. __Pyx_XDECREF(__pyx_r);
  22900. __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)
  22901. __Pyx_GOTREF(__pyx_t_4);
  22902. __pyx_t_8 = __Pyx_PySequence_Tuple(__pyx_v_c); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1309, __pyx_L1_error)
  22903. __Pyx_GOTREF(__pyx_t_8);
  22904. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1309, __pyx_L1_error)
  22905. __Pyx_GOTREF(__pyx_t_3);
  22906. __Pyx_INCREF(__pyx_v_t);
  22907. __Pyx_GIVEREF(__pyx_v_t);
  22908. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_t) != (0)) __PYX_ERR(0, 1309, __pyx_L1_error);
  22909. __pyx_t_5 = PyNumber_Add(__pyx_t_8, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1309, __pyx_L1_error)
  22910. __Pyx_GOTREF(__pyx_t_5);
  22911. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  22912. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22913. __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)
  22914. __Pyx_GOTREF(__pyx_t_3);
  22915. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  22916. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  22917. __pyx_r = __pyx_t_3;
  22918. __pyx_t_3 = 0;
  22919. goto __pyx_L0;
  22920. /* "fontTools/misc/bezierTools.py":1308
  22921. * if len(c) == 3:
  22922. * return splitQuadraticAtT(*c, t)
  22923. * elif len(c) == 4: # <<<<<<<<<<<<<<
  22924. * return splitCubicAtT(*c, t)
  22925. * raise ValueError("Unknown curve degree")
  22926. */
  22927. }
  22928. /* "fontTools/misc/bezierTools.py":1310
  22929. * elif len(c) == 4:
  22930. * return splitCubicAtT(*c, t)
  22931. * raise ValueError("Unknown curve degree") # <<<<<<<<<<<<<<
  22932. *
  22933. *
  22934. */
  22935. __pyx_t_5 = NULL;
  22936. __pyx_t_7 = 1;
  22937. {
  22938. PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Unknown_curve_degree};
  22939. __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));
  22940. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  22941. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1310, __pyx_L1_error)
  22942. __Pyx_GOTREF(__pyx_t_3);
  22943. }
  22944. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  22945. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  22946. __PYX_ERR(0, 1310, __pyx_L1_error)
  22947. /* "fontTools/misc/bezierTools.py":1301
  22948. *
  22949. *
  22950. * def _split_segment_at_t(c, t): # <<<<<<<<<<<<<<
  22951. * if len(c) == 2:
  22952. * s, e = c
  22953. */
  22954. /* function exit code */
  22955. __pyx_L1_error:;
  22956. __Pyx_XDECREF(__pyx_t_3);
  22957. __Pyx_XDECREF(__pyx_t_4);
  22958. __Pyx_XDECREF(__pyx_t_5);
  22959. __Pyx_XDECREF(__pyx_t_8);
  22960. __Pyx_AddTraceback("fontTools.misc.bezierTools._split_segment_at_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  22961. __pyx_r = NULL;
  22962. __pyx_L0:;
  22963. __Pyx_XDECREF(__pyx_v_s);
  22964. __Pyx_XDECREF(__pyx_v_e);
  22965. __Pyx_XDECREF(__pyx_v_midpoint);
  22966. __Pyx_XGIVEREF(__pyx_r);
  22967. __Pyx_RefNannyFinishContext();
  22968. return __pyx_r;
  22969. }
  22970. /* "fontTools/misc/bezierTools.py":1313
  22971. *
  22972. *
  22973. * def _curve_curve_intersections_t( # <<<<<<<<<<<<<<
  22974. * curve1, curve2, precision=1e-3, range1=None, range2=None
  22975. * ):
  22976. */
  22977. /* Python wrapper */
  22978. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_85_curve_curve_intersections_t(PyObject *__pyx_self,
  22979. #if CYTHON_METH_FASTCALL
  22980. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  22981. #else
  22982. PyObject *__pyx_args, PyObject *__pyx_kwds
  22983. #endif
  22984. ); /*proto*/
  22985. 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)");
  22986. 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};
  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. ) {
  22994. PyObject *__pyx_v_curve1 = 0;
  22995. PyObject *__pyx_v_curve2 = 0;
  22996. PyObject *__pyx_v_precision = 0;
  22997. PyObject *__pyx_v_range1 = 0;
  22998. PyObject *__pyx_v_range2 = 0;
  22999. #if !CYTHON_METH_FASTCALL
  23000. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  23001. #endif
  23002. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  23003. PyObject* values[5] = {0,0,0,0,0};
  23004. int __pyx_lineno = 0;
  23005. const char *__pyx_filename = NULL;
  23006. int __pyx_clineno = 0;
  23007. PyObject *__pyx_r = 0;
  23008. __Pyx_RefNannyDeclarations
  23009. __Pyx_RefNannySetupContext("_curve_curve_intersections_t (wrapper)", 0);
  23010. #if !CYTHON_METH_FASTCALL
  23011. #if CYTHON_ASSUME_SAFE_SIZE
  23012. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  23013. #else
  23014. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  23015. #endif
  23016. #endif
  23017. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  23018. {
  23019. 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};
  23020. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  23021. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1313, __pyx_L3_error)
  23022. if (__pyx_kwds_len > 0) {
  23023. switch (__pyx_nargs) {
  23024. case 5:
  23025. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  23026. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1313, __pyx_L3_error)
  23027. CYTHON_FALLTHROUGH;
  23028. case 4:
  23029. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  23030. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1313, __pyx_L3_error)
  23031. CYTHON_FALLTHROUGH;
  23032. case 3:
  23033. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  23034. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1313, __pyx_L3_error)
  23035. CYTHON_FALLTHROUGH;
  23036. case 2:
  23037. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  23038. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1313, __pyx_L3_error)
  23039. CYTHON_FALLTHROUGH;
  23040. case 1:
  23041. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  23042. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1313, __pyx_L3_error)
  23043. CYTHON_FALLTHROUGH;
  23044. case 0: break;
  23045. default: goto __pyx_L5_argtuple_error;
  23046. }
  23047. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  23048. 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)
  23049. if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_float_1eneg_3)));
  23050. /* "fontTools/misc/bezierTools.py":1314
  23051. *
  23052. * def _curve_curve_intersections_t(
  23053. * curve1, curve2, precision=1e-3, range1=None, range2=None # <<<<<<<<<<<<<<
  23054. * ):
  23055. * bounds1 = _curve_bounds(curve1)
  23056. */
  23057. if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
  23058. if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
  23059. for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
  23060. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_curve_curve_intersections_t", 0, 2, 5, i); __PYX_ERR(0, 1313, __pyx_L3_error) }
  23061. }
  23062. } else {
  23063. switch (__pyx_nargs) {
  23064. case 5:
  23065. values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
  23066. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 1313, __pyx_L3_error)
  23067. CYTHON_FALLTHROUGH;
  23068. case 4:
  23069. values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
  23070. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1313, __pyx_L3_error)
  23071. CYTHON_FALLTHROUGH;
  23072. case 3:
  23073. values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
  23074. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1313, __pyx_L3_error)
  23075. CYTHON_FALLTHROUGH;
  23076. case 2:
  23077. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  23078. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1313, __pyx_L3_error)
  23079. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  23080. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1313, __pyx_L3_error)
  23081. break;
  23082. default: goto __pyx_L5_argtuple_error;
  23083. }
  23084. if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)__pyx_mstate_global->__pyx_float_1eneg_3)));
  23085. if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
  23086. if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
  23087. }
  23088. __pyx_v_curve1 = values[0];
  23089. __pyx_v_curve2 = values[1];
  23090. __pyx_v_precision = values[2];
  23091. __pyx_v_range1 = values[3];
  23092. __pyx_v_range2 = values[4];
  23093. }
  23094. goto __pyx_L6_skip;
  23095. __pyx_L5_argtuple_error:;
  23096. __Pyx_RaiseArgtupleInvalid("_curve_curve_intersections_t", 0, 2, 5, __pyx_nargs); __PYX_ERR(0, 1313, __pyx_L3_error)
  23097. __pyx_L6_skip:;
  23098. goto __pyx_L4_argument_unpacking_done;
  23099. __pyx_L3_error:;
  23100. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  23101. Py_XDECREF(values[__pyx_temp]);
  23102. }
  23103. __Pyx_AddTraceback("fontTools.misc.bezierTools._curve_curve_intersections_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  23104. __Pyx_RefNannyFinishContext();
  23105. return NULL;
  23106. __pyx_L4_argument_unpacking_done:;
  23107. __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);
  23108. /* "fontTools/misc/bezierTools.py":1313
  23109. *
  23110. *
  23111. * def _curve_curve_intersections_t( # <<<<<<<<<<<<<<
  23112. * curve1, curve2, precision=1e-3, range1=None, range2=None
  23113. * ):
  23114. */
  23115. /* function exit code */
  23116. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  23117. Py_XDECREF(values[__pyx_temp]);
  23118. }
  23119. __Pyx_RefNannyFinishContext();
  23120. return __pyx_r;
  23121. }
  23122. /* "fontTools/misc/bezierTools.py":1329
  23123. * return []
  23124. *
  23125. * def midpoint(r): # <<<<<<<<<<<<<<
  23126. * return 0.5 * (r[0] + r[1])
  23127. *
  23128. */
  23129. /* Python wrapper */
  23130. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_1midpoint(PyObject *__pyx_self,
  23131. #if CYTHON_METH_FASTCALL
  23132. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  23133. #else
  23134. PyObject *__pyx_args, PyObject *__pyx_kwds
  23135. #endif
  23136. ); /*proto*/
  23137. 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};
  23138. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_1midpoint(PyObject *__pyx_self,
  23139. #if CYTHON_METH_FASTCALL
  23140. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  23141. #else
  23142. PyObject *__pyx_args, PyObject *__pyx_kwds
  23143. #endif
  23144. ) {
  23145. PyObject *__pyx_v_r = 0;
  23146. #if !CYTHON_METH_FASTCALL
  23147. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  23148. #endif
  23149. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  23150. PyObject* values[1] = {0};
  23151. int __pyx_lineno = 0;
  23152. const char *__pyx_filename = NULL;
  23153. int __pyx_clineno = 0;
  23154. PyObject *__pyx_r = 0;
  23155. __Pyx_RefNannyDeclarations
  23156. __Pyx_RefNannySetupContext("midpoint (wrapper)", 0);
  23157. #if !CYTHON_METH_FASTCALL
  23158. #if CYTHON_ASSUME_SAFE_SIZE
  23159. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  23160. #else
  23161. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  23162. #endif
  23163. #endif
  23164. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  23165. {
  23166. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_r,0};
  23167. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  23168. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1329, __pyx_L3_error)
  23169. if (__pyx_kwds_len > 0) {
  23170. switch (__pyx_nargs) {
  23171. case 1:
  23172. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  23173. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1329, __pyx_L3_error)
  23174. CYTHON_FALLTHROUGH;
  23175. case 0: break;
  23176. default: goto __pyx_L5_argtuple_error;
  23177. }
  23178. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  23179. 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)
  23180. for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
  23181. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("midpoint", 1, 1, 1, i); __PYX_ERR(0, 1329, __pyx_L3_error) }
  23182. }
  23183. } else if (unlikely(__pyx_nargs != 1)) {
  23184. goto __pyx_L5_argtuple_error;
  23185. } else {
  23186. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  23187. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1329, __pyx_L3_error)
  23188. }
  23189. __pyx_v_r = values[0];
  23190. }
  23191. goto __pyx_L6_skip;
  23192. __pyx_L5_argtuple_error:;
  23193. __Pyx_RaiseArgtupleInvalid("midpoint", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1329, __pyx_L3_error)
  23194. __pyx_L6_skip:;
  23195. goto __pyx_L4_argument_unpacking_done;
  23196. __pyx_L3_error:;
  23197. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  23198. Py_XDECREF(values[__pyx_temp]);
  23199. }
  23200. __Pyx_AddTraceback("fontTools.misc.bezierTools._curve_curve_intersections_t.midpoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  23201. __Pyx_RefNannyFinishContext();
  23202. return NULL;
  23203. __pyx_L4_argument_unpacking_done:;
  23204. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_midpoint(__pyx_self, __pyx_v_r);
  23205. /* function exit code */
  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_RefNannyFinishContext();
  23210. return __pyx_r;
  23211. }
  23212. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_midpoint(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_r) {
  23213. PyObject *__pyx_r = NULL;
  23214. __Pyx_RefNannyDeclarations
  23215. PyObject *__pyx_t_1 = NULL;
  23216. PyObject *__pyx_t_2 = NULL;
  23217. PyObject *__pyx_t_3 = NULL;
  23218. int __pyx_lineno = 0;
  23219. const char *__pyx_filename = NULL;
  23220. int __pyx_clineno = 0;
  23221. __Pyx_RefNannySetupContext("midpoint", 0);
  23222. /* "fontTools/misc/bezierTools.py":1330
  23223. *
  23224. * def midpoint(r):
  23225. * return 0.5 * (r[0] + r[1]) # <<<<<<<<<<<<<<
  23226. *
  23227. * # If they do overlap but they're tiny, approximate
  23228. */
  23229. __Pyx_XDECREF(__pyx_r);
  23230. __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)
  23231. __Pyx_GOTREF(__pyx_t_1);
  23232. __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)
  23233. __Pyx_GOTREF(__pyx_t_2);
  23234. __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1330, __pyx_L1_error)
  23235. __Pyx_GOTREF(__pyx_t_3);
  23236. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  23237. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  23238. __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)
  23239. __Pyx_GOTREF(__pyx_t_2);
  23240. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  23241. __pyx_r = __pyx_t_2;
  23242. __pyx_t_2 = 0;
  23243. goto __pyx_L0;
  23244. /* "fontTools/misc/bezierTools.py":1329
  23245. * return []
  23246. *
  23247. * def midpoint(r): # <<<<<<<<<<<<<<
  23248. * return 0.5 * (r[0] + r[1])
  23249. *
  23250. */
  23251. /* function exit code */
  23252. __pyx_L1_error:;
  23253. __Pyx_XDECREF(__pyx_t_1);
  23254. __Pyx_XDECREF(__pyx_t_2);
  23255. __Pyx_XDECREF(__pyx_t_3);
  23256. __Pyx_AddTraceback("fontTools.misc.bezierTools._curve_curve_intersections_t.midpoint", __pyx_clineno, __pyx_lineno, __pyx_filename);
  23257. __pyx_r = NULL;
  23258. __pyx_L0:;
  23259. __Pyx_XGIVEREF(__pyx_r);
  23260. __Pyx_RefNannyFinishContext();
  23261. return __pyx_r;
  23262. }
  23263. /* "fontTools/misc/bezierTools.py":1366
  23264. * )
  23265. *
  23266. * unique_key = lambda ts: (int(ts[0] / precision), int(ts[1] / precision)) # <<<<<<<<<<<<<<
  23267. * seen = set()
  23268. * unique_values = []
  23269. */
  23270. /* Python wrapper */
  23271. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_2lambda3(PyObject *__pyx_self,
  23272. #if CYTHON_METH_FASTCALL
  23273. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  23274. #else
  23275. PyObject *__pyx_args, PyObject *__pyx_kwds
  23276. #endif
  23277. ); /*proto*/
  23278. 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};
  23279. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_28_curve_curve_intersections_t_2lambda3(PyObject *__pyx_self,
  23280. #if CYTHON_METH_FASTCALL
  23281. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  23282. #else
  23283. PyObject *__pyx_args, PyObject *__pyx_kwds
  23284. #endif
  23285. ) {
  23286. PyObject *__pyx_v_ts = 0;
  23287. #if !CYTHON_METH_FASTCALL
  23288. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  23289. #endif
  23290. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  23291. PyObject* values[1] = {0};
  23292. int __pyx_lineno = 0;
  23293. const char *__pyx_filename = NULL;
  23294. int __pyx_clineno = 0;
  23295. PyObject *__pyx_r = 0;
  23296. __Pyx_RefNannyDeclarations
  23297. __Pyx_RefNannySetupContext("lambda3 (wrapper)", 0);
  23298. #if !CYTHON_METH_FASTCALL
  23299. #if CYTHON_ASSUME_SAFE_SIZE
  23300. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  23301. #else
  23302. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  23303. #endif
  23304. #endif
  23305. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  23306. {
  23307. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_ts,0};
  23308. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  23309. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1366, __pyx_L3_error)
  23310. if (__pyx_kwds_len > 0) {
  23311. switch (__pyx_nargs) {
  23312. case 1:
  23313. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  23314. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1366, __pyx_L3_error)
  23315. CYTHON_FALLTHROUGH;
  23316. case 0: break;
  23317. default: goto __pyx_L5_argtuple_error;
  23318. }
  23319. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  23320. 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)
  23321. for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
  23322. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("lambda3", 1, 1, 1, i); __PYX_ERR(0, 1366, __pyx_L3_error) }
  23323. }
  23324. } else if (unlikely(__pyx_nargs != 1)) {
  23325. goto __pyx_L5_argtuple_error;
  23326. } else {
  23327. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  23328. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1366, __pyx_L3_error)
  23329. }
  23330. __pyx_v_ts = values[0];
  23331. }
  23332. goto __pyx_L6_skip;
  23333. __pyx_L5_argtuple_error:;
  23334. __Pyx_RaiseArgtupleInvalid("lambda3", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1366, __pyx_L3_error)
  23335. __pyx_L6_skip:;
  23336. goto __pyx_L4_argument_unpacking_done;
  23337. __pyx_L3_error:;
  23338. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  23339. Py_XDECREF(values[__pyx_temp]);
  23340. }
  23341. __Pyx_AddTraceback("fontTools.misc.bezierTools._curve_curve_intersections_t.lambda3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  23342. __Pyx_RefNannyFinishContext();
  23343. return NULL;
  23344. __pyx_L4_argument_unpacking_done:;
  23345. __pyx_r = __pyx_lambda_funcdef_lambda3(__pyx_self, __pyx_v_ts);
  23346. /* function exit code */
  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_RefNannyFinishContext();
  23351. return __pyx_r;
  23352. }
  23353. static PyObject *__pyx_lambda_funcdef_lambda3(PyObject *__pyx_self, PyObject *__pyx_v_ts) {
  23354. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t *__pyx_cur_scope;
  23355. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t *__pyx_outer_scope;
  23356. PyObject *__pyx_r = NULL;
  23357. __Pyx_RefNannyDeclarations
  23358. PyObject *__pyx_t_1 = NULL;
  23359. PyObject *__pyx_t_2 = NULL;
  23360. PyObject *__pyx_t_3 = NULL;
  23361. int __pyx_lineno = 0;
  23362. const char *__pyx_filename = NULL;
  23363. int __pyx_clineno = 0;
  23364. __Pyx_RefNannySetupContext("lambda3", 0);
  23365. __pyx_outer_scope = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t *) __Pyx_CyFunction_GetClosure(__pyx_self);
  23366. __pyx_cur_scope = __pyx_outer_scope;
  23367. __Pyx_XDECREF(__pyx_r);
  23368. __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)
  23369. __Pyx_GOTREF(__pyx_t_1);
  23370. if (unlikely(!__pyx_cur_scope->__pyx_v_precision)) { __Pyx_RaiseClosureNameError("precision"); __PYX_ERR(0, 1366, __pyx_L1_error) }
  23371. __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)
  23372. __Pyx_GOTREF(__pyx_t_2);
  23373. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  23374. __pyx_t_1 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1366, __pyx_L1_error)
  23375. __Pyx_GOTREF(__pyx_t_1);
  23376. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  23377. __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)
  23378. __Pyx_GOTREF(__pyx_t_2);
  23379. if (unlikely(!__pyx_cur_scope->__pyx_v_precision)) { __Pyx_RaiseClosureNameError("precision"); __PYX_ERR(0, 1366, __pyx_L1_error) }
  23380. __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)
  23381. __Pyx_GOTREF(__pyx_t_3);
  23382. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  23383. __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1366, __pyx_L1_error)
  23384. __Pyx_GOTREF(__pyx_t_2);
  23385. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  23386. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1366, __pyx_L1_error)
  23387. __Pyx_GOTREF(__pyx_t_3);
  23388. __Pyx_GIVEREF(__pyx_t_1);
  23389. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 1366, __pyx_L1_error);
  23390. __Pyx_GIVEREF(__pyx_t_2);
  23391. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 1366, __pyx_L1_error);
  23392. __pyx_t_1 = 0;
  23393. __pyx_t_2 = 0;
  23394. __pyx_r = __pyx_t_3;
  23395. __pyx_t_3 = 0;
  23396. goto __pyx_L0;
  23397. /* function exit code */
  23398. __pyx_L1_error:;
  23399. __Pyx_XDECREF(__pyx_t_1);
  23400. __Pyx_XDECREF(__pyx_t_2);
  23401. __Pyx_XDECREF(__pyx_t_3);
  23402. __Pyx_AddTraceback("fontTools.misc.bezierTools._curve_curve_intersections_t.lambda3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  23403. __pyx_r = NULL;
  23404. __pyx_L0:;
  23405. __Pyx_XGIVEREF(__pyx_r);
  23406. __Pyx_RefNannyFinishContext();
  23407. return __pyx_r;
  23408. }
  23409. /* "fontTools/misc/bezierTools.py":1313
  23410. *
  23411. *
  23412. * def _curve_curve_intersections_t( # <<<<<<<<<<<<<<
  23413. * curve1, curve2, precision=1e-3, range1=None, range2=None
  23414. * ):
  23415. */
  23416. 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) {
  23417. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t *__pyx_cur_scope;
  23418. PyObject *__pyx_v_bounds1 = NULL;
  23419. PyObject *__pyx_v_bounds2 = NULL;
  23420. PyObject *__pyx_v_intersects = NULL;
  23421. CYTHON_UNUSED PyObject *__pyx_v__ = NULL;
  23422. PyObject *__pyx_v_midpoint = 0;
  23423. PyObject *__pyx_v_c11 = NULL;
  23424. PyObject *__pyx_v_c12 = NULL;
  23425. PyObject *__pyx_v_c11_range = NULL;
  23426. PyObject *__pyx_v_c12_range = NULL;
  23427. PyObject *__pyx_v_c21 = NULL;
  23428. PyObject *__pyx_v_c22 = NULL;
  23429. PyObject *__pyx_v_c21_range = NULL;
  23430. PyObject *__pyx_v_c22_range = NULL;
  23431. PyObject *__pyx_v_found = NULL;
  23432. PyObject *__pyx_v_unique_key = NULL;
  23433. PyObject *__pyx_v_seen = NULL;
  23434. PyObject *__pyx_v_unique_values = NULL;
  23435. PyObject *__pyx_v_ts = NULL;
  23436. PyObject *__pyx_v_key = NULL;
  23437. PyObject *__pyx_r = NULL;
  23438. __Pyx_RefNannyDeclarations
  23439. PyObject *__pyx_t_1 = NULL;
  23440. PyObject *__pyx_t_2 = NULL;
  23441. PyObject *__pyx_t_3 = NULL;
  23442. size_t __pyx_t_4;
  23443. int __pyx_t_5;
  23444. int __pyx_t_6;
  23445. PyObject *__pyx_t_7 = NULL;
  23446. PyObject *(*__pyx_t_8)(PyObject *);
  23447. int __pyx_t_9;
  23448. Py_ssize_t __pyx_t_10;
  23449. int __pyx_lineno = 0;
  23450. const char *__pyx_filename = NULL;
  23451. int __pyx_clineno = 0;
  23452. __Pyx_RefNannySetupContext("_curve_curve_intersections_t", 0);
  23453. __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);
  23454. if (unlikely(!__pyx_cur_scope)) {
  23455. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t *)Py_None);
  23456. __Pyx_INCREF(Py_None);
  23457. __PYX_ERR(0, 1313, __pyx_L1_error)
  23458. } else {
  23459. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  23460. }
  23461. __pyx_cur_scope->__pyx_v_precision = __pyx_v_precision;
  23462. __Pyx_INCREF(__pyx_cur_scope->__pyx_v_precision);
  23463. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_precision);
  23464. __Pyx_INCREF(__pyx_v_range1);
  23465. __Pyx_INCREF(__pyx_v_range2);
  23466. /* "fontTools/misc/bezierTools.py":1316
  23467. * curve1, curve2, precision=1e-3, range1=None, range2=None
  23468. * ):
  23469. * bounds1 = _curve_bounds(curve1) # <<<<<<<<<<<<<<
  23470. * bounds2 = _curve_bounds(curve2)
  23471. *
  23472. */
  23473. __pyx_t_2 = NULL;
  23474. __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)
  23475. __Pyx_GOTREF(__pyx_t_3);
  23476. __pyx_t_4 = 1;
  23477. #if CYTHON_UNPACK_METHODS
  23478. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  23479. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  23480. assert(__pyx_t_2);
  23481. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  23482. __Pyx_INCREF(__pyx_t_2);
  23483. __Pyx_INCREF(__pyx__function);
  23484. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  23485. __pyx_t_4 = 0;
  23486. }
  23487. #endif
  23488. {
  23489. PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_curve1};
  23490. __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));
  23491. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  23492. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  23493. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1316, __pyx_L1_error)
  23494. __Pyx_GOTREF(__pyx_t_1);
  23495. }
  23496. __pyx_v_bounds1 = __pyx_t_1;
  23497. __pyx_t_1 = 0;
  23498. /* "fontTools/misc/bezierTools.py":1317
  23499. * ):
  23500. * bounds1 = _curve_bounds(curve1)
  23501. * bounds2 = _curve_bounds(curve2) # <<<<<<<<<<<<<<
  23502. *
  23503. * if not range1:
  23504. */
  23505. __pyx_t_3 = NULL;
  23506. __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)
  23507. __Pyx_GOTREF(__pyx_t_2);
  23508. __pyx_t_4 = 1;
  23509. #if CYTHON_UNPACK_METHODS
  23510. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  23511. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
  23512. assert(__pyx_t_3);
  23513. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  23514. __Pyx_INCREF(__pyx_t_3);
  23515. __Pyx_INCREF(__pyx__function);
  23516. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  23517. __pyx_t_4 = 0;
  23518. }
  23519. #endif
  23520. {
  23521. PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_curve2};
  23522. __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));
  23523. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  23524. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  23525. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1317, __pyx_L1_error)
  23526. __Pyx_GOTREF(__pyx_t_1);
  23527. }
  23528. __pyx_v_bounds2 = __pyx_t_1;
  23529. __pyx_t_1 = 0;
  23530. /* "fontTools/misc/bezierTools.py":1319
  23531. * bounds2 = _curve_bounds(curve2)
  23532. *
  23533. * if not range1: # <<<<<<<<<<<<<<
  23534. * range1 = (0.0, 1.0)
  23535. * if not range2:
  23536. */
  23537. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_range1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1319, __pyx_L1_error)
  23538. __pyx_t_6 = (!__pyx_t_5);
  23539. if (__pyx_t_6) {
  23540. /* "fontTools/misc/bezierTools.py":1320
  23541. *
  23542. * if not range1:
  23543. * range1 = (0.0, 1.0) # <<<<<<<<<<<<<<
  23544. * if not range2:
  23545. * range2 = (0.0, 1.0)
  23546. */
  23547. __Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[1]);
  23548. __Pyx_DECREF_SET(__pyx_v_range1, __pyx_mstate_global->__pyx_tuple[1]);
  23549. /* "fontTools/misc/bezierTools.py":1319
  23550. * bounds2 = _curve_bounds(curve2)
  23551. *
  23552. * if not range1: # <<<<<<<<<<<<<<
  23553. * range1 = (0.0, 1.0)
  23554. * if not range2:
  23555. */
  23556. }
  23557. /* "fontTools/misc/bezierTools.py":1321
  23558. * if not range1:
  23559. * range1 = (0.0, 1.0)
  23560. * if not range2: # <<<<<<<<<<<<<<
  23561. * range2 = (0.0, 1.0)
  23562. *
  23563. */
  23564. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_range2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 1321, __pyx_L1_error)
  23565. __pyx_t_5 = (!__pyx_t_6);
  23566. if (__pyx_t_5) {
  23567. /* "fontTools/misc/bezierTools.py":1322
  23568. * range1 = (0.0, 1.0)
  23569. * if not range2:
  23570. * range2 = (0.0, 1.0) # <<<<<<<<<<<<<<
  23571. *
  23572. * # If bounds don't intersect, go home
  23573. */
  23574. __Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[1]);
  23575. __Pyx_DECREF_SET(__pyx_v_range2, __pyx_mstate_global->__pyx_tuple[1]);
  23576. /* "fontTools/misc/bezierTools.py":1321
  23577. * if not range1:
  23578. * range1 = (0.0, 1.0)
  23579. * if not range2: # <<<<<<<<<<<<<<
  23580. * range2 = (0.0, 1.0)
  23581. *
  23582. */
  23583. }
  23584. /* "fontTools/misc/bezierTools.py":1325
  23585. *
  23586. * # If bounds don't intersect, go home
  23587. * intersects, _ = sectRect(bounds1, bounds2) # <<<<<<<<<<<<<<
  23588. * if not intersects:
  23589. * return []
  23590. */
  23591. __pyx_t_2 = NULL;
  23592. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_sectRect); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1325, __pyx_L1_error)
  23593. __Pyx_GOTREF(__pyx_t_3);
  23594. __pyx_t_4 = 1;
  23595. #if CYTHON_UNPACK_METHODS
  23596. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  23597. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  23598. assert(__pyx_t_2);
  23599. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  23600. __Pyx_INCREF(__pyx_t_2);
  23601. __Pyx_INCREF(__pyx__function);
  23602. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  23603. __pyx_t_4 = 0;
  23604. }
  23605. #endif
  23606. {
  23607. PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_bounds1, __pyx_v_bounds2};
  23608. __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));
  23609. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  23610. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  23611. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1325, __pyx_L1_error)
  23612. __Pyx_GOTREF(__pyx_t_1);
  23613. }
  23614. if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
  23615. PyObject* sequence = __pyx_t_1;
  23616. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  23617. if (unlikely(size != 2)) {
  23618. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  23619. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  23620. __PYX_ERR(0, 1325, __pyx_L1_error)
  23621. }
  23622. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  23623. if (likely(PyTuple_CheckExact(sequence))) {
  23624. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  23625. __Pyx_INCREF(__pyx_t_3);
  23626. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
  23627. __Pyx_INCREF(__pyx_t_2);
  23628. } else {
  23629. __pyx_t_3 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  23630. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1325, __pyx_L1_error)
  23631. __Pyx_XGOTREF(__pyx_t_3);
  23632. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  23633. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1325, __pyx_L1_error)
  23634. __Pyx_XGOTREF(__pyx_t_2);
  23635. }
  23636. #else
  23637. __pyx_t_3 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1325, __pyx_L1_error)
  23638. __Pyx_GOTREF(__pyx_t_3);
  23639. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1325, __pyx_L1_error)
  23640. __Pyx_GOTREF(__pyx_t_2);
  23641. #endif
  23642. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  23643. } else {
  23644. Py_ssize_t index = -1;
  23645. __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1325, __pyx_L1_error)
  23646. __Pyx_GOTREF(__pyx_t_7);
  23647. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  23648. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
  23649. index = 0; __pyx_t_3 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
  23650. __Pyx_GOTREF(__pyx_t_3);
  23651. index = 1; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
  23652. __Pyx_GOTREF(__pyx_t_2);
  23653. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 1325, __pyx_L1_error)
  23654. __pyx_t_8 = NULL;
  23655. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  23656. goto __pyx_L6_unpacking_done;
  23657. __pyx_L5_unpacking_failed:;
  23658. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  23659. __pyx_t_8 = NULL;
  23660. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  23661. __PYX_ERR(0, 1325, __pyx_L1_error)
  23662. __pyx_L6_unpacking_done:;
  23663. }
  23664. __pyx_v_intersects = __pyx_t_3;
  23665. __pyx_t_3 = 0;
  23666. __pyx_v__ = __pyx_t_2;
  23667. __pyx_t_2 = 0;
  23668. /* "fontTools/misc/bezierTools.py":1326
  23669. * # If bounds don't intersect, go home
  23670. * intersects, _ = sectRect(bounds1, bounds2)
  23671. * if not intersects: # <<<<<<<<<<<<<<
  23672. * return []
  23673. *
  23674. */
  23675. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_intersects); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1326, __pyx_L1_error)
  23676. __pyx_t_6 = (!__pyx_t_5);
  23677. if (__pyx_t_6) {
  23678. /* "fontTools/misc/bezierTools.py":1327
  23679. * intersects, _ = sectRect(bounds1, bounds2)
  23680. * if not intersects:
  23681. * return [] # <<<<<<<<<<<<<<
  23682. *
  23683. * def midpoint(r):
  23684. */
  23685. __Pyx_XDECREF(__pyx_r);
  23686. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1327, __pyx_L1_error)
  23687. __Pyx_GOTREF(__pyx_t_1);
  23688. __pyx_r = __pyx_t_1;
  23689. __pyx_t_1 = 0;
  23690. goto __pyx_L0;
  23691. /* "fontTools/misc/bezierTools.py":1326
  23692. * # If bounds don't intersect, go home
  23693. * intersects, _ = sectRect(bounds1, bounds2)
  23694. * if not intersects: # <<<<<<<<<<<<<<
  23695. * return []
  23696. *
  23697. */
  23698. }
  23699. /* "fontTools/misc/bezierTools.py":1329
  23700. * return []
  23701. *
  23702. * def midpoint(r): # <<<<<<<<<<<<<<
  23703. * return 0.5 * (r[0] + r[1])
  23704. *
  23705. */
  23706. __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)
  23707. __Pyx_GOTREF(__pyx_t_1);
  23708. __pyx_v_midpoint = __pyx_t_1;
  23709. __pyx_t_1 = 0;
  23710. /* "fontTools/misc/bezierTools.py":1333
  23711. *
  23712. * # If they do overlap but they're tiny, approximate
  23713. * if rectArea(bounds1) < precision and rectArea(bounds2) < precision: # <<<<<<<<<<<<<<
  23714. * return [(midpoint(range1), midpoint(range2))]
  23715. *
  23716. */
  23717. __pyx_t_2 = NULL;
  23718. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_rectArea); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1333, __pyx_L1_error)
  23719. __Pyx_GOTREF(__pyx_t_3);
  23720. __pyx_t_4 = 1;
  23721. #if CYTHON_UNPACK_METHODS
  23722. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  23723. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  23724. assert(__pyx_t_2);
  23725. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  23726. __Pyx_INCREF(__pyx_t_2);
  23727. __Pyx_INCREF(__pyx__function);
  23728. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  23729. __pyx_t_4 = 0;
  23730. }
  23731. #endif
  23732. {
  23733. PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_bounds1};
  23734. __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));
  23735. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  23736. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  23737. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1333, __pyx_L1_error)
  23738. __Pyx_GOTREF(__pyx_t_1);
  23739. }
  23740. __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)
  23741. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  23742. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1333, __pyx_L1_error)
  23743. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  23744. if (__pyx_t_5) {
  23745. } else {
  23746. __pyx_t_6 = __pyx_t_5;
  23747. goto __pyx_L9_bool_binop_done;
  23748. }
  23749. __pyx_t_1 = NULL;
  23750. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_rectArea); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1333, __pyx_L1_error)
  23751. __Pyx_GOTREF(__pyx_t_2);
  23752. __pyx_t_4 = 1;
  23753. #if CYTHON_UNPACK_METHODS
  23754. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  23755. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
  23756. assert(__pyx_t_1);
  23757. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  23758. __Pyx_INCREF(__pyx_t_1);
  23759. __Pyx_INCREF(__pyx__function);
  23760. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  23761. __pyx_t_4 = 0;
  23762. }
  23763. #endif
  23764. {
  23765. PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_bounds2};
  23766. __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));
  23767. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  23768. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  23769. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1333, __pyx_L1_error)
  23770. __Pyx_GOTREF(__pyx_t_3);
  23771. }
  23772. __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)
  23773. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  23774. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1333, __pyx_L1_error)
  23775. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  23776. __pyx_t_6 = __pyx_t_5;
  23777. __pyx_L9_bool_binop_done:;
  23778. if (__pyx_t_6) {
  23779. /* "fontTools/misc/bezierTools.py":1334
  23780. * # If they do overlap but they're tiny, approximate
  23781. * if rectArea(bounds1) < precision and rectArea(bounds2) < precision:
  23782. * return [(midpoint(range1), midpoint(range2))] # <<<<<<<<<<<<<<
  23783. *
  23784. * c11, c12 = _split_segment_at_t(curve1, 0.5)
  23785. */
  23786. __Pyx_XDECREF(__pyx_r);
  23787. __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)
  23788. __Pyx_GOTREF(__pyx_t_2);
  23789. __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)
  23790. __Pyx_GOTREF(__pyx_t_3);
  23791. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1334, __pyx_L1_error)
  23792. __Pyx_GOTREF(__pyx_t_1);
  23793. __Pyx_GIVEREF(__pyx_t_2);
  23794. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 1334, __pyx_L1_error);
  23795. __Pyx_GIVEREF(__pyx_t_3);
  23796. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 1334, __pyx_L1_error);
  23797. __pyx_t_2 = 0;
  23798. __pyx_t_3 = 0;
  23799. __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1334, __pyx_L1_error)
  23800. __Pyx_GOTREF(__pyx_t_3);
  23801. __Pyx_GIVEREF(__pyx_t_1);
  23802. if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 1334, __pyx_L1_error);
  23803. __pyx_t_1 = 0;
  23804. __pyx_r = __pyx_t_3;
  23805. __pyx_t_3 = 0;
  23806. goto __pyx_L0;
  23807. /* "fontTools/misc/bezierTools.py":1333
  23808. *
  23809. * # If they do overlap but they're tiny, approximate
  23810. * if rectArea(bounds1) < precision and rectArea(bounds2) < precision: # <<<<<<<<<<<<<<
  23811. * return [(midpoint(range1), midpoint(range2))]
  23812. *
  23813. */
  23814. }
  23815. /* "fontTools/misc/bezierTools.py":1336
  23816. * return [(midpoint(range1), midpoint(range2))]
  23817. *
  23818. * c11, c12 = _split_segment_at_t(curve1, 0.5) # <<<<<<<<<<<<<<
  23819. * c11_range = (range1[0], midpoint(range1))
  23820. * c12_range = (midpoint(range1), range1[1])
  23821. */
  23822. __pyx_t_1 = NULL;
  23823. __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)
  23824. __Pyx_GOTREF(__pyx_t_2);
  23825. __pyx_t_4 = 1;
  23826. #if CYTHON_UNPACK_METHODS
  23827. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  23828. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
  23829. assert(__pyx_t_1);
  23830. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  23831. __Pyx_INCREF(__pyx_t_1);
  23832. __Pyx_INCREF(__pyx__function);
  23833. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  23834. __pyx_t_4 = 0;
  23835. }
  23836. #endif
  23837. {
  23838. PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_v_curve1, __pyx_mstate_global->__pyx_float_0_5};
  23839. __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));
  23840. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  23841. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  23842. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1336, __pyx_L1_error)
  23843. __Pyx_GOTREF(__pyx_t_3);
  23844. }
  23845. if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
  23846. PyObject* sequence = __pyx_t_3;
  23847. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  23848. if (unlikely(size != 2)) {
  23849. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  23850. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  23851. __PYX_ERR(0, 1336, __pyx_L1_error)
  23852. }
  23853. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  23854. if (likely(PyTuple_CheckExact(sequence))) {
  23855. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  23856. __Pyx_INCREF(__pyx_t_2);
  23857. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  23858. __Pyx_INCREF(__pyx_t_1);
  23859. } else {
  23860. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  23861. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1336, __pyx_L1_error)
  23862. __Pyx_XGOTREF(__pyx_t_2);
  23863. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  23864. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1336, __pyx_L1_error)
  23865. __Pyx_XGOTREF(__pyx_t_1);
  23866. }
  23867. #else
  23868. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1336, __pyx_L1_error)
  23869. __Pyx_GOTREF(__pyx_t_2);
  23870. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1336, __pyx_L1_error)
  23871. __Pyx_GOTREF(__pyx_t_1);
  23872. #endif
  23873. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  23874. } else {
  23875. Py_ssize_t index = -1;
  23876. __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1336, __pyx_L1_error)
  23877. __Pyx_GOTREF(__pyx_t_7);
  23878. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  23879. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
  23880. index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L11_unpacking_failed;
  23881. __Pyx_GOTREF(__pyx_t_2);
  23882. index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L11_unpacking_failed;
  23883. __Pyx_GOTREF(__pyx_t_1);
  23884. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 1336, __pyx_L1_error)
  23885. __pyx_t_8 = NULL;
  23886. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  23887. goto __pyx_L12_unpacking_done;
  23888. __pyx_L11_unpacking_failed:;
  23889. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  23890. __pyx_t_8 = NULL;
  23891. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  23892. __PYX_ERR(0, 1336, __pyx_L1_error)
  23893. __pyx_L12_unpacking_done:;
  23894. }
  23895. __pyx_v_c11 = __pyx_t_2;
  23896. __pyx_t_2 = 0;
  23897. __pyx_v_c12 = __pyx_t_1;
  23898. __pyx_t_1 = 0;
  23899. /* "fontTools/misc/bezierTools.py":1337
  23900. *
  23901. * c11, c12 = _split_segment_at_t(curve1, 0.5)
  23902. * c11_range = (range1[0], midpoint(range1)) # <<<<<<<<<<<<<<
  23903. * c12_range = (midpoint(range1), range1[1])
  23904. *
  23905. */
  23906. __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)
  23907. __Pyx_GOTREF(__pyx_t_3);
  23908. __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)
  23909. __Pyx_GOTREF(__pyx_t_1);
  23910. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1337, __pyx_L1_error)
  23911. __Pyx_GOTREF(__pyx_t_2);
  23912. __Pyx_GIVEREF(__pyx_t_3);
  23913. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 1337, __pyx_L1_error);
  23914. __Pyx_GIVEREF(__pyx_t_1);
  23915. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 1337, __pyx_L1_error);
  23916. __pyx_t_3 = 0;
  23917. __pyx_t_1 = 0;
  23918. __pyx_v_c11_range = ((PyObject*)__pyx_t_2);
  23919. __pyx_t_2 = 0;
  23920. /* "fontTools/misc/bezierTools.py":1338
  23921. * c11, c12 = _split_segment_at_t(curve1, 0.5)
  23922. * c11_range = (range1[0], midpoint(range1))
  23923. * c12_range = (midpoint(range1), range1[1]) # <<<<<<<<<<<<<<
  23924. *
  23925. * c21, c22 = _split_segment_at_t(curve2, 0.5)
  23926. */
  23927. __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)
  23928. __Pyx_GOTREF(__pyx_t_2);
  23929. __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)
  23930. __Pyx_GOTREF(__pyx_t_1);
  23931. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1338, __pyx_L1_error)
  23932. __Pyx_GOTREF(__pyx_t_3);
  23933. __Pyx_GIVEREF(__pyx_t_2);
  23934. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 1338, __pyx_L1_error);
  23935. __Pyx_GIVEREF(__pyx_t_1);
  23936. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 1338, __pyx_L1_error);
  23937. __pyx_t_2 = 0;
  23938. __pyx_t_1 = 0;
  23939. __pyx_v_c12_range = ((PyObject*)__pyx_t_3);
  23940. __pyx_t_3 = 0;
  23941. /* "fontTools/misc/bezierTools.py":1340
  23942. * c12_range = (midpoint(range1), range1[1])
  23943. *
  23944. * c21, c22 = _split_segment_at_t(curve2, 0.5) # <<<<<<<<<<<<<<
  23945. * c21_range = (range2[0], midpoint(range2))
  23946. * c22_range = (midpoint(range2), range2[1])
  23947. */
  23948. __pyx_t_1 = NULL;
  23949. __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)
  23950. __Pyx_GOTREF(__pyx_t_2);
  23951. __pyx_t_4 = 1;
  23952. #if CYTHON_UNPACK_METHODS
  23953. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  23954. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
  23955. assert(__pyx_t_1);
  23956. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  23957. __Pyx_INCREF(__pyx_t_1);
  23958. __Pyx_INCREF(__pyx__function);
  23959. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  23960. __pyx_t_4 = 0;
  23961. }
  23962. #endif
  23963. {
  23964. PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_v_curve2, __pyx_mstate_global->__pyx_float_0_5};
  23965. __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));
  23966. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  23967. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  23968. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1340, __pyx_L1_error)
  23969. __Pyx_GOTREF(__pyx_t_3);
  23970. }
  23971. if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
  23972. PyObject* sequence = __pyx_t_3;
  23973. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  23974. if (unlikely(size != 2)) {
  23975. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  23976. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  23977. __PYX_ERR(0, 1340, __pyx_L1_error)
  23978. }
  23979. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  23980. if (likely(PyTuple_CheckExact(sequence))) {
  23981. __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
  23982. __Pyx_INCREF(__pyx_t_2);
  23983. __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1);
  23984. __Pyx_INCREF(__pyx_t_1);
  23985. } else {
  23986. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(sequence, 0, __Pyx_ReferenceSharing_SharedReference);
  23987. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1340, __pyx_L1_error)
  23988. __Pyx_XGOTREF(__pyx_t_2);
  23989. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(sequence, 1, __Pyx_ReferenceSharing_SharedReference);
  23990. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1340, __pyx_L1_error)
  23991. __Pyx_XGOTREF(__pyx_t_1);
  23992. }
  23993. #else
  23994. __pyx_t_2 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1340, __pyx_L1_error)
  23995. __Pyx_GOTREF(__pyx_t_2);
  23996. __pyx_t_1 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1340, __pyx_L1_error)
  23997. __Pyx_GOTREF(__pyx_t_1);
  23998. #endif
  23999. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24000. } else {
  24001. Py_ssize_t index = -1;
  24002. __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1340, __pyx_L1_error)
  24003. __Pyx_GOTREF(__pyx_t_7);
  24004. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24005. __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_7);
  24006. index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L13_unpacking_failed;
  24007. __Pyx_GOTREF(__pyx_t_2);
  24008. index = 1; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L13_unpacking_failed;
  24009. __Pyx_GOTREF(__pyx_t_1);
  24010. if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < (0)) __PYX_ERR(0, 1340, __pyx_L1_error)
  24011. __pyx_t_8 = NULL;
  24012. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  24013. goto __pyx_L14_unpacking_done;
  24014. __pyx_L13_unpacking_failed:;
  24015. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  24016. __pyx_t_8 = NULL;
  24017. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  24018. __PYX_ERR(0, 1340, __pyx_L1_error)
  24019. __pyx_L14_unpacking_done:;
  24020. }
  24021. __pyx_v_c21 = __pyx_t_2;
  24022. __pyx_t_2 = 0;
  24023. __pyx_v_c22 = __pyx_t_1;
  24024. __pyx_t_1 = 0;
  24025. /* "fontTools/misc/bezierTools.py":1341
  24026. *
  24027. * c21, c22 = _split_segment_at_t(curve2, 0.5)
  24028. * c21_range = (range2[0], midpoint(range2)) # <<<<<<<<<<<<<<
  24029. * c22_range = (midpoint(range2), range2[1])
  24030. *
  24031. */
  24032. __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)
  24033. __Pyx_GOTREF(__pyx_t_3);
  24034. __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)
  24035. __Pyx_GOTREF(__pyx_t_1);
  24036. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1341, __pyx_L1_error)
  24037. __Pyx_GOTREF(__pyx_t_2);
  24038. __Pyx_GIVEREF(__pyx_t_3);
  24039. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 1341, __pyx_L1_error);
  24040. __Pyx_GIVEREF(__pyx_t_1);
  24041. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 1341, __pyx_L1_error);
  24042. __pyx_t_3 = 0;
  24043. __pyx_t_1 = 0;
  24044. __pyx_v_c21_range = ((PyObject*)__pyx_t_2);
  24045. __pyx_t_2 = 0;
  24046. /* "fontTools/misc/bezierTools.py":1342
  24047. * c21, c22 = _split_segment_at_t(curve2, 0.5)
  24048. * c21_range = (range2[0], midpoint(range2))
  24049. * c22_range = (midpoint(range2), range2[1]) # <<<<<<<<<<<<<<
  24050. *
  24051. * found = []
  24052. */
  24053. __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)
  24054. __Pyx_GOTREF(__pyx_t_2);
  24055. __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)
  24056. __Pyx_GOTREF(__pyx_t_1);
  24057. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1342, __pyx_L1_error)
  24058. __Pyx_GOTREF(__pyx_t_3);
  24059. __Pyx_GIVEREF(__pyx_t_2);
  24060. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 1342, __pyx_L1_error);
  24061. __Pyx_GIVEREF(__pyx_t_1);
  24062. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 1342, __pyx_L1_error);
  24063. __pyx_t_2 = 0;
  24064. __pyx_t_1 = 0;
  24065. __pyx_v_c22_range = ((PyObject*)__pyx_t_3);
  24066. __pyx_t_3 = 0;
  24067. /* "fontTools/misc/bezierTools.py":1344
  24068. * c22_range = (midpoint(range2), range2[1])
  24069. *
  24070. * found = [] # <<<<<<<<<<<<<<
  24071. * found.extend(
  24072. * _curve_curve_intersections_t(
  24073. */
  24074. __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1344, __pyx_L1_error)
  24075. __Pyx_GOTREF(__pyx_t_3);
  24076. __pyx_v_found = ((PyObject*)__pyx_t_3);
  24077. __pyx_t_3 = 0;
  24078. /* "fontTools/misc/bezierTools.py":1346
  24079. * found = []
  24080. * found.extend(
  24081. * _curve_curve_intersections_t( # <<<<<<<<<<<<<<
  24082. * c11, c21, precision, range1=c11_range, range2=c21_range
  24083. * )
  24084. */
  24085. __pyx_t_1 = NULL;
  24086. __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)
  24087. __Pyx_GOTREF(__pyx_t_2);
  24088. /* "fontTools/misc/bezierTools.py":1347
  24089. * found.extend(
  24090. * _curve_curve_intersections_t(
  24091. * c11, c21, precision, range1=c11_range, range2=c21_range # <<<<<<<<<<<<<<
  24092. * )
  24093. * )
  24094. */
  24095. __pyx_t_4 = 1;
  24096. #if CYTHON_UNPACK_METHODS
  24097. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  24098. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
  24099. assert(__pyx_t_1);
  24100. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  24101. __Pyx_INCREF(__pyx_t_1);
  24102. __Pyx_INCREF(__pyx__function);
  24103. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  24104. __pyx_t_4 = 0;
  24105. }
  24106. #endif
  24107. {
  24108. PyObject *__pyx_callargs[4 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_1, __pyx_v_c11, __pyx_v_c21, __pyx_cur_scope->__pyx_v_precision};
  24109. __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1346, __pyx_L1_error)
  24110. __Pyx_GOTREF(__pyx_t_7);
  24111. 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)
  24112. 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)
  24113. __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);
  24114. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  24115. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  24116. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  24117. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1346, __pyx_L1_error)
  24118. __Pyx_GOTREF(__pyx_t_3);
  24119. }
  24120. /* "fontTools/misc/bezierTools.py":1345
  24121. *
  24122. * found = []
  24123. * found.extend( # <<<<<<<<<<<<<<
  24124. * _curve_curve_intersections_t(
  24125. * c11, c21, precision, range1=c11_range, range2=c21_range
  24126. */
  24127. __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)
  24128. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24129. /* "fontTools/misc/bezierTools.py":1351
  24130. * )
  24131. * found.extend(
  24132. * _curve_curve_intersections_t( # <<<<<<<<<<<<<<
  24133. * c12, c21, precision, range1=c12_range, range2=c21_range
  24134. * )
  24135. */
  24136. __pyx_t_2 = NULL;
  24137. __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)
  24138. __Pyx_GOTREF(__pyx_t_7);
  24139. /* "fontTools/misc/bezierTools.py":1352
  24140. * found.extend(
  24141. * _curve_curve_intersections_t(
  24142. * c12, c21, precision, range1=c12_range, range2=c21_range # <<<<<<<<<<<<<<
  24143. * )
  24144. * )
  24145. */
  24146. __pyx_t_4 = 1;
  24147. #if CYTHON_UNPACK_METHODS
  24148. if (unlikely(PyMethod_Check(__pyx_t_7))) {
  24149. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
  24150. assert(__pyx_t_2);
  24151. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
  24152. __Pyx_INCREF(__pyx_t_2);
  24153. __Pyx_INCREF(__pyx__function);
  24154. __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
  24155. __pyx_t_4 = 0;
  24156. }
  24157. #endif
  24158. {
  24159. PyObject *__pyx_callargs[4 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_2, __pyx_v_c12, __pyx_v_c21, __pyx_cur_scope->__pyx_v_precision};
  24160. __pyx_t_1 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1351, __pyx_L1_error)
  24161. __Pyx_GOTREF(__pyx_t_1);
  24162. 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)
  24163. 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)
  24164. __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);
  24165. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  24166. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  24167. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  24168. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1351, __pyx_L1_error)
  24169. __Pyx_GOTREF(__pyx_t_3);
  24170. }
  24171. /* "fontTools/misc/bezierTools.py":1350
  24172. * )
  24173. * )
  24174. * found.extend( # <<<<<<<<<<<<<<
  24175. * _curve_curve_intersections_t(
  24176. * c12, c21, precision, range1=c12_range, range2=c21_range
  24177. */
  24178. __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)
  24179. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24180. /* "fontTools/misc/bezierTools.py":1356
  24181. * )
  24182. * found.extend(
  24183. * _curve_curve_intersections_t( # <<<<<<<<<<<<<<
  24184. * c11, c22, precision, range1=c11_range, range2=c22_range
  24185. * )
  24186. */
  24187. __pyx_t_7 = NULL;
  24188. __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)
  24189. __Pyx_GOTREF(__pyx_t_1);
  24190. /* "fontTools/misc/bezierTools.py":1357
  24191. * found.extend(
  24192. * _curve_curve_intersections_t(
  24193. * c11, c22, precision, range1=c11_range, range2=c22_range # <<<<<<<<<<<<<<
  24194. * )
  24195. * )
  24196. */
  24197. __pyx_t_4 = 1;
  24198. #if CYTHON_UNPACK_METHODS
  24199. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  24200. __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
  24201. assert(__pyx_t_7);
  24202. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  24203. __Pyx_INCREF(__pyx_t_7);
  24204. __Pyx_INCREF(__pyx__function);
  24205. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  24206. __pyx_t_4 = 0;
  24207. }
  24208. #endif
  24209. {
  24210. PyObject *__pyx_callargs[4 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_7, __pyx_v_c11, __pyx_v_c22, __pyx_cur_scope->__pyx_v_precision};
  24211. __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1356, __pyx_L1_error)
  24212. __Pyx_GOTREF(__pyx_t_2);
  24213. 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)
  24214. 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)
  24215. __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);
  24216. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  24217. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  24218. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  24219. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1356, __pyx_L1_error)
  24220. __Pyx_GOTREF(__pyx_t_3);
  24221. }
  24222. /* "fontTools/misc/bezierTools.py":1355
  24223. * )
  24224. * )
  24225. * found.extend( # <<<<<<<<<<<<<<
  24226. * _curve_curve_intersections_t(
  24227. * c11, c22, precision, range1=c11_range, range2=c22_range
  24228. */
  24229. __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)
  24230. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24231. /* "fontTools/misc/bezierTools.py":1361
  24232. * )
  24233. * found.extend(
  24234. * _curve_curve_intersections_t( # <<<<<<<<<<<<<<
  24235. * c12, c22, precision, range1=c12_range, range2=c22_range
  24236. * )
  24237. */
  24238. __pyx_t_1 = NULL;
  24239. __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)
  24240. __Pyx_GOTREF(__pyx_t_2);
  24241. /* "fontTools/misc/bezierTools.py":1362
  24242. * found.extend(
  24243. * _curve_curve_intersections_t(
  24244. * c12, c22, precision, range1=c12_range, range2=c22_range # <<<<<<<<<<<<<<
  24245. * )
  24246. * )
  24247. */
  24248. __pyx_t_4 = 1;
  24249. #if CYTHON_UNPACK_METHODS
  24250. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  24251. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
  24252. assert(__pyx_t_1);
  24253. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  24254. __Pyx_INCREF(__pyx_t_1);
  24255. __Pyx_INCREF(__pyx__function);
  24256. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  24257. __pyx_t_4 = 0;
  24258. }
  24259. #endif
  24260. {
  24261. PyObject *__pyx_callargs[4 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_1, __pyx_v_c12, __pyx_v_c22, __pyx_cur_scope->__pyx_v_precision};
  24262. __pyx_t_7 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1361, __pyx_L1_error)
  24263. __Pyx_GOTREF(__pyx_t_7);
  24264. 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)
  24265. 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)
  24266. __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);
  24267. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  24268. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  24269. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  24270. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1361, __pyx_L1_error)
  24271. __Pyx_GOTREF(__pyx_t_3);
  24272. }
  24273. /* "fontTools/misc/bezierTools.py":1360
  24274. * )
  24275. * )
  24276. * found.extend( # <<<<<<<<<<<<<<
  24277. * _curve_curve_intersections_t(
  24278. * c12, c22, precision, range1=c12_range, range2=c22_range
  24279. */
  24280. __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)
  24281. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24282. /* "fontTools/misc/bezierTools.py":1366
  24283. * )
  24284. *
  24285. * unique_key = lambda ts: (int(ts[0] / precision), int(ts[1] / precision)) # <<<<<<<<<<<<<<
  24286. * seen = set()
  24287. * unique_values = []
  24288. */
  24289. __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)
  24290. __Pyx_GOTREF(__pyx_t_3);
  24291. __pyx_v_unique_key = __pyx_t_3;
  24292. __pyx_t_3 = 0;
  24293. /* "fontTools/misc/bezierTools.py":1367
  24294. *
  24295. * unique_key = lambda ts: (int(ts[0] / precision), int(ts[1] / precision))
  24296. * seen = set() # <<<<<<<<<<<<<<
  24297. * unique_values = []
  24298. *
  24299. */
  24300. __pyx_t_3 = PySet_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1367, __pyx_L1_error)
  24301. __Pyx_GOTREF(__pyx_t_3);
  24302. __pyx_v_seen = ((PyObject*)__pyx_t_3);
  24303. __pyx_t_3 = 0;
  24304. /* "fontTools/misc/bezierTools.py":1368
  24305. * unique_key = lambda ts: (int(ts[0] / precision), int(ts[1] / precision))
  24306. * seen = set()
  24307. * unique_values = [] # <<<<<<<<<<<<<<
  24308. *
  24309. * for ts in found:
  24310. */
  24311. __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1368, __pyx_L1_error)
  24312. __Pyx_GOTREF(__pyx_t_3);
  24313. __pyx_v_unique_values = ((PyObject*)__pyx_t_3);
  24314. __pyx_t_3 = 0;
  24315. /* "fontTools/misc/bezierTools.py":1370
  24316. * unique_values = []
  24317. *
  24318. * for ts in found: # <<<<<<<<<<<<<<
  24319. * key = unique_key(ts)
  24320. * if key in seen:
  24321. */
  24322. __pyx_t_3 = __pyx_v_found; __Pyx_INCREF(__pyx_t_3);
  24323. __pyx_t_10 = 0;
  24324. for (;;) {
  24325. {
  24326. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
  24327. #if !CYTHON_ASSUME_SAFE_SIZE
  24328. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1370, __pyx_L1_error)
  24329. #endif
  24330. if (__pyx_t_10 >= __pyx_temp) break;
  24331. }
  24332. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_10, __Pyx_ReferenceSharing_OwnStrongReference);
  24333. ++__pyx_t_10;
  24334. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1370, __pyx_L1_error)
  24335. __Pyx_GOTREF(__pyx_t_2);
  24336. __Pyx_XDECREF_SET(__pyx_v_ts, __pyx_t_2);
  24337. __pyx_t_2 = 0;
  24338. /* "fontTools/misc/bezierTools.py":1371
  24339. *
  24340. * for ts in found:
  24341. * key = unique_key(ts) # <<<<<<<<<<<<<<
  24342. * if key in seen:
  24343. * continue
  24344. */
  24345. __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)
  24346. __Pyx_GOTREF(__pyx_t_2);
  24347. __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_2);
  24348. __pyx_t_2 = 0;
  24349. /* "fontTools/misc/bezierTools.py":1372
  24350. * for ts in found:
  24351. * key = unique_key(ts)
  24352. * if key in seen: # <<<<<<<<<<<<<<
  24353. * continue
  24354. * seen.add(key)
  24355. */
  24356. __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)
  24357. if (__pyx_t_6) {
  24358. /* "fontTools/misc/bezierTools.py":1373
  24359. * key = unique_key(ts)
  24360. * if key in seen:
  24361. * continue # <<<<<<<<<<<<<<
  24362. * seen.add(key)
  24363. * unique_values.append(ts)
  24364. */
  24365. goto __pyx_L15_continue;
  24366. /* "fontTools/misc/bezierTools.py":1372
  24367. * for ts in found:
  24368. * key = unique_key(ts)
  24369. * if key in seen: # <<<<<<<<<<<<<<
  24370. * continue
  24371. * seen.add(key)
  24372. */
  24373. }
  24374. /* "fontTools/misc/bezierTools.py":1374
  24375. * if key in seen:
  24376. * continue
  24377. * seen.add(key) # <<<<<<<<<<<<<<
  24378. * unique_values.append(ts)
  24379. *
  24380. */
  24381. __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)
  24382. /* "fontTools/misc/bezierTools.py":1375
  24383. * continue
  24384. * seen.add(key)
  24385. * unique_values.append(ts) # <<<<<<<<<<<<<<
  24386. *
  24387. * return unique_values
  24388. */
  24389. __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)
  24390. /* "fontTools/misc/bezierTools.py":1370
  24391. * unique_values = []
  24392. *
  24393. * for ts in found: # <<<<<<<<<<<<<<
  24394. * key = unique_key(ts)
  24395. * if key in seen:
  24396. */
  24397. __pyx_L15_continue:;
  24398. }
  24399. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24400. /* "fontTools/misc/bezierTools.py":1377
  24401. * unique_values.append(ts)
  24402. *
  24403. * return unique_values # <<<<<<<<<<<<<<
  24404. *
  24405. *
  24406. */
  24407. __Pyx_XDECREF(__pyx_r);
  24408. __Pyx_INCREF(__pyx_v_unique_values);
  24409. __pyx_r = __pyx_v_unique_values;
  24410. goto __pyx_L0;
  24411. /* "fontTools/misc/bezierTools.py":1313
  24412. *
  24413. *
  24414. * def _curve_curve_intersections_t( # <<<<<<<<<<<<<<
  24415. * curve1, curve2, precision=1e-3, range1=None, range2=None
  24416. * ):
  24417. */
  24418. /* function exit code */
  24419. __pyx_L1_error:;
  24420. __Pyx_XDECREF(__pyx_t_1);
  24421. __Pyx_XDECREF(__pyx_t_2);
  24422. __Pyx_XDECREF(__pyx_t_3);
  24423. __Pyx_XDECREF(__pyx_t_7);
  24424. __Pyx_AddTraceback("fontTools.misc.bezierTools._curve_curve_intersections_t", __pyx_clineno, __pyx_lineno, __pyx_filename);
  24425. __pyx_r = NULL;
  24426. __pyx_L0:;
  24427. __Pyx_XDECREF(__pyx_v_bounds1);
  24428. __Pyx_XDECREF(__pyx_v_bounds2);
  24429. __Pyx_XDECREF(__pyx_v_intersects);
  24430. __Pyx_XDECREF(__pyx_v__);
  24431. __Pyx_XDECREF(__pyx_v_midpoint);
  24432. __Pyx_XDECREF(__pyx_v_c11);
  24433. __Pyx_XDECREF(__pyx_v_c12);
  24434. __Pyx_XDECREF(__pyx_v_c11_range);
  24435. __Pyx_XDECREF(__pyx_v_c12_range);
  24436. __Pyx_XDECREF(__pyx_v_c21);
  24437. __Pyx_XDECREF(__pyx_v_c22);
  24438. __Pyx_XDECREF(__pyx_v_c21_range);
  24439. __Pyx_XDECREF(__pyx_v_c22_range);
  24440. __Pyx_XDECREF(__pyx_v_found);
  24441. __Pyx_XDECREF(__pyx_v_unique_key);
  24442. __Pyx_XDECREF(__pyx_v_seen);
  24443. __Pyx_XDECREF(__pyx_v_unique_values);
  24444. __Pyx_XDECREF(__pyx_v_ts);
  24445. __Pyx_XDECREF(__pyx_v_key);
  24446. __Pyx_XDECREF(__pyx_v_range1);
  24447. __Pyx_XDECREF(__pyx_v_range2);
  24448. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  24449. __Pyx_XGIVEREF(__pyx_r);
  24450. __Pyx_RefNannyFinishContext();
  24451. return __pyx_r;
  24452. }
  24453. /* "fontTools/misc/bezierTools.py":1380
  24454. *
  24455. *
  24456. * def _is_linelike(segment): # <<<<<<<<<<<<<<
  24457. * maybeline = _alignment_transformation(segment).transformPoints(segment)
  24458. * return all(math.isclose(p[1], 0.0) for p in maybeline)
  24459. */
  24460. /* Python wrapper */
  24461. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_87_is_linelike(PyObject *__pyx_self,
  24462. #if CYTHON_METH_FASTCALL
  24463. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  24464. #else
  24465. PyObject *__pyx_args, PyObject *__pyx_kwds
  24466. #endif
  24467. ); /*proto*/
  24468. PyDoc_STRVAR(__pyx_doc_9fontTools_4misc_11bezierTools_86_is_linelike, "_is_linelike(segment)");
  24469. 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};
  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. ) {
  24477. PyObject *__pyx_v_segment = 0;
  24478. #if !CYTHON_METH_FASTCALL
  24479. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  24480. #endif
  24481. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  24482. PyObject* values[1] = {0};
  24483. int __pyx_lineno = 0;
  24484. const char *__pyx_filename = NULL;
  24485. int __pyx_clineno = 0;
  24486. PyObject *__pyx_r = 0;
  24487. __Pyx_RefNannyDeclarations
  24488. __Pyx_RefNannySetupContext("_is_linelike (wrapper)", 0);
  24489. #if !CYTHON_METH_FASTCALL
  24490. #if CYTHON_ASSUME_SAFE_SIZE
  24491. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  24492. #else
  24493. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  24494. #endif
  24495. #endif
  24496. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  24497. {
  24498. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_segment,0};
  24499. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  24500. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1380, __pyx_L3_error)
  24501. if (__pyx_kwds_len > 0) {
  24502. switch (__pyx_nargs) {
  24503. case 1:
  24504. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  24505. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1380, __pyx_L3_error)
  24506. CYTHON_FALLTHROUGH;
  24507. case 0: break;
  24508. default: goto __pyx_L5_argtuple_error;
  24509. }
  24510. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  24511. 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)
  24512. for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
  24513. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_is_linelike", 1, 1, 1, i); __PYX_ERR(0, 1380, __pyx_L3_error) }
  24514. }
  24515. } else if (unlikely(__pyx_nargs != 1)) {
  24516. goto __pyx_L5_argtuple_error;
  24517. } else {
  24518. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  24519. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1380, __pyx_L3_error)
  24520. }
  24521. __pyx_v_segment = values[0];
  24522. }
  24523. goto __pyx_L6_skip;
  24524. __pyx_L5_argtuple_error:;
  24525. __Pyx_RaiseArgtupleInvalid("_is_linelike", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1380, __pyx_L3_error)
  24526. __pyx_L6_skip:;
  24527. goto __pyx_L4_argument_unpacking_done;
  24528. __pyx_L3_error:;
  24529. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  24530. Py_XDECREF(values[__pyx_temp]);
  24531. }
  24532. __Pyx_AddTraceback("fontTools.misc.bezierTools._is_linelike", __pyx_clineno, __pyx_lineno, __pyx_filename);
  24533. __Pyx_RefNannyFinishContext();
  24534. return NULL;
  24535. __pyx_L4_argument_unpacking_done:;
  24536. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_86_is_linelike(__pyx_self, __pyx_v_segment);
  24537. /* function exit code */
  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_RefNannyFinishContext();
  24542. return __pyx_r;
  24543. }
  24544. 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 */
  24545. /* "fontTools/misc/bezierTools.py":1382
  24546. * def _is_linelike(segment):
  24547. * maybeline = _alignment_transformation(segment).transformPoints(segment)
  24548. * return all(math.isclose(p[1], 0.0) for p in maybeline) # <<<<<<<<<<<<<<
  24549. *
  24550. *
  24551. */
  24552. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_12_is_linelike_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  24553. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr *__pyx_cur_scope;
  24554. PyObject *__pyx_r = NULL;
  24555. __Pyx_RefNannyDeclarations
  24556. int __pyx_lineno = 0;
  24557. const char *__pyx_filename = NULL;
  24558. int __pyx_clineno = 0;
  24559. __Pyx_RefNannySetupContext("genexpr", 0);
  24560. __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);
  24561. if (unlikely(!__pyx_cur_scope)) {
  24562. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr *)Py_None);
  24563. __Pyx_INCREF(Py_None);
  24564. __PYX_ERR(0, 1382, __pyx_L1_error)
  24565. } else {
  24566. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  24567. }
  24568. __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  24569. __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  24570. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  24571. {
  24572. __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)
  24573. __Pyx_DECREF(__pyx_cur_scope);
  24574. __Pyx_RefNannyFinishContext();
  24575. return (PyObject *) gen;
  24576. }
  24577. /* function exit code */
  24578. __pyx_L1_error:;
  24579. __Pyx_AddTraceback("fontTools.misc.bezierTools._is_linelike.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  24580. __pyx_r = NULL;
  24581. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  24582. __Pyx_XGIVEREF(__pyx_r);
  24583. __Pyx_RefNannyFinishContext();
  24584. return __pyx_r;
  24585. }
  24586. 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 */
  24587. {
  24588. 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);
  24589. PyObject *__pyx_r = NULL;
  24590. PyObject *__pyx_t_1 = NULL;
  24591. Py_ssize_t __pyx_t_2;
  24592. PyObject *(*__pyx_t_3)(PyObject *);
  24593. PyObject *__pyx_t_4 = NULL;
  24594. PyObject *__pyx_t_5 = NULL;
  24595. PyObject *__pyx_t_6 = NULL;
  24596. PyObject *__pyx_t_7 = NULL;
  24597. size_t __pyx_t_8;
  24598. int __pyx_t_9;
  24599. int __pyx_t_10;
  24600. int __pyx_lineno = 0;
  24601. const char *__pyx_filename = NULL;
  24602. int __pyx_clineno = 0;
  24603. __Pyx_RefNannyDeclarations
  24604. __Pyx_RefNannySetupContext("genexpr", 0);
  24605. switch (__pyx_generator->resume_label) {
  24606. case 0: goto __pyx_L3_first_run;
  24607. default: /* CPython raises the right error here */
  24608. __Pyx_RefNannyFinishContext();
  24609. return NULL;
  24610. }
  24611. __pyx_L3_first_run:;
  24612. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1382, __pyx_L1_error)
  24613. if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 1382, __pyx_L1_error) }
  24614. if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
  24615. __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
  24616. __pyx_t_2 = 0;
  24617. __pyx_t_3 = NULL;
  24618. } else {
  24619. __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)
  24620. __Pyx_GOTREF(__pyx_t_1);
  24621. __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)
  24622. }
  24623. for (;;) {
  24624. if (likely(!__pyx_t_3)) {
  24625. if (likely(PyList_CheckExact(__pyx_t_1))) {
  24626. {
  24627. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  24628. #if !CYTHON_ASSUME_SAFE_SIZE
  24629. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1382, __pyx_L1_error)
  24630. #endif
  24631. if (__pyx_t_2 >= __pyx_temp) break;
  24632. }
  24633. __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
  24634. ++__pyx_t_2;
  24635. } else {
  24636. {
  24637. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  24638. #if !CYTHON_ASSUME_SAFE_SIZE
  24639. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1382, __pyx_L1_error)
  24640. #endif
  24641. if (__pyx_t_2 >= __pyx_temp) break;
  24642. }
  24643. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  24644. __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
  24645. #else
  24646. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
  24647. #endif
  24648. ++__pyx_t_2;
  24649. }
  24650. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1382, __pyx_L1_error)
  24651. } else {
  24652. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  24653. if (unlikely(!__pyx_t_4)) {
  24654. PyObject* exc_type = PyErr_Occurred();
  24655. if (exc_type) {
  24656. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1382, __pyx_L1_error)
  24657. PyErr_Clear();
  24658. }
  24659. break;
  24660. }
  24661. }
  24662. __Pyx_GOTREF(__pyx_t_4);
  24663. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_p);
  24664. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_p, __pyx_t_4);
  24665. __Pyx_GIVEREF(__pyx_t_4);
  24666. __pyx_t_4 = 0;
  24667. __pyx_t_5 = NULL;
  24668. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_math); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1382, __pyx_L1_error)
  24669. __Pyx_GOTREF(__pyx_t_6);
  24670. __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)
  24671. __Pyx_GOTREF(__pyx_t_7);
  24672. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  24673. __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)
  24674. __Pyx_GOTREF(__pyx_t_6);
  24675. __pyx_t_8 = 1;
  24676. #if CYTHON_UNPACK_METHODS
  24677. if (unlikely(PyMethod_Check(__pyx_t_7))) {
  24678. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
  24679. assert(__pyx_t_5);
  24680. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
  24681. __Pyx_INCREF(__pyx_t_5);
  24682. __Pyx_INCREF(__pyx__function);
  24683. __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
  24684. __pyx_t_8 = 0;
  24685. }
  24686. #endif
  24687. {
  24688. PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_t_6, __pyx_mstate_global->__pyx_float_0_0};
  24689. __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));
  24690. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  24691. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  24692. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  24693. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1382, __pyx_L1_error)
  24694. __Pyx_GOTREF(__pyx_t_4);
  24695. }
  24696. __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 1382, __pyx_L1_error)
  24697. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  24698. __pyx_t_10 = (!__pyx_t_9);
  24699. if (__pyx_t_10) {
  24700. __Pyx_XDECREF(__pyx_r);
  24701. __Pyx_INCREF(Py_False);
  24702. __pyx_r = Py_False;
  24703. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  24704. goto __pyx_L0;
  24705. }
  24706. }
  24707. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  24708. /*else*/ {
  24709. __Pyx_XDECREF(__pyx_r);
  24710. __Pyx_INCREF(Py_True);
  24711. __pyx_r = Py_True;
  24712. goto __pyx_L0;
  24713. }
  24714. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  24715. /* function exit code */
  24716. goto __pyx_L0;
  24717. __pyx_L1_error:;
  24718. __Pyx_XDECREF(__pyx_t_1);
  24719. __Pyx_XDECREF(__pyx_t_4);
  24720. __Pyx_XDECREF(__pyx_t_5);
  24721. __Pyx_XDECREF(__pyx_t_6);
  24722. __Pyx_XDECREF(__pyx_t_7);
  24723. if (__Pyx_PyErr_Occurred()) {
  24724. __Pyx_Generator_Replace_StopIteration(0);
  24725. __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  24726. }
  24727. __pyx_L0:;
  24728. __Pyx_XGIVEREF(__pyx_r);
  24729. #if !CYTHON_USE_EXC_INFO_STACK
  24730. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  24731. #endif
  24732. __pyx_generator->resume_label = -1;
  24733. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  24734. __Pyx_RefNannyFinishContext();
  24735. return __pyx_r;
  24736. }
  24737. /* "fontTools/misc/bezierTools.py":1380
  24738. *
  24739. *
  24740. * def _is_linelike(segment): # <<<<<<<<<<<<<<
  24741. * maybeline = _alignment_transformation(segment).transformPoints(segment)
  24742. * return all(math.isclose(p[1], 0.0) for p in maybeline)
  24743. */
  24744. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_86_is_linelike(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_segment) {
  24745. PyObject *__pyx_v_maybeline = NULL;
  24746. PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_12_is_linelike_2generator5 = 0;
  24747. PyObject *__pyx_r = NULL;
  24748. __Pyx_RefNannyDeclarations
  24749. PyObject *__pyx_t_1 = NULL;
  24750. PyObject *__pyx_t_2 = NULL;
  24751. PyObject *__pyx_t_3 = NULL;
  24752. PyObject *__pyx_t_4 = NULL;
  24753. PyObject *__pyx_t_5 = NULL;
  24754. size_t __pyx_t_6;
  24755. int __pyx_lineno = 0;
  24756. const char *__pyx_filename = NULL;
  24757. int __pyx_clineno = 0;
  24758. __Pyx_RefNannySetupContext("_is_linelike", 0);
  24759. /* "fontTools/misc/bezierTools.py":1381
  24760. *
  24761. * def _is_linelike(segment):
  24762. * maybeline = _alignment_transformation(segment).transformPoints(segment) # <<<<<<<<<<<<<<
  24763. * return all(math.isclose(p[1], 0.0) for p in maybeline)
  24764. *
  24765. */
  24766. __pyx_t_4 = NULL;
  24767. __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)
  24768. __Pyx_GOTREF(__pyx_t_5);
  24769. __pyx_t_6 = 1;
  24770. #if CYTHON_UNPACK_METHODS
  24771. if (unlikely(PyMethod_Check(__pyx_t_5))) {
  24772. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
  24773. assert(__pyx_t_4);
  24774. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_5);
  24775. __Pyx_INCREF(__pyx_t_4);
  24776. __Pyx_INCREF(__pyx__function);
  24777. __Pyx_DECREF_SET(__pyx_t_5, __pyx__function);
  24778. __pyx_t_6 = 0;
  24779. }
  24780. #endif
  24781. {
  24782. PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_segment};
  24783. __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));
  24784. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  24785. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  24786. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1381, __pyx_L1_error)
  24787. __Pyx_GOTREF(__pyx_t_3);
  24788. }
  24789. __pyx_t_2 = __pyx_t_3;
  24790. __Pyx_INCREF(__pyx_t_2);
  24791. __pyx_t_6 = 0;
  24792. {
  24793. PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_segment};
  24794. __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));
  24795. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  24796. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24797. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1381, __pyx_L1_error)
  24798. __Pyx_GOTREF(__pyx_t_1);
  24799. }
  24800. __pyx_v_maybeline = __pyx_t_1;
  24801. __pyx_t_1 = 0;
  24802. /* "fontTools/misc/bezierTools.py":1382
  24803. * def _is_linelike(segment):
  24804. * maybeline = _alignment_transformation(segment).transformPoints(segment)
  24805. * return all(math.isclose(p[1], 0.0) for p in maybeline) # <<<<<<<<<<<<<<
  24806. *
  24807. *
  24808. */
  24809. __Pyx_XDECREF(__pyx_r);
  24810. __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)
  24811. __Pyx_GOTREF(__pyx_t_1);
  24812. __pyx_t_3 = __Pyx_Generator_GetInlinedResult(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1382, __pyx_L1_error)
  24813. __Pyx_GOTREF(__pyx_t_3);
  24814. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  24815. __pyx_r = __pyx_t_3;
  24816. __pyx_t_3 = 0;
  24817. goto __pyx_L0;
  24818. /* "fontTools/misc/bezierTools.py":1380
  24819. *
  24820. *
  24821. * def _is_linelike(segment): # <<<<<<<<<<<<<<
  24822. * maybeline = _alignment_transformation(segment).transformPoints(segment)
  24823. * return all(math.isclose(p[1], 0.0) for p in maybeline)
  24824. */
  24825. /* function exit code */
  24826. __pyx_L1_error:;
  24827. __Pyx_XDECREF(__pyx_t_1);
  24828. __Pyx_XDECREF(__pyx_t_2);
  24829. __Pyx_XDECREF(__pyx_t_3);
  24830. __Pyx_XDECREF(__pyx_t_4);
  24831. __Pyx_XDECREF(__pyx_t_5);
  24832. __Pyx_AddTraceback("fontTools.misc.bezierTools._is_linelike", __pyx_clineno, __pyx_lineno, __pyx_filename);
  24833. __pyx_r = NULL;
  24834. __pyx_L0:;
  24835. __Pyx_XDECREF(__pyx_v_maybeline);
  24836. __Pyx_XDECREF(__pyx_gb_9fontTools_4misc_11bezierTools_12_is_linelike_2generator5);
  24837. __Pyx_XGIVEREF(__pyx_r);
  24838. __Pyx_RefNannyFinishContext();
  24839. return __pyx_r;
  24840. }
  24841. /* "fontTools/misc/bezierTools.py":1385
  24842. *
  24843. *
  24844. * def curveCurveIntersections(curve1, curve2): # <<<<<<<<<<<<<<
  24845. * """Finds intersections between a curve and a curve.
  24846. *
  24847. */
  24848. /* Python wrapper */
  24849. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_89curveCurveIntersections(PyObject *__pyx_self,
  24850. #if CYTHON_METH_FASTCALL
  24851. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  24852. #else
  24853. PyObject *__pyx_args, PyObject *__pyx_kwds
  24854. #endif
  24855. ); /*proto*/
  24856. 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)");
  24857. 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};
  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. ) {
  24865. PyObject *__pyx_v_curve1 = 0;
  24866. PyObject *__pyx_v_curve2 = 0;
  24867. #if !CYTHON_METH_FASTCALL
  24868. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  24869. #endif
  24870. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  24871. PyObject* values[2] = {0,0};
  24872. int __pyx_lineno = 0;
  24873. const char *__pyx_filename = NULL;
  24874. int __pyx_clineno = 0;
  24875. PyObject *__pyx_r = 0;
  24876. __Pyx_RefNannyDeclarations
  24877. __Pyx_RefNannySetupContext("curveCurveIntersections (wrapper)", 0);
  24878. #if !CYTHON_METH_FASTCALL
  24879. #if CYTHON_ASSUME_SAFE_SIZE
  24880. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  24881. #else
  24882. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  24883. #endif
  24884. #endif
  24885. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  24886. {
  24887. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_curve1,&__pyx_mstate_global->__pyx_n_u_curve2,0};
  24888. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  24889. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1385, __pyx_L3_error)
  24890. if (__pyx_kwds_len > 0) {
  24891. switch (__pyx_nargs) {
  24892. case 2:
  24893. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  24894. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1385, __pyx_L3_error)
  24895. CYTHON_FALLTHROUGH;
  24896. case 1:
  24897. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  24898. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1385, __pyx_L3_error)
  24899. CYTHON_FALLTHROUGH;
  24900. case 0: break;
  24901. default: goto __pyx_L5_argtuple_error;
  24902. }
  24903. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  24904. 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)
  24905. for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
  24906. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("curveCurveIntersections", 1, 2, 2, i); __PYX_ERR(0, 1385, __pyx_L3_error) }
  24907. }
  24908. } else if (unlikely(__pyx_nargs != 2)) {
  24909. goto __pyx_L5_argtuple_error;
  24910. } else {
  24911. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  24912. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1385, __pyx_L3_error)
  24913. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  24914. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1385, __pyx_L3_error)
  24915. }
  24916. __pyx_v_curve1 = values[0];
  24917. __pyx_v_curve2 = values[1];
  24918. }
  24919. goto __pyx_L6_skip;
  24920. __pyx_L5_argtuple_error:;
  24921. __Pyx_RaiseArgtupleInvalid("curveCurveIntersections", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1385, __pyx_L3_error)
  24922. __pyx_L6_skip:;
  24923. goto __pyx_L4_argument_unpacking_done;
  24924. __pyx_L3_error:;
  24925. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  24926. Py_XDECREF(values[__pyx_temp]);
  24927. }
  24928. __Pyx_AddTraceback("fontTools.misc.bezierTools.curveCurveIntersections", __pyx_clineno, __pyx_lineno, __pyx_filename);
  24929. __Pyx_RefNannyFinishContext();
  24930. return NULL;
  24931. __pyx_L4_argument_unpacking_done:;
  24932. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_88curveCurveIntersections(__pyx_self, __pyx_v_curve1, __pyx_v_curve2);
  24933. /* function exit code */
  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_RefNannyFinishContext();
  24938. return __pyx_r;
  24939. }
  24940. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_88curveCurveIntersections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_curve1, PyObject *__pyx_v_curve2) {
  24941. PyObject *__pyx_v_line1 = NULL;
  24942. PyObject *__pyx_v_line2 = NULL;
  24943. PyObject *__pyx_v_hits = NULL;
  24944. PyObject *__pyx_v_intersection_ts = NULL;
  24945. PyObject *__pyx_8genexpr8__pyx_v_x = NULL;
  24946. PyObject *__pyx_8genexpr9__pyx_v_ts = NULL;
  24947. PyObject *__pyx_r = NULL;
  24948. __Pyx_RefNannyDeclarations
  24949. PyObject *__pyx_t_1 = NULL;
  24950. PyObject *__pyx_t_2 = NULL;
  24951. PyObject *__pyx_t_3 = NULL;
  24952. size_t __pyx_t_4;
  24953. int __pyx_t_5;
  24954. Py_ssize_t __pyx_t_6;
  24955. PyObject *(*__pyx_t_7)(PyObject *);
  24956. PyObject *__pyx_t_8 = NULL;
  24957. PyObject *__pyx_t_9 = NULL;
  24958. PyObject *__pyx_t_10 = NULL;
  24959. PyObject *__pyx_t_11 = NULL;
  24960. PyObject *__pyx_t_12 = NULL;
  24961. PyObject *__pyx_t_13 = NULL;
  24962. int __pyx_lineno = 0;
  24963. const char *__pyx_filename = NULL;
  24964. int __pyx_clineno = 0;
  24965. __Pyx_RefNannySetupContext("curveCurveIntersections", 0);
  24966. /* "fontTools/misc/bezierTools.py":1406
  24967. * (81.7831487395506, 109.88904552375288)
  24968. * """
  24969. * if _is_linelike(curve1): # <<<<<<<<<<<<<<
  24970. * line1 = curve1[0], curve1[-1]
  24971. * if _is_linelike(curve2):
  24972. */
  24973. __pyx_t_2 = NULL;
  24974. __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)
  24975. __Pyx_GOTREF(__pyx_t_3);
  24976. __pyx_t_4 = 1;
  24977. #if CYTHON_UNPACK_METHODS
  24978. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  24979. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  24980. assert(__pyx_t_2);
  24981. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  24982. __Pyx_INCREF(__pyx_t_2);
  24983. __Pyx_INCREF(__pyx__function);
  24984. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  24985. __pyx_t_4 = 0;
  24986. }
  24987. #endif
  24988. {
  24989. PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_curve1};
  24990. __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));
  24991. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  24992. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  24993. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1406, __pyx_L1_error)
  24994. __Pyx_GOTREF(__pyx_t_1);
  24995. }
  24996. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1406, __pyx_L1_error)
  24997. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  24998. if (__pyx_t_5) {
  24999. /* "fontTools/misc/bezierTools.py":1407
  25000. * """
  25001. * if _is_linelike(curve1):
  25002. * line1 = curve1[0], curve1[-1] # <<<<<<<<<<<<<<
  25003. * if _is_linelike(curve2):
  25004. * line2 = curve2[0], curve2[-1]
  25005. */
  25006. __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)
  25007. __Pyx_GOTREF(__pyx_t_1);
  25008. __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)
  25009. __Pyx_GOTREF(__pyx_t_3);
  25010. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1407, __pyx_L1_error)
  25011. __Pyx_GOTREF(__pyx_t_2);
  25012. __Pyx_GIVEREF(__pyx_t_1);
  25013. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1) != (0)) __PYX_ERR(0, 1407, __pyx_L1_error);
  25014. __Pyx_GIVEREF(__pyx_t_3);
  25015. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3) != (0)) __PYX_ERR(0, 1407, __pyx_L1_error);
  25016. __pyx_t_1 = 0;
  25017. __pyx_t_3 = 0;
  25018. __pyx_v_line1 = ((PyObject*)__pyx_t_2);
  25019. __pyx_t_2 = 0;
  25020. /* "fontTools/misc/bezierTools.py":1408
  25021. * if _is_linelike(curve1):
  25022. * line1 = curve1[0], curve1[-1]
  25023. * if _is_linelike(curve2): # <<<<<<<<<<<<<<
  25024. * line2 = curve2[0], curve2[-1]
  25025. * return lineLineIntersections(*line1, *line2)
  25026. */
  25027. __pyx_t_3 = NULL;
  25028. __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)
  25029. __Pyx_GOTREF(__pyx_t_1);
  25030. __pyx_t_4 = 1;
  25031. #if CYTHON_UNPACK_METHODS
  25032. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  25033. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
  25034. assert(__pyx_t_3);
  25035. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  25036. __Pyx_INCREF(__pyx_t_3);
  25037. __Pyx_INCREF(__pyx__function);
  25038. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  25039. __pyx_t_4 = 0;
  25040. }
  25041. #endif
  25042. {
  25043. PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_curve2};
  25044. __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));
  25045. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  25046. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  25047. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1408, __pyx_L1_error)
  25048. __Pyx_GOTREF(__pyx_t_2);
  25049. }
  25050. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1408, __pyx_L1_error)
  25051. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  25052. if (__pyx_t_5) {
  25053. /* "fontTools/misc/bezierTools.py":1409
  25054. * line1 = curve1[0], curve1[-1]
  25055. * if _is_linelike(curve2):
  25056. * line2 = curve2[0], curve2[-1] # <<<<<<<<<<<<<<
  25057. * return lineLineIntersections(*line1, *line2)
  25058. * else:
  25059. */
  25060. __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)
  25061. __Pyx_GOTREF(__pyx_t_2);
  25062. __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)
  25063. __Pyx_GOTREF(__pyx_t_1);
  25064. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1409, __pyx_L1_error)
  25065. __Pyx_GOTREF(__pyx_t_3);
  25066. __Pyx_GIVEREF(__pyx_t_2);
  25067. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 1409, __pyx_L1_error);
  25068. __Pyx_GIVEREF(__pyx_t_1);
  25069. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 1409, __pyx_L1_error);
  25070. __pyx_t_2 = 0;
  25071. __pyx_t_1 = 0;
  25072. __pyx_v_line2 = ((PyObject*)__pyx_t_3);
  25073. __pyx_t_3 = 0;
  25074. /* "fontTools/misc/bezierTools.py":1410
  25075. * if _is_linelike(curve2):
  25076. * line2 = curve2[0], curve2[-1]
  25077. * return lineLineIntersections(*line1, *line2) # <<<<<<<<<<<<<<
  25078. * else:
  25079. * hits = curveLineIntersections(curve2, line1)
  25080. */
  25081. __Pyx_XDECREF(__pyx_r);
  25082. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_lineLineIntersections); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1410, __pyx_L1_error)
  25083. __Pyx_GOTREF(__pyx_t_3);
  25084. __pyx_t_1 = PyNumber_Add(__pyx_v_line1, __pyx_v_line2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1410, __pyx_L1_error)
  25085. __Pyx_GOTREF(__pyx_t_1);
  25086. __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)
  25087. __Pyx_GOTREF(__pyx_t_2);
  25088. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  25089. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  25090. __pyx_r = __pyx_t_2;
  25091. __pyx_t_2 = 0;
  25092. goto __pyx_L0;
  25093. /* "fontTools/misc/bezierTools.py":1408
  25094. * if _is_linelike(curve1):
  25095. * line1 = curve1[0], curve1[-1]
  25096. * if _is_linelike(curve2): # <<<<<<<<<<<<<<
  25097. * line2 = curve2[0], curve2[-1]
  25098. * return lineLineIntersections(*line1, *line2)
  25099. */
  25100. }
  25101. /* "fontTools/misc/bezierTools.py":1412
  25102. * return lineLineIntersections(*line1, *line2)
  25103. * else:
  25104. * hits = curveLineIntersections(curve2, line1) # <<<<<<<<<<<<<<
  25105. * # curve is passed first to this fn but is the second segment, so
  25106. * # we need to swap t1/t2 in the result
  25107. */
  25108. /*else*/ {
  25109. __pyx_t_1 = NULL;
  25110. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_curveLineIntersections); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1412, __pyx_L1_error)
  25111. __Pyx_GOTREF(__pyx_t_3);
  25112. __pyx_t_4 = 1;
  25113. #if CYTHON_UNPACK_METHODS
  25114. if (unlikely(PyMethod_Check(__pyx_t_3))) {
  25115. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
  25116. assert(__pyx_t_1);
  25117. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
  25118. __Pyx_INCREF(__pyx_t_1);
  25119. __Pyx_INCREF(__pyx__function);
  25120. __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
  25121. __pyx_t_4 = 0;
  25122. }
  25123. #endif
  25124. {
  25125. PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_v_curve2, __pyx_v_line1};
  25126. __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));
  25127. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  25128. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  25129. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1412, __pyx_L1_error)
  25130. __Pyx_GOTREF(__pyx_t_2);
  25131. }
  25132. __pyx_v_hits = __pyx_t_2;
  25133. __pyx_t_2 = 0;
  25134. /* "fontTools/misc/bezierTools.py":1415
  25135. * # curve is passed first to this fn but is the second segment, so
  25136. * # we need to swap t1/t2 in the result
  25137. * return [Intersection(pt=x.pt, t1=x.t2, t2=x.t1) for x in hits] # <<<<<<<<<<<<<<
  25138. * elif _is_linelike(curve2):
  25139. * line2 = curve2[0], curve2[-1]
  25140. */
  25141. __Pyx_XDECREF(__pyx_r);
  25142. { /* enter inner scope */
  25143. __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1415, __pyx_L7_error)
  25144. __Pyx_GOTREF(__pyx_t_2);
  25145. if (likely(PyList_CheckExact(__pyx_v_hits)) || PyTuple_CheckExact(__pyx_v_hits)) {
  25146. __pyx_t_3 = __pyx_v_hits; __Pyx_INCREF(__pyx_t_3);
  25147. __pyx_t_6 = 0;
  25148. __pyx_t_7 = NULL;
  25149. } else {
  25150. __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_hits); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1415, __pyx_L7_error)
  25151. __Pyx_GOTREF(__pyx_t_3);
  25152. __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)
  25153. }
  25154. for (;;) {
  25155. if (likely(!__pyx_t_7)) {
  25156. if (likely(PyList_CheckExact(__pyx_t_3))) {
  25157. {
  25158. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
  25159. #if !CYTHON_ASSUME_SAFE_SIZE
  25160. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1415, __pyx_L7_error)
  25161. #endif
  25162. if (__pyx_t_6 >= __pyx_temp) break;
  25163. }
  25164. __pyx_t_1 = __Pyx_PyList_GetItemRefFast(__pyx_t_3, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference);
  25165. ++__pyx_t_6;
  25166. } else {
  25167. {
  25168. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
  25169. #if !CYTHON_ASSUME_SAFE_SIZE
  25170. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1415, __pyx_L7_error)
  25171. #endif
  25172. if (__pyx_t_6 >= __pyx_temp) break;
  25173. }
  25174. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  25175. __pyx_t_1 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6));
  25176. #else
  25177. __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_6);
  25178. #endif
  25179. ++__pyx_t_6;
  25180. }
  25181. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1415, __pyx_L7_error)
  25182. } else {
  25183. __pyx_t_1 = __pyx_t_7(__pyx_t_3);
  25184. if (unlikely(!__pyx_t_1)) {
  25185. PyObject* exc_type = PyErr_Occurred();
  25186. if (exc_type) {
  25187. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1415, __pyx_L7_error)
  25188. PyErr_Clear();
  25189. }
  25190. break;
  25191. }
  25192. }
  25193. __Pyx_GOTREF(__pyx_t_1);
  25194. __Pyx_XDECREF_SET(__pyx_8genexpr8__pyx_v_x, __pyx_t_1);
  25195. __pyx_t_1 = 0;
  25196. __pyx_t_8 = NULL;
  25197. __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_mstate_global->__pyx_n_u_Intersection); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1415, __pyx_L7_error)
  25198. __Pyx_GOTREF(__pyx_t_9);
  25199. __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)
  25200. __Pyx_GOTREF(__pyx_t_10);
  25201. __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)
  25202. __Pyx_GOTREF(__pyx_t_11);
  25203. __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)
  25204. __Pyx_GOTREF(__pyx_t_12);
  25205. __pyx_t_4 = 1;
  25206. #if CYTHON_UNPACK_METHODS
  25207. if (unlikely(PyMethod_Check(__pyx_t_9))) {
  25208. __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
  25209. assert(__pyx_t_8);
  25210. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_9);
  25211. __Pyx_INCREF(__pyx_t_8);
  25212. __Pyx_INCREF(__pyx__function);
  25213. __Pyx_DECREF_SET(__pyx_t_9, __pyx__function);
  25214. __pyx_t_4 = 0;
  25215. }
  25216. #endif
  25217. {
  25218. PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_8, NULL};
  25219. __pyx_t_13 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1415, __pyx_L7_error)
  25220. __Pyx_GOTREF(__pyx_t_13);
  25221. 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)
  25222. 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)
  25223. 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)
  25224. __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);
  25225. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  25226. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  25227. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  25228. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  25229. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  25230. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  25231. if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1415, __pyx_L7_error)
  25232. __Pyx_GOTREF(__pyx_t_1);
  25233. }
  25234. if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 1415, __pyx_L7_error)
  25235. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  25236. }
  25237. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  25238. __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_x); __pyx_8genexpr8__pyx_v_x = 0;
  25239. goto __pyx_L11_exit_scope;
  25240. __pyx_L7_error:;
  25241. __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_x); __pyx_8genexpr8__pyx_v_x = 0;
  25242. goto __pyx_L1_error;
  25243. __pyx_L11_exit_scope:;
  25244. } /* exit inner scope */
  25245. __pyx_r = __pyx_t_2;
  25246. __pyx_t_2 = 0;
  25247. goto __pyx_L0;
  25248. }
  25249. /* "fontTools/misc/bezierTools.py":1406
  25250. * (81.7831487395506, 109.88904552375288)
  25251. * """
  25252. * if _is_linelike(curve1): # <<<<<<<<<<<<<<
  25253. * line1 = curve1[0], curve1[-1]
  25254. * if _is_linelike(curve2):
  25255. */
  25256. }
  25257. /* "fontTools/misc/bezierTools.py":1416
  25258. * # we need to swap t1/t2 in the result
  25259. * return [Intersection(pt=x.pt, t1=x.t2, t2=x.t1) for x in hits]
  25260. * elif _is_linelike(curve2): # <<<<<<<<<<<<<<
  25261. * line2 = curve2[0], curve2[-1]
  25262. * return curveLineIntersections(curve1, line2)
  25263. */
  25264. __pyx_t_3 = NULL;
  25265. __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)
  25266. __Pyx_GOTREF(__pyx_t_1);
  25267. __pyx_t_4 = 1;
  25268. #if CYTHON_UNPACK_METHODS
  25269. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  25270. __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
  25271. assert(__pyx_t_3);
  25272. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  25273. __Pyx_INCREF(__pyx_t_3);
  25274. __Pyx_INCREF(__pyx__function);
  25275. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  25276. __pyx_t_4 = 0;
  25277. }
  25278. #endif
  25279. {
  25280. PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_curve2};
  25281. __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));
  25282. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  25283. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  25284. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1416, __pyx_L1_error)
  25285. __Pyx_GOTREF(__pyx_t_2);
  25286. }
  25287. __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1416, __pyx_L1_error)
  25288. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  25289. if (__pyx_t_5) {
  25290. /* "fontTools/misc/bezierTools.py":1417
  25291. * return [Intersection(pt=x.pt, t1=x.t2, t2=x.t1) for x in hits]
  25292. * elif _is_linelike(curve2):
  25293. * line2 = curve2[0], curve2[-1] # <<<<<<<<<<<<<<
  25294. * return curveLineIntersections(curve1, line2)
  25295. *
  25296. */
  25297. __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)
  25298. __Pyx_GOTREF(__pyx_t_2);
  25299. __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)
  25300. __Pyx_GOTREF(__pyx_t_1);
  25301. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1417, __pyx_L1_error)
  25302. __Pyx_GOTREF(__pyx_t_3);
  25303. __Pyx_GIVEREF(__pyx_t_2);
  25304. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2) != (0)) __PYX_ERR(0, 1417, __pyx_L1_error);
  25305. __Pyx_GIVEREF(__pyx_t_1);
  25306. if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1) != (0)) __PYX_ERR(0, 1417, __pyx_L1_error);
  25307. __pyx_t_2 = 0;
  25308. __pyx_t_1 = 0;
  25309. __pyx_v_line2 = ((PyObject*)__pyx_t_3);
  25310. __pyx_t_3 = 0;
  25311. /* "fontTools/misc/bezierTools.py":1418
  25312. * elif _is_linelike(curve2):
  25313. * line2 = curve2[0], curve2[-1]
  25314. * return curveLineIntersections(curve1, line2) # <<<<<<<<<<<<<<
  25315. *
  25316. * intersection_ts = _curve_curve_intersections_t(curve1, curve2)
  25317. */
  25318. __Pyx_XDECREF(__pyx_r);
  25319. __pyx_t_1 = NULL;
  25320. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_curveLineIntersections); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1418, __pyx_L1_error)
  25321. __Pyx_GOTREF(__pyx_t_2);
  25322. __pyx_t_4 = 1;
  25323. #if CYTHON_UNPACK_METHODS
  25324. if (unlikely(PyMethod_Check(__pyx_t_2))) {
  25325. __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
  25326. assert(__pyx_t_1);
  25327. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
  25328. __Pyx_INCREF(__pyx_t_1);
  25329. __Pyx_INCREF(__pyx__function);
  25330. __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
  25331. __pyx_t_4 = 0;
  25332. }
  25333. #endif
  25334. {
  25335. PyObject *__pyx_callargs[3] = {__pyx_t_1, __pyx_v_curve1, __pyx_v_line2};
  25336. __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));
  25337. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  25338. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  25339. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1418, __pyx_L1_error)
  25340. __Pyx_GOTREF(__pyx_t_3);
  25341. }
  25342. __pyx_r = __pyx_t_3;
  25343. __pyx_t_3 = 0;
  25344. goto __pyx_L0;
  25345. /* "fontTools/misc/bezierTools.py":1416
  25346. * # we need to swap t1/t2 in the result
  25347. * return [Intersection(pt=x.pt, t1=x.t2, t2=x.t1) for x in hits]
  25348. * elif _is_linelike(curve2): # <<<<<<<<<<<<<<
  25349. * line2 = curve2[0], curve2[-1]
  25350. * return curveLineIntersections(curve1, line2)
  25351. */
  25352. }
  25353. /* "fontTools/misc/bezierTools.py":1420
  25354. * return curveLineIntersections(curve1, line2)
  25355. *
  25356. * intersection_ts = _curve_curve_intersections_t(curve1, curve2) # <<<<<<<<<<<<<<
  25357. * return [
  25358. * Intersection(pt=segmentPointAtT(curve1, ts[0]), t1=ts[0], t2=ts[1])
  25359. */
  25360. __pyx_t_2 = NULL;
  25361. __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)
  25362. __Pyx_GOTREF(__pyx_t_1);
  25363. __pyx_t_4 = 1;
  25364. #if CYTHON_UNPACK_METHODS
  25365. if (unlikely(PyMethod_Check(__pyx_t_1))) {
  25366. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
  25367. assert(__pyx_t_2);
  25368. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_1);
  25369. __Pyx_INCREF(__pyx_t_2);
  25370. __Pyx_INCREF(__pyx__function);
  25371. __Pyx_DECREF_SET(__pyx_t_1, __pyx__function);
  25372. __pyx_t_4 = 0;
  25373. }
  25374. #endif
  25375. {
  25376. PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_v_curve1, __pyx_v_curve2};
  25377. __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));
  25378. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  25379. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  25380. if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1420, __pyx_L1_error)
  25381. __Pyx_GOTREF(__pyx_t_3);
  25382. }
  25383. __pyx_v_intersection_ts = __pyx_t_3;
  25384. __pyx_t_3 = 0;
  25385. /* "fontTools/misc/bezierTools.py":1421
  25386. *
  25387. * intersection_ts = _curve_curve_intersections_t(curve1, curve2)
  25388. * return [ # <<<<<<<<<<<<<<
  25389. * Intersection(pt=segmentPointAtT(curve1, ts[0]), t1=ts[0], t2=ts[1])
  25390. * for ts in intersection_ts
  25391. */
  25392. __Pyx_XDECREF(__pyx_r);
  25393. { /* enter inner scope */
  25394. __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1421, __pyx_L14_error)
  25395. __Pyx_GOTREF(__pyx_t_3);
  25396. /* "fontTools/misc/bezierTools.py":1423
  25397. * return [
  25398. * Intersection(pt=segmentPointAtT(curve1, ts[0]), t1=ts[0], t2=ts[1])
  25399. * for ts in intersection_ts # <<<<<<<<<<<<<<
  25400. * ]
  25401. *
  25402. */
  25403. if (likely(PyList_CheckExact(__pyx_v_intersection_ts)) || PyTuple_CheckExact(__pyx_v_intersection_ts)) {
  25404. __pyx_t_1 = __pyx_v_intersection_ts; __Pyx_INCREF(__pyx_t_1);
  25405. __pyx_t_6 = 0;
  25406. __pyx_t_7 = NULL;
  25407. } else {
  25408. __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)
  25409. __Pyx_GOTREF(__pyx_t_1);
  25410. __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)
  25411. }
  25412. for (;;) {
  25413. if (likely(!__pyx_t_7)) {
  25414. if (likely(PyList_CheckExact(__pyx_t_1))) {
  25415. {
  25416. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  25417. #if !CYTHON_ASSUME_SAFE_SIZE
  25418. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1423, __pyx_L14_error)
  25419. #endif
  25420. if (__pyx_t_6 >= __pyx_temp) break;
  25421. }
  25422. __pyx_t_2 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_6, __Pyx_ReferenceSharing_OwnStrongReference);
  25423. ++__pyx_t_6;
  25424. } else {
  25425. {
  25426. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  25427. #if !CYTHON_ASSUME_SAFE_SIZE
  25428. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1423, __pyx_L14_error)
  25429. #endif
  25430. if (__pyx_t_6 >= __pyx_temp) break;
  25431. }
  25432. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  25433. __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6));
  25434. #else
  25435. __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_6);
  25436. #endif
  25437. ++__pyx_t_6;
  25438. }
  25439. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1423, __pyx_L14_error)
  25440. } else {
  25441. __pyx_t_2 = __pyx_t_7(__pyx_t_1);
  25442. if (unlikely(!__pyx_t_2)) {
  25443. PyObject* exc_type = PyErr_Occurred();
  25444. if (exc_type) {
  25445. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1423, __pyx_L14_error)
  25446. PyErr_Clear();
  25447. }
  25448. break;
  25449. }
  25450. }
  25451. __Pyx_GOTREF(__pyx_t_2);
  25452. __Pyx_XDECREF_SET(__pyx_8genexpr9__pyx_v_ts, __pyx_t_2);
  25453. __pyx_t_2 = 0;
  25454. /* "fontTools/misc/bezierTools.py":1422
  25455. * intersection_ts = _curve_curve_intersections_t(curve1, curve2)
  25456. * return [
  25457. * Intersection(pt=segmentPointAtT(curve1, ts[0]), t1=ts[0], t2=ts[1]) # <<<<<<<<<<<<<<
  25458. * for ts in intersection_ts
  25459. * ]
  25460. */
  25461. __pyx_t_9 = NULL;
  25462. __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_Intersection); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1422, __pyx_L14_error)
  25463. __Pyx_GOTREF(__pyx_t_13);
  25464. __pyx_t_11 = NULL;
  25465. __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_mstate_global->__pyx_n_u_segmentPointAtT); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1422, __pyx_L14_error)
  25466. __Pyx_GOTREF(__pyx_t_10);
  25467. __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)
  25468. __Pyx_GOTREF(__pyx_t_8);
  25469. __pyx_t_4 = 1;
  25470. #if CYTHON_UNPACK_METHODS
  25471. if (unlikely(PyMethod_Check(__pyx_t_10))) {
  25472. __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
  25473. assert(__pyx_t_11);
  25474. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_10);
  25475. __Pyx_INCREF(__pyx_t_11);
  25476. __Pyx_INCREF(__pyx__function);
  25477. __Pyx_DECREF_SET(__pyx_t_10, __pyx__function);
  25478. __pyx_t_4 = 0;
  25479. }
  25480. #endif
  25481. {
  25482. PyObject *__pyx_callargs[3] = {__pyx_t_11, __pyx_v_curve1, __pyx_t_8};
  25483. __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));
  25484. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  25485. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  25486. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  25487. if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1422, __pyx_L14_error)
  25488. __Pyx_GOTREF(__pyx_t_12);
  25489. }
  25490. __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)
  25491. __Pyx_GOTREF(__pyx_t_10);
  25492. __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)
  25493. __Pyx_GOTREF(__pyx_t_8);
  25494. __pyx_t_4 = 1;
  25495. #if CYTHON_UNPACK_METHODS
  25496. if (unlikely(PyMethod_Check(__pyx_t_13))) {
  25497. __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_13);
  25498. assert(__pyx_t_9);
  25499. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_13);
  25500. __Pyx_INCREF(__pyx_t_9);
  25501. __Pyx_INCREF(__pyx__function);
  25502. __Pyx_DECREF_SET(__pyx_t_13, __pyx__function);
  25503. __pyx_t_4 = 0;
  25504. }
  25505. #endif
  25506. {
  25507. PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_9, NULL};
  25508. __pyx_t_11 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1422, __pyx_L14_error)
  25509. __Pyx_GOTREF(__pyx_t_11);
  25510. 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)
  25511. 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)
  25512. 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)
  25513. __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);
  25514. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  25515. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  25516. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  25517. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  25518. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  25519. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  25520. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1422, __pyx_L14_error)
  25521. __Pyx_GOTREF(__pyx_t_2);
  25522. }
  25523. if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 1421, __pyx_L14_error)
  25524. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  25525. /* "fontTools/misc/bezierTools.py":1423
  25526. * return [
  25527. * Intersection(pt=segmentPointAtT(curve1, ts[0]), t1=ts[0], t2=ts[1])
  25528. * for ts in intersection_ts # <<<<<<<<<<<<<<
  25529. * ]
  25530. *
  25531. */
  25532. }
  25533. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  25534. __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_ts); __pyx_8genexpr9__pyx_v_ts = 0;
  25535. goto __pyx_L18_exit_scope;
  25536. __pyx_L14_error:;
  25537. __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_ts); __pyx_8genexpr9__pyx_v_ts = 0;
  25538. goto __pyx_L1_error;
  25539. __pyx_L18_exit_scope:;
  25540. } /* exit inner scope */
  25541. __pyx_r = __pyx_t_3;
  25542. __pyx_t_3 = 0;
  25543. goto __pyx_L0;
  25544. /* "fontTools/misc/bezierTools.py":1385
  25545. *
  25546. *
  25547. * def curveCurveIntersections(curve1, curve2): # <<<<<<<<<<<<<<
  25548. * """Finds intersections between a curve and a curve.
  25549. *
  25550. */
  25551. /* function exit code */
  25552. __pyx_L1_error:;
  25553. __Pyx_XDECREF(__pyx_t_1);
  25554. __Pyx_XDECREF(__pyx_t_2);
  25555. __Pyx_XDECREF(__pyx_t_3);
  25556. __Pyx_XDECREF(__pyx_t_8);
  25557. __Pyx_XDECREF(__pyx_t_9);
  25558. __Pyx_XDECREF(__pyx_t_10);
  25559. __Pyx_XDECREF(__pyx_t_11);
  25560. __Pyx_XDECREF(__pyx_t_12);
  25561. __Pyx_XDECREF(__pyx_t_13);
  25562. __Pyx_AddTraceback("fontTools.misc.bezierTools.curveCurveIntersections", __pyx_clineno, __pyx_lineno, __pyx_filename);
  25563. __pyx_r = NULL;
  25564. __pyx_L0:;
  25565. __Pyx_XDECREF(__pyx_v_line1);
  25566. __Pyx_XDECREF(__pyx_v_line2);
  25567. __Pyx_XDECREF(__pyx_v_hits);
  25568. __Pyx_XDECREF(__pyx_v_intersection_ts);
  25569. __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_x);
  25570. __Pyx_XDECREF(__pyx_8genexpr9__pyx_v_ts);
  25571. __Pyx_XGIVEREF(__pyx_r);
  25572. __Pyx_RefNannyFinishContext();
  25573. return __pyx_r;
  25574. }
  25575. /* "fontTools/misc/bezierTools.py":1427
  25576. *
  25577. *
  25578. * def segmentSegmentIntersections(seg1, seg2): # <<<<<<<<<<<<<<
  25579. * """Finds intersections between two segments.
  25580. *
  25581. */
  25582. /* Python wrapper */
  25583. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_91segmentSegmentIntersections(PyObject *__pyx_self,
  25584. #if CYTHON_METH_FASTCALL
  25585. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  25586. #else
  25587. PyObject *__pyx_args, PyObject *__pyx_kwds
  25588. #endif
  25589. ); /*proto*/
  25590. 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)");
  25591. 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};
  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. ) {
  25599. PyObject *__pyx_v_seg1 = 0;
  25600. PyObject *__pyx_v_seg2 = 0;
  25601. #if !CYTHON_METH_FASTCALL
  25602. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  25603. #endif
  25604. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  25605. PyObject* values[2] = {0,0};
  25606. int __pyx_lineno = 0;
  25607. const char *__pyx_filename = NULL;
  25608. int __pyx_clineno = 0;
  25609. PyObject *__pyx_r = 0;
  25610. __Pyx_RefNannyDeclarations
  25611. __Pyx_RefNannySetupContext("segmentSegmentIntersections (wrapper)", 0);
  25612. #if !CYTHON_METH_FASTCALL
  25613. #if CYTHON_ASSUME_SAFE_SIZE
  25614. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  25615. #else
  25616. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  25617. #endif
  25618. #endif
  25619. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  25620. {
  25621. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_seg1,&__pyx_mstate_global->__pyx_n_u_seg2,0};
  25622. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  25623. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1427, __pyx_L3_error)
  25624. if (__pyx_kwds_len > 0) {
  25625. switch (__pyx_nargs) {
  25626. case 2:
  25627. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  25628. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1427, __pyx_L3_error)
  25629. CYTHON_FALLTHROUGH;
  25630. case 1:
  25631. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  25632. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1427, __pyx_L3_error)
  25633. CYTHON_FALLTHROUGH;
  25634. case 0: break;
  25635. default: goto __pyx_L5_argtuple_error;
  25636. }
  25637. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  25638. 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)
  25639. for (Py_ssize_t i = __pyx_nargs; i < 2; i++) {
  25640. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("segmentSegmentIntersections", 1, 2, 2, i); __PYX_ERR(0, 1427, __pyx_L3_error) }
  25641. }
  25642. } else if (unlikely(__pyx_nargs != 2)) {
  25643. goto __pyx_L5_argtuple_error;
  25644. } else {
  25645. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  25646. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1427, __pyx_L3_error)
  25647. values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
  25648. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1427, __pyx_L3_error)
  25649. }
  25650. __pyx_v_seg1 = values[0];
  25651. __pyx_v_seg2 = values[1];
  25652. }
  25653. goto __pyx_L6_skip;
  25654. __pyx_L5_argtuple_error:;
  25655. __Pyx_RaiseArgtupleInvalid("segmentSegmentIntersections", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 1427, __pyx_L3_error)
  25656. __pyx_L6_skip:;
  25657. goto __pyx_L4_argument_unpacking_done;
  25658. __pyx_L3_error:;
  25659. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  25660. Py_XDECREF(values[__pyx_temp]);
  25661. }
  25662. __Pyx_AddTraceback("fontTools.misc.bezierTools.segmentSegmentIntersections", __pyx_clineno, __pyx_lineno, __pyx_filename);
  25663. __Pyx_RefNannyFinishContext();
  25664. return NULL;
  25665. __pyx_L4_argument_unpacking_done:;
  25666. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_90segmentSegmentIntersections(__pyx_self, __pyx_v_seg1, __pyx_v_seg2);
  25667. /* function exit code */
  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_RefNannyFinishContext();
  25672. return __pyx_r;
  25673. }
  25674. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_90segmentSegmentIntersections(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_seg1, PyObject *__pyx_v_seg2) {
  25675. int __pyx_v_swapped;
  25676. PyObject *__pyx_v_intersections = NULL;
  25677. PyObject *__pyx_9genexpr10__pyx_v_i = NULL;
  25678. PyObject *__pyx_r = NULL;
  25679. __Pyx_RefNannyDeclarations
  25680. Py_ssize_t __pyx_t_1;
  25681. Py_ssize_t __pyx_t_2;
  25682. int __pyx_t_3;
  25683. PyObject *__pyx_t_4 = NULL;
  25684. PyObject *__pyx_t_5 = NULL;
  25685. PyObject *__pyx_t_6 = NULL;
  25686. PyObject *__pyx_t_7 = NULL;
  25687. PyObject *__pyx_t_8 = NULL;
  25688. size_t __pyx_t_9;
  25689. int __pyx_t_10;
  25690. PyObject *__pyx_t_11 = NULL;
  25691. PyObject *(*__pyx_t_12)(PyObject *);
  25692. PyObject *__pyx_t_13 = NULL;
  25693. PyObject *__pyx_t_14 = NULL;
  25694. PyObject *__pyx_t_15 = NULL;
  25695. PyObject *__pyx_t_16 = NULL;
  25696. PyObject *__pyx_t_17 = NULL;
  25697. int __pyx_lineno = 0;
  25698. const char *__pyx_filename = NULL;
  25699. int __pyx_clineno = 0;
  25700. __Pyx_RefNannySetupContext("segmentSegmentIntersections", 0);
  25701. __Pyx_INCREF(__pyx_v_seg1);
  25702. __Pyx_INCREF(__pyx_v_seg2);
  25703. /* "fontTools/misc/bezierTools.py":1457
  25704. * """
  25705. * # Arrange by degree
  25706. * swapped = False # <<<<<<<<<<<<<<
  25707. * if len(seg2) > len(seg1):
  25708. * seg2, seg1 = seg1, seg2
  25709. */
  25710. __pyx_v_swapped = 0;
  25711. /* "fontTools/misc/bezierTools.py":1458
  25712. * # Arrange by degree
  25713. * swapped = False
  25714. * if len(seg2) > len(seg1): # <<<<<<<<<<<<<<
  25715. * seg2, seg1 = seg1, seg2
  25716. * swapped = True
  25717. */
  25718. __pyx_t_1 = PyObject_Length(__pyx_v_seg2); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1458, __pyx_L1_error)
  25719. __pyx_t_2 = PyObject_Length(__pyx_v_seg1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1458, __pyx_L1_error)
  25720. __pyx_t_3 = (__pyx_t_1 > __pyx_t_2);
  25721. if (__pyx_t_3) {
  25722. /* "fontTools/misc/bezierTools.py":1459
  25723. * swapped = False
  25724. * if len(seg2) > len(seg1):
  25725. * seg2, seg1 = seg1, seg2 # <<<<<<<<<<<<<<
  25726. * swapped = True
  25727. * if len(seg1) > 2:
  25728. */
  25729. __pyx_t_4 = __pyx_v_seg1;
  25730. __pyx_t_5 = __pyx_v_seg2;
  25731. __pyx_v_seg2 = __pyx_t_4;
  25732. __pyx_t_4 = 0;
  25733. __pyx_v_seg1 = __pyx_t_5;
  25734. __pyx_t_5 = 0;
  25735. /* "fontTools/misc/bezierTools.py":1460
  25736. * if len(seg2) > len(seg1):
  25737. * seg2, seg1 = seg1, seg2
  25738. * swapped = True # <<<<<<<<<<<<<<
  25739. * if len(seg1) > 2:
  25740. * if len(seg2) > 2:
  25741. */
  25742. __pyx_v_swapped = 1;
  25743. /* "fontTools/misc/bezierTools.py":1458
  25744. * # Arrange by degree
  25745. * swapped = False
  25746. * if len(seg2) > len(seg1): # <<<<<<<<<<<<<<
  25747. * seg2, seg1 = seg1, seg2
  25748. * swapped = True
  25749. */
  25750. }
  25751. /* "fontTools/misc/bezierTools.py":1461
  25752. * seg2, seg1 = seg1, seg2
  25753. * swapped = True
  25754. * if len(seg1) > 2: # <<<<<<<<<<<<<<
  25755. * if len(seg2) > 2:
  25756. * intersections = curveCurveIntersections(seg1, seg2)
  25757. */
  25758. __pyx_t_2 = PyObject_Length(__pyx_v_seg1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1461, __pyx_L1_error)
  25759. __pyx_t_3 = (__pyx_t_2 > 2);
  25760. if (__pyx_t_3) {
  25761. /* "fontTools/misc/bezierTools.py":1462
  25762. * swapped = True
  25763. * if len(seg1) > 2:
  25764. * if len(seg2) > 2: # <<<<<<<<<<<<<<
  25765. * intersections = curveCurveIntersections(seg1, seg2)
  25766. * else:
  25767. */
  25768. __pyx_t_2 = PyObject_Length(__pyx_v_seg2); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1462, __pyx_L1_error)
  25769. __pyx_t_3 = (__pyx_t_2 > 2);
  25770. if (__pyx_t_3) {
  25771. /* "fontTools/misc/bezierTools.py":1463
  25772. * if len(seg1) > 2:
  25773. * if len(seg2) > 2:
  25774. * intersections = curveCurveIntersections(seg1, seg2) # <<<<<<<<<<<<<<
  25775. * else:
  25776. * intersections = curveLineIntersections(seg1, seg2)
  25777. */
  25778. __pyx_t_7 = NULL;
  25779. __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_curveCurveIntersections); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1463, __pyx_L1_error)
  25780. __Pyx_GOTREF(__pyx_t_8);
  25781. __pyx_t_9 = 1;
  25782. #if CYTHON_UNPACK_METHODS
  25783. if (unlikely(PyMethod_Check(__pyx_t_8))) {
  25784. __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
  25785. assert(__pyx_t_7);
  25786. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
  25787. __Pyx_INCREF(__pyx_t_7);
  25788. __Pyx_INCREF(__pyx__function);
  25789. __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
  25790. __pyx_t_9 = 0;
  25791. }
  25792. #endif
  25793. {
  25794. PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_v_seg1, __pyx_v_seg2};
  25795. __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));
  25796. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  25797. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  25798. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1463, __pyx_L1_error)
  25799. __Pyx_GOTREF(__pyx_t_6);
  25800. }
  25801. __pyx_v_intersections = __pyx_t_6;
  25802. __pyx_t_6 = 0;
  25803. /* "fontTools/misc/bezierTools.py":1462
  25804. * swapped = True
  25805. * if len(seg1) > 2:
  25806. * if len(seg2) > 2: # <<<<<<<<<<<<<<
  25807. * intersections = curveCurveIntersections(seg1, seg2)
  25808. * else:
  25809. */
  25810. goto __pyx_L5;
  25811. }
  25812. /* "fontTools/misc/bezierTools.py":1465
  25813. * intersections = curveCurveIntersections(seg1, seg2)
  25814. * else:
  25815. * intersections = curveLineIntersections(seg1, seg2) # <<<<<<<<<<<<<<
  25816. * elif len(seg1) == 2 and len(seg2) == 2:
  25817. * intersections = lineLineIntersections(*seg1, *seg2)
  25818. */
  25819. /*else*/ {
  25820. __pyx_t_8 = NULL;
  25821. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_curveLineIntersections); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1465, __pyx_L1_error)
  25822. __Pyx_GOTREF(__pyx_t_7);
  25823. __pyx_t_9 = 1;
  25824. #if CYTHON_UNPACK_METHODS
  25825. if (unlikely(PyMethod_Check(__pyx_t_7))) {
  25826. __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
  25827. assert(__pyx_t_8);
  25828. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_7);
  25829. __Pyx_INCREF(__pyx_t_8);
  25830. __Pyx_INCREF(__pyx__function);
  25831. __Pyx_DECREF_SET(__pyx_t_7, __pyx__function);
  25832. __pyx_t_9 = 0;
  25833. }
  25834. #endif
  25835. {
  25836. PyObject *__pyx_callargs[3] = {__pyx_t_8, __pyx_v_seg1, __pyx_v_seg2};
  25837. __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));
  25838. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  25839. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  25840. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1465, __pyx_L1_error)
  25841. __Pyx_GOTREF(__pyx_t_6);
  25842. }
  25843. __pyx_v_intersections = __pyx_t_6;
  25844. __pyx_t_6 = 0;
  25845. }
  25846. __pyx_L5:;
  25847. /* "fontTools/misc/bezierTools.py":1461
  25848. * seg2, seg1 = seg1, seg2
  25849. * swapped = True
  25850. * if len(seg1) > 2: # <<<<<<<<<<<<<<
  25851. * if len(seg2) > 2:
  25852. * intersections = curveCurveIntersections(seg1, seg2)
  25853. */
  25854. goto __pyx_L4;
  25855. }
  25856. /* "fontTools/misc/bezierTools.py":1466
  25857. * else:
  25858. * intersections = curveLineIntersections(seg1, seg2)
  25859. * elif len(seg1) == 2 and len(seg2) == 2: # <<<<<<<<<<<<<<
  25860. * intersections = lineLineIntersections(*seg1, *seg2)
  25861. * else:
  25862. */
  25863. __pyx_t_2 = PyObject_Length(__pyx_v_seg1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1466, __pyx_L1_error)
  25864. __pyx_t_10 = (__pyx_t_2 == 2);
  25865. if (__pyx_t_10) {
  25866. } else {
  25867. __pyx_t_3 = __pyx_t_10;
  25868. goto __pyx_L6_bool_binop_done;
  25869. }
  25870. __pyx_t_2 = PyObject_Length(__pyx_v_seg2); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1466, __pyx_L1_error)
  25871. __pyx_t_10 = (__pyx_t_2 == 2);
  25872. __pyx_t_3 = __pyx_t_10;
  25873. __pyx_L6_bool_binop_done:;
  25874. if (likely(__pyx_t_3)) {
  25875. /* "fontTools/misc/bezierTools.py":1467
  25876. * intersections = curveLineIntersections(seg1, seg2)
  25877. * elif len(seg1) == 2 and len(seg2) == 2:
  25878. * intersections = lineLineIntersections(*seg1, *seg2) # <<<<<<<<<<<<<<
  25879. * else:
  25880. * raise ValueError("Couldn't work out which intersection function to use")
  25881. */
  25882. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_lineLineIntersections); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1467, __pyx_L1_error)
  25883. __Pyx_GOTREF(__pyx_t_6);
  25884. __pyx_t_7 = __Pyx_PySequence_Tuple(__pyx_v_seg1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1467, __pyx_L1_error)
  25885. __Pyx_GOTREF(__pyx_t_7);
  25886. __pyx_t_8 = __Pyx_PySequence_Tuple(__pyx_v_seg2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1467, __pyx_L1_error)
  25887. __Pyx_GOTREF(__pyx_t_8);
  25888. __pyx_t_11 = PyNumber_Add(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1467, __pyx_L1_error)
  25889. __Pyx_GOTREF(__pyx_t_11);
  25890. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  25891. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  25892. __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)
  25893. __Pyx_GOTREF(__pyx_t_8);
  25894. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  25895. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  25896. __pyx_v_intersections = __pyx_t_8;
  25897. __pyx_t_8 = 0;
  25898. /* "fontTools/misc/bezierTools.py":1466
  25899. * else:
  25900. * intersections = curveLineIntersections(seg1, seg2)
  25901. * elif len(seg1) == 2 and len(seg2) == 2: # <<<<<<<<<<<<<<
  25902. * intersections = lineLineIntersections(*seg1, *seg2)
  25903. * else:
  25904. */
  25905. goto __pyx_L4;
  25906. }
  25907. /* "fontTools/misc/bezierTools.py":1469
  25908. * intersections = lineLineIntersections(*seg1, *seg2)
  25909. * else:
  25910. * raise ValueError("Couldn't work out which intersection function to use") # <<<<<<<<<<<<<<
  25911. * if not swapped:
  25912. * return intersections
  25913. */
  25914. /*else*/ {
  25915. __pyx_t_11 = NULL;
  25916. __pyx_t_9 = 1;
  25917. {
  25918. PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_mstate_global->__pyx_kp_u_Couldn_t_work_out_which_intersec};
  25919. __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));
  25920. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  25921. if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1469, __pyx_L1_error)
  25922. __Pyx_GOTREF(__pyx_t_8);
  25923. }
  25924. __Pyx_Raise(__pyx_t_8, 0, 0, 0);
  25925. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  25926. __PYX_ERR(0, 1469, __pyx_L1_error)
  25927. }
  25928. __pyx_L4:;
  25929. /* "fontTools/misc/bezierTools.py":1470
  25930. * else:
  25931. * raise ValueError("Couldn't work out which intersection function to use")
  25932. * if not swapped: # <<<<<<<<<<<<<<
  25933. * return intersections
  25934. * return [Intersection(pt=i.pt, t1=i.t2, t2=i.t1) for i in intersections]
  25935. */
  25936. __pyx_t_3 = (!__pyx_v_swapped);
  25937. if (__pyx_t_3) {
  25938. /* "fontTools/misc/bezierTools.py":1471
  25939. * raise ValueError("Couldn't work out which intersection function to use")
  25940. * if not swapped:
  25941. * return intersections # <<<<<<<<<<<<<<
  25942. * return [Intersection(pt=i.pt, t1=i.t2, t2=i.t1) for i in intersections]
  25943. *
  25944. */
  25945. __Pyx_XDECREF(__pyx_r);
  25946. __Pyx_INCREF(__pyx_v_intersections);
  25947. __pyx_r = __pyx_v_intersections;
  25948. goto __pyx_L0;
  25949. /* "fontTools/misc/bezierTools.py":1470
  25950. * else:
  25951. * raise ValueError("Couldn't work out which intersection function to use")
  25952. * if not swapped: # <<<<<<<<<<<<<<
  25953. * return intersections
  25954. * return [Intersection(pt=i.pt, t1=i.t2, t2=i.t1) for i in intersections]
  25955. */
  25956. }
  25957. /* "fontTools/misc/bezierTools.py":1472
  25958. * if not swapped:
  25959. * return intersections
  25960. * return [Intersection(pt=i.pt, t1=i.t2, t2=i.t1) for i in intersections] # <<<<<<<<<<<<<<
  25961. *
  25962. *
  25963. */
  25964. __Pyx_XDECREF(__pyx_r);
  25965. { /* enter inner scope */
  25966. __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1472, __pyx_L11_error)
  25967. __Pyx_GOTREF(__pyx_t_8);
  25968. if (likely(PyList_CheckExact(__pyx_v_intersections)) || PyTuple_CheckExact(__pyx_v_intersections)) {
  25969. __pyx_t_11 = __pyx_v_intersections; __Pyx_INCREF(__pyx_t_11);
  25970. __pyx_t_2 = 0;
  25971. __pyx_t_12 = NULL;
  25972. } else {
  25973. __pyx_t_2 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_v_intersections); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1472, __pyx_L11_error)
  25974. __Pyx_GOTREF(__pyx_t_11);
  25975. __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)
  25976. }
  25977. for (;;) {
  25978. if (likely(!__pyx_t_12)) {
  25979. if (likely(PyList_CheckExact(__pyx_t_11))) {
  25980. {
  25981. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_11);
  25982. #if !CYTHON_ASSUME_SAFE_SIZE
  25983. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1472, __pyx_L11_error)
  25984. #endif
  25985. if (__pyx_t_2 >= __pyx_temp) break;
  25986. }
  25987. __pyx_t_6 = __Pyx_PyList_GetItemRefFast(__pyx_t_11, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
  25988. ++__pyx_t_2;
  25989. } else {
  25990. {
  25991. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_11);
  25992. #if !CYTHON_ASSUME_SAFE_SIZE
  25993. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1472, __pyx_L11_error)
  25994. #endif
  25995. if (__pyx_t_2 >= __pyx_temp) break;
  25996. }
  25997. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  25998. __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_2));
  25999. #else
  26000. __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_11, __pyx_t_2);
  26001. #endif
  26002. ++__pyx_t_2;
  26003. }
  26004. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1472, __pyx_L11_error)
  26005. } else {
  26006. __pyx_t_6 = __pyx_t_12(__pyx_t_11);
  26007. if (unlikely(!__pyx_t_6)) {
  26008. PyObject* exc_type = PyErr_Occurred();
  26009. if (exc_type) {
  26010. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1472, __pyx_L11_error)
  26011. PyErr_Clear();
  26012. }
  26013. break;
  26014. }
  26015. }
  26016. __Pyx_GOTREF(__pyx_t_6);
  26017. __Pyx_XDECREF_SET(__pyx_9genexpr10__pyx_v_i, __pyx_t_6);
  26018. __pyx_t_6 = 0;
  26019. __pyx_t_7 = NULL;
  26020. __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_mstate_global->__pyx_n_u_Intersection); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1472, __pyx_L11_error)
  26021. __Pyx_GOTREF(__pyx_t_13);
  26022. __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)
  26023. __Pyx_GOTREF(__pyx_t_14);
  26024. __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)
  26025. __Pyx_GOTREF(__pyx_t_15);
  26026. __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)
  26027. __Pyx_GOTREF(__pyx_t_16);
  26028. __pyx_t_9 = 1;
  26029. #if CYTHON_UNPACK_METHODS
  26030. if (unlikely(PyMethod_Check(__pyx_t_13))) {
  26031. __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_13);
  26032. assert(__pyx_t_7);
  26033. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_13);
  26034. __Pyx_INCREF(__pyx_t_7);
  26035. __Pyx_INCREF(__pyx__function);
  26036. __Pyx_DECREF_SET(__pyx_t_13, __pyx__function);
  26037. __pyx_t_9 = 0;
  26038. }
  26039. #endif
  26040. {
  26041. PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_7, NULL};
  26042. __pyx_t_17 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1472, __pyx_L11_error)
  26043. __Pyx_GOTREF(__pyx_t_17);
  26044. 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)
  26045. 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)
  26046. 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)
  26047. __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);
  26048. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  26049. __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  26050. __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  26051. __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  26052. __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  26053. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  26054. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1472, __pyx_L11_error)
  26055. __Pyx_GOTREF(__pyx_t_6);
  26056. }
  26057. if (unlikely(__Pyx_ListComp_Append(__pyx_t_8, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 1472, __pyx_L11_error)
  26058. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  26059. }
  26060. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  26061. __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_i); __pyx_9genexpr10__pyx_v_i = 0;
  26062. goto __pyx_L15_exit_scope;
  26063. __pyx_L11_error:;
  26064. __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_i); __pyx_9genexpr10__pyx_v_i = 0;
  26065. goto __pyx_L1_error;
  26066. __pyx_L15_exit_scope:;
  26067. } /* exit inner scope */
  26068. __pyx_r = __pyx_t_8;
  26069. __pyx_t_8 = 0;
  26070. goto __pyx_L0;
  26071. /* "fontTools/misc/bezierTools.py":1427
  26072. *
  26073. *
  26074. * def segmentSegmentIntersections(seg1, seg2): # <<<<<<<<<<<<<<
  26075. * """Finds intersections between two segments.
  26076. *
  26077. */
  26078. /* function exit code */
  26079. __pyx_L1_error:;
  26080. __Pyx_XDECREF(__pyx_t_6);
  26081. __Pyx_XDECREF(__pyx_t_7);
  26082. __Pyx_XDECREF(__pyx_t_8);
  26083. __Pyx_XDECREF(__pyx_t_11);
  26084. __Pyx_XDECREF(__pyx_t_13);
  26085. __Pyx_XDECREF(__pyx_t_14);
  26086. __Pyx_XDECREF(__pyx_t_15);
  26087. __Pyx_XDECREF(__pyx_t_16);
  26088. __Pyx_XDECREF(__pyx_t_17);
  26089. __Pyx_AddTraceback("fontTools.misc.bezierTools.segmentSegmentIntersections", __pyx_clineno, __pyx_lineno, __pyx_filename);
  26090. __pyx_r = NULL;
  26091. __pyx_L0:;
  26092. __Pyx_XDECREF(__pyx_v_intersections);
  26093. __Pyx_XDECREF(__pyx_9genexpr10__pyx_v_i);
  26094. __Pyx_XDECREF(__pyx_v_seg1);
  26095. __Pyx_XDECREF(__pyx_v_seg2);
  26096. __Pyx_XGIVEREF(__pyx_r);
  26097. __Pyx_RefNannyFinishContext();
  26098. return __pyx_r;
  26099. }
  26100. /* "fontTools/misc/bezierTools.py":1475
  26101. *
  26102. *
  26103. * def _segmentrepr(obj): # <<<<<<<<<<<<<<
  26104. * """
  26105. * >>> _segmentrepr([1, [2, 3], [], [[2, [3, 4], [0.1, 2.2]]]])
  26106. */
  26107. /* Python wrapper */
  26108. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_93_segmentrepr(PyObject *__pyx_self,
  26109. #if CYTHON_METH_FASTCALL
  26110. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  26111. #else
  26112. PyObject *__pyx_args, PyObject *__pyx_kwds
  26113. #endif
  26114. ); /*proto*/
  26115. 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))))'");
  26116. 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};
  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. ) {
  26124. PyObject *__pyx_v_obj = 0;
  26125. #if !CYTHON_METH_FASTCALL
  26126. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  26127. #endif
  26128. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  26129. PyObject* values[1] = {0};
  26130. int __pyx_lineno = 0;
  26131. const char *__pyx_filename = NULL;
  26132. int __pyx_clineno = 0;
  26133. PyObject *__pyx_r = 0;
  26134. __Pyx_RefNannyDeclarations
  26135. __Pyx_RefNannySetupContext("_segmentrepr (wrapper)", 0);
  26136. #if !CYTHON_METH_FASTCALL
  26137. #if CYTHON_ASSUME_SAFE_SIZE
  26138. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  26139. #else
  26140. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  26141. #endif
  26142. #endif
  26143. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  26144. {
  26145. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_obj,0};
  26146. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  26147. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1475, __pyx_L3_error)
  26148. if (__pyx_kwds_len > 0) {
  26149. switch (__pyx_nargs) {
  26150. case 1:
  26151. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  26152. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1475, __pyx_L3_error)
  26153. CYTHON_FALLTHROUGH;
  26154. case 0: break;
  26155. default: goto __pyx_L5_argtuple_error;
  26156. }
  26157. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  26158. 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)
  26159. for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
  26160. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("_segmentrepr", 1, 1, 1, i); __PYX_ERR(0, 1475, __pyx_L3_error) }
  26161. }
  26162. } else if (unlikely(__pyx_nargs != 1)) {
  26163. goto __pyx_L5_argtuple_error;
  26164. } else {
  26165. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  26166. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1475, __pyx_L3_error)
  26167. }
  26168. __pyx_v_obj = values[0];
  26169. }
  26170. goto __pyx_L6_skip;
  26171. __pyx_L5_argtuple_error:;
  26172. __Pyx_RaiseArgtupleInvalid("_segmentrepr", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1475, __pyx_L3_error)
  26173. __pyx_L6_skip:;
  26174. goto __pyx_L4_argument_unpacking_done;
  26175. __pyx_L3_error:;
  26176. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  26177. Py_XDECREF(values[__pyx_temp]);
  26178. }
  26179. __Pyx_AddTraceback("fontTools.misc.bezierTools._segmentrepr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  26180. __Pyx_RefNannyFinishContext();
  26181. return NULL;
  26182. __pyx_L4_argument_unpacking_done:;
  26183. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_92_segmentrepr(__pyx_self, __pyx_v_obj);
  26184. /* function exit code */
  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_RefNannyFinishContext();
  26189. return __pyx_r;
  26190. }
  26191. static PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_12_segmentrepr_2generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
  26192. /* "fontTools/misc/bezierTools.py":1485
  26193. * return "%g" % obj
  26194. * else:
  26195. * return "(%s)" % ", ".join(_segmentrepr(x) for x in it) # <<<<<<<<<<<<<<
  26196. *
  26197. *
  26198. */
  26199. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_12_segmentrepr_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  26200. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr *__pyx_cur_scope;
  26201. PyObject *__pyx_r = NULL;
  26202. __Pyx_RefNannyDeclarations
  26203. int __pyx_lineno = 0;
  26204. const char *__pyx_filename = NULL;
  26205. int __pyx_clineno = 0;
  26206. __Pyx_RefNannySetupContext("genexpr", 0);
  26207. __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);
  26208. if (unlikely(!__pyx_cur_scope)) {
  26209. __pyx_cur_scope = ((struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr *)Py_None);
  26210. __Pyx_INCREF(Py_None);
  26211. __PYX_ERR(0, 1485, __pyx_L1_error)
  26212. } else {
  26213. __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  26214. }
  26215. __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  26216. __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  26217. __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  26218. {
  26219. __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)
  26220. __Pyx_DECREF(__pyx_cur_scope);
  26221. __Pyx_RefNannyFinishContext();
  26222. return (PyObject *) gen;
  26223. }
  26224. /* function exit code */
  26225. __pyx_L1_error:;
  26226. __Pyx_AddTraceback("fontTools.misc.bezierTools._segmentrepr.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  26227. __pyx_r = NULL;
  26228. __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  26229. __Pyx_XGIVEREF(__pyx_r);
  26230. __Pyx_RefNannyFinishContext();
  26231. return __pyx_r;
  26232. }
  26233. 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 */
  26234. {
  26235. 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);
  26236. PyObject *__pyx_r = NULL;
  26237. PyObject *__pyx_t_1 = NULL;
  26238. Py_ssize_t __pyx_t_2;
  26239. PyObject *(*__pyx_t_3)(PyObject *);
  26240. PyObject *__pyx_t_4 = NULL;
  26241. PyObject *__pyx_t_5 = NULL;
  26242. PyObject *__pyx_t_6 = NULL;
  26243. size_t __pyx_t_7;
  26244. int __pyx_lineno = 0;
  26245. const char *__pyx_filename = NULL;
  26246. int __pyx_clineno = 0;
  26247. __Pyx_RefNannyDeclarations
  26248. __Pyx_RefNannySetupContext("genexpr", 0);
  26249. switch (__pyx_generator->resume_label) {
  26250. case 0: goto __pyx_L3_first_run;
  26251. default: /* CPython raises the right error here */
  26252. __Pyx_RefNannyFinishContext();
  26253. return NULL;
  26254. }
  26255. __pyx_L3_first_run:;
  26256. if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1485, __pyx_L1_error)
  26257. __pyx_r = PyList_New(0); if (unlikely(!__pyx_r)) __PYX_ERR(0, 1485, __pyx_L1_error)
  26258. __Pyx_GOTREF(__pyx_r);
  26259. if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 1485, __pyx_L1_error) }
  26260. if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
  26261. __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __Pyx_INCREF(__pyx_t_1);
  26262. __pyx_t_2 = 0;
  26263. __pyx_t_3 = NULL;
  26264. } else {
  26265. __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)
  26266. __Pyx_GOTREF(__pyx_t_1);
  26267. __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)
  26268. }
  26269. for (;;) {
  26270. if (likely(!__pyx_t_3)) {
  26271. if (likely(PyList_CheckExact(__pyx_t_1))) {
  26272. {
  26273. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  26274. #if !CYTHON_ASSUME_SAFE_SIZE
  26275. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1485, __pyx_L1_error)
  26276. #endif
  26277. if (__pyx_t_2 >= __pyx_temp) break;
  26278. }
  26279. __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
  26280. ++__pyx_t_2;
  26281. } else {
  26282. {
  26283. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  26284. #if !CYTHON_ASSUME_SAFE_SIZE
  26285. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1485, __pyx_L1_error)
  26286. #endif
  26287. if (__pyx_t_2 >= __pyx_temp) break;
  26288. }
  26289. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  26290. __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
  26291. #else
  26292. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
  26293. #endif
  26294. ++__pyx_t_2;
  26295. }
  26296. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1485, __pyx_L1_error)
  26297. } else {
  26298. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  26299. if (unlikely(!__pyx_t_4)) {
  26300. PyObject* exc_type = PyErr_Occurred();
  26301. if (exc_type) {
  26302. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1485, __pyx_L1_error)
  26303. PyErr_Clear();
  26304. }
  26305. break;
  26306. }
  26307. }
  26308. __Pyx_GOTREF(__pyx_t_4);
  26309. __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_x);
  26310. __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_x, __pyx_t_4);
  26311. __Pyx_GIVEREF(__pyx_t_4);
  26312. __pyx_t_4 = 0;
  26313. __pyx_t_5 = NULL;
  26314. __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_segmentrepr); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1485, __pyx_L1_error)
  26315. __Pyx_GOTREF(__pyx_t_6);
  26316. __pyx_t_7 = 1;
  26317. #if CYTHON_UNPACK_METHODS
  26318. if (unlikely(PyMethod_Check(__pyx_t_6))) {
  26319. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
  26320. assert(__pyx_t_5);
  26321. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_6);
  26322. __Pyx_INCREF(__pyx_t_5);
  26323. __Pyx_INCREF(__pyx__function);
  26324. __Pyx_DECREF_SET(__pyx_t_6, __pyx__function);
  26325. __pyx_t_7 = 0;
  26326. }
  26327. #endif
  26328. {
  26329. PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_x};
  26330. __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));
  26331. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  26332. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  26333. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1485, __pyx_L1_error)
  26334. __Pyx_GOTREF(__pyx_t_4);
  26335. }
  26336. if (unlikely(__Pyx_ListComp_Append(__pyx_r, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 1485, __pyx_L1_error)
  26337. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  26338. }
  26339. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  26340. CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  26341. /* function exit code */
  26342. goto __pyx_L0;
  26343. __pyx_L1_error:;
  26344. __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  26345. __Pyx_XDECREF(__pyx_t_1);
  26346. __Pyx_XDECREF(__pyx_t_4);
  26347. __Pyx_XDECREF(__pyx_t_5);
  26348. __Pyx_XDECREF(__pyx_t_6);
  26349. if (__Pyx_PyErr_Occurred()) {
  26350. __Pyx_Generator_Replace_StopIteration(0);
  26351. __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  26352. }
  26353. __pyx_L0:;
  26354. __Pyx_XGIVEREF(__pyx_r);
  26355. #if !CYTHON_USE_EXC_INFO_STACK
  26356. __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  26357. #endif
  26358. __pyx_generator->resume_label = -1;
  26359. __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  26360. __Pyx_RefNannyFinishContext();
  26361. return __pyx_r;
  26362. }
  26363. /* "fontTools/misc/bezierTools.py":1475
  26364. *
  26365. *
  26366. * def _segmentrepr(obj): # <<<<<<<<<<<<<<
  26367. * """
  26368. * >>> _segmentrepr([1, [2, 3], [], [[2, [3, 4], [0.1, 2.2]]]])
  26369. */
  26370. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_92_segmentrepr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj) {
  26371. PyObject *__pyx_v_it = NULL;
  26372. PyObject *__pyx_gb_9fontTools_4misc_11bezierTools_12_segmentrepr_2generator6 = 0;
  26373. PyObject *__pyx_r = NULL;
  26374. __Pyx_RefNannyDeclarations
  26375. PyObject *__pyx_t_1 = NULL;
  26376. PyObject *__pyx_t_2 = NULL;
  26377. PyObject *__pyx_t_3 = NULL;
  26378. PyObject *__pyx_t_4 = NULL;
  26379. PyObject *__pyx_t_5 = NULL;
  26380. int __pyx_t_6;
  26381. PyObject *__pyx_t_7 = NULL;
  26382. PyObject *__pyx_t_8 = NULL;
  26383. int __pyx_lineno = 0;
  26384. const char *__pyx_filename = NULL;
  26385. int __pyx_clineno = 0;
  26386. __Pyx_RefNannySetupContext("_segmentrepr", 0);
  26387. /* "fontTools/misc/bezierTools.py":1480
  26388. * '(1, (2, 3), (), ((2, (3, 4), (0.1, 2.2))))'
  26389. * """
  26390. * try: # <<<<<<<<<<<<<<
  26391. * it = iter(obj)
  26392. * except TypeError:
  26393. */
  26394. {
  26395. __Pyx_PyThreadState_declare
  26396. __Pyx_PyThreadState_assign
  26397. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  26398. __Pyx_XGOTREF(__pyx_t_1);
  26399. __Pyx_XGOTREF(__pyx_t_2);
  26400. __Pyx_XGOTREF(__pyx_t_3);
  26401. /*try:*/ {
  26402. /* "fontTools/misc/bezierTools.py":1481
  26403. * """
  26404. * try:
  26405. * it = iter(obj) # <<<<<<<<<<<<<<
  26406. * except TypeError:
  26407. * return "%g" % obj
  26408. */
  26409. __pyx_t_4 = PyObject_GetIter(__pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1481, __pyx_L3_error)
  26410. __Pyx_GOTREF(__pyx_t_4);
  26411. __pyx_v_it = __pyx_t_4;
  26412. __pyx_t_4 = 0;
  26413. /* "fontTools/misc/bezierTools.py":1480
  26414. * '(1, (2, 3), (), ((2, (3, 4), (0.1, 2.2))))'
  26415. * """
  26416. * try: # <<<<<<<<<<<<<<
  26417. * it = iter(obj)
  26418. * except TypeError:
  26419. */
  26420. }
  26421. /* "fontTools/misc/bezierTools.py":1485
  26422. * return "%g" % obj
  26423. * else:
  26424. * return "(%s)" % ", ".join(_segmentrepr(x) for x in it) # <<<<<<<<<<<<<<
  26425. *
  26426. *
  26427. */
  26428. /*else:*/ {
  26429. __Pyx_XDECREF(__pyx_r);
  26430. __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)
  26431. __Pyx_GOTREF(__pyx_t_4);
  26432. __pyx_t_5 = __Pyx_Generator_GetInlinedResult(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1485, __pyx_L5_except_error)
  26433. __Pyx_GOTREF(__pyx_t_5);
  26434. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  26435. __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)
  26436. __Pyx_GOTREF(__pyx_t_4);
  26437. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  26438. __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)
  26439. __Pyx_GOTREF(__pyx_t_5);
  26440. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  26441. __pyx_r = __pyx_t_5;
  26442. __pyx_t_5 = 0;
  26443. goto __pyx_L6_except_return;
  26444. }
  26445. __pyx_L3_error:;
  26446. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  26447. /* "fontTools/misc/bezierTools.py":1482
  26448. * try:
  26449. * it = iter(obj)
  26450. * except TypeError: # <<<<<<<<<<<<<<
  26451. * return "%g" % obj
  26452. * else:
  26453. */
  26454. __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(((PyTypeObject*)PyExc_TypeError))));
  26455. if (__pyx_t_6) {
  26456. __Pyx_AddTraceback("fontTools.misc.bezierTools._segmentrepr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  26457. if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(0, 1482, __pyx_L5_except_error)
  26458. __Pyx_XGOTREF(__pyx_t_5);
  26459. __Pyx_XGOTREF(__pyx_t_4);
  26460. __Pyx_XGOTREF(__pyx_t_7);
  26461. /* "fontTools/misc/bezierTools.py":1483
  26462. * it = iter(obj)
  26463. * except TypeError:
  26464. * return "%g" % obj # <<<<<<<<<<<<<<
  26465. * else:
  26466. * return "(%s)" % ", ".join(_segmentrepr(x) for x in it)
  26467. */
  26468. __Pyx_XDECREF(__pyx_r);
  26469. __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)
  26470. __Pyx_GOTREF(__pyx_t_8);
  26471. __pyx_r = __pyx_t_8;
  26472. __pyx_t_8 = 0;
  26473. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  26474. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  26475. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  26476. goto __pyx_L6_except_return;
  26477. }
  26478. goto __pyx_L5_except_error;
  26479. /* "fontTools/misc/bezierTools.py":1480
  26480. * '(1, (2, 3), (), ((2, (3, 4), (0.1, 2.2))))'
  26481. * """
  26482. * try: # <<<<<<<<<<<<<<
  26483. * it = iter(obj)
  26484. * except TypeError:
  26485. */
  26486. __pyx_L5_except_error:;
  26487. __Pyx_XGIVEREF(__pyx_t_1);
  26488. __Pyx_XGIVEREF(__pyx_t_2);
  26489. __Pyx_XGIVEREF(__pyx_t_3);
  26490. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  26491. goto __pyx_L1_error;
  26492. __pyx_L6_except_return:;
  26493. __Pyx_XGIVEREF(__pyx_t_1);
  26494. __Pyx_XGIVEREF(__pyx_t_2);
  26495. __Pyx_XGIVEREF(__pyx_t_3);
  26496. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  26497. goto __pyx_L0;
  26498. }
  26499. /* "fontTools/misc/bezierTools.py":1475
  26500. *
  26501. *
  26502. * def _segmentrepr(obj): # <<<<<<<<<<<<<<
  26503. * """
  26504. * >>> _segmentrepr([1, [2, 3], [], [[2, [3, 4], [0.1, 2.2]]]])
  26505. */
  26506. /* function exit code */
  26507. __pyx_L1_error:;
  26508. __Pyx_XDECREF(__pyx_t_4);
  26509. __Pyx_XDECREF(__pyx_t_5);
  26510. __Pyx_XDECREF(__pyx_t_7);
  26511. __Pyx_XDECREF(__pyx_t_8);
  26512. __Pyx_AddTraceback("fontTools.misc.bezierTools._segmentrepr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  26513. __pyx_r = NULL;
  26514. __pyx_L0:;
  26515. __Pyx_XDECREF(__pyx_v_it);
  26516. __Pyx_XDECREF(__pyx_gb_9fontTools_4misc_11bezierTools_12_segmentrepr_2generator6);
  26517. __Pyx_XGIVEREF(__pyx_r);
  26518. __Pyx_RefNannyFinishContext();
  26519. return __pyx_r;
  26520. }
  26521. /* "fontTools/misc/bezierTools.py":1488
  26522. *
  26523. *
  26524. * def printSegments(segments): # <<<<<<<<<<<<<<
  26525. * """Helper for the doctests, displaying each segment in a list of
  26526. * segments on a single line as a tuple.
  26527. */
  26528. /* Python wrapper */
  26529. static PyObject *__pyx_pw_9fontTools_4misc_11bezierTools_95printSegments(PyObject *__pyx_self,
  26530. #if CYTHON_METH_FASTCALL
  26531. PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
  26532. #else
  26533. PyObject *__pyx_args, PyObject *__pyx_kwds
  26534. #endif
  26535. ); /*proto*/
  26536. 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.");
  26537. 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};
  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. ) {
  26545. PyObject *__pyx_v_segments = 0;
  26546. #if !CYTHON_METH_FASTCALL
  26547. CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  26548. #endif
  26549. CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  26550. PyObject* values[1] = {0};
  26551. int __pyx_lineno = 0;
  26552. const char *__pyx_filename = NULL;
  26553. int __pyx_clineno = 0;
  26554. PyObject *__pyx_r = 0;
  26555. __Pyx_RefNannyDeclarations
  26556. __Pyx_RefNannySetupContext("printSegments (wrapper)", 0);
  26557. #if !CYTHON_METH_FASTCALL
  26558. #if CYTHON_ASSUME_SAFE_SIZE
  26559. __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
  26560. #else
  26561. __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
  26562. #endif
  26563. #endif
  26564. __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
  26565. {
  26566. PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_segments,0};
  26567. const Py_ssize_t __pyx_kwds_len = (__pyx_kwds) ? __Pyx_NumKwargs_FASTCALL(__pyx_kwds) : 0;
  26568. if (unlikely(__pyx_kwds_len) < 0) __PYX_ERR(0, 1488, __pyx_L3_error)
  26569. if (__pyx_kwds_len > 0) {
  26570. switch (__pyx_nargs) {
  26571. case 1:
  26572. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  26573. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1488, __pyx_L3_error)
  26574. CYTHON_FALLTHROUGH;
  26575. case 0: break;
  26576. default: goto __pyx_L5_argtuple_error;
  26577. }
  26578. const Py_ssize_t kwd_pos_args = __pyx_nargs;
  26579. 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)
  26580. for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
  26581. if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("printSegments", 1, 1, 1, i); __PYX_ERR(0, 1488, __pyx_L3_error) }
  26582. }
  26583. } else if (unlikely(__pyx_nargs != 1)) {
  26584. goto __pyx_L5_argtuple_error;
  26585. } else {
  26586. values[0] = __Pyx_ArgRef_FASTCALL(__pyx_args, 0);
  26587. if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[0])) __PYX_ERR(0, 1488, __pyx_L3_error)
  26588. }
  26589. __pyx_v_segments = values[0];
  26590. }
  26591. goto __pyx_L6_skip;
  26592. __pyx_L5_argtuple_error:;
  26593. __Pyx_RaiseArgtupleInvalid("printSegments", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1488, __pyx_L3_error)
  26594. __pyx_L6_skip:;
  26595. goto __pyx_L4_argument_unpacking_done;
  26596. __pyx_L3_error:;
  26597. for (Py_ssize_t __pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
  26598. Py_XDECREF(values[__pyx_temp]);
  26599. }
  26600. __Pyx_AddTraceback("fontTools.misc.bezierTools.printSegments", __pyx_clineno, __pyx_lineno, __pyx_filename);
  26601. __Pyx_RefNannyFinishContext();
  26602. return NULL;
  26603. __pyx_L4_argument_unpacking_done:;
  26604. __pyx_r = __pyx_pf_9fontTools_4misc_11bezierTools_94printSegments(__pyx_self, __pyx_v_segments);
  26605. /* function exit code */
  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_RefNannyFinishContext();
  26610. return __pyx_r;
  26611. }
  26612. static PyObject *__pyx_pf_9fontTools_4misc_11bezierTools_94printSegments(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_segments) {
  26613. PyObject *__pyx_v_segment = NULL;
  26614. PyObject *__pyx_r = NULL;
  26615. __Pyx_RefNannyDeclarations
  26616. PyObject *__pyx_t_1 = NULL;
  26617. Py_ssize_t __pyx_t_2;
  26618. PyObject *(*__pyx_t_3)(PyObject *);
  26619. PyObject *__pyx_t_4 = NULL;
  26620. PyObject *__pyx_t_5 = NULL;
  26621. PyObject *__pyx_t_6 = NULL;
  26622. PyObject *__pyx_t_7 = NULL;
  26623. PyObject *__pyx_t_8 = NULL;
  26624. size_t __pyx_t_9;
  26625. int __pyx_lineno = 0;
  26626. const char *__pyx_filename = NULL;
  26627. int __pyx_clineno = 0;
  26628. __Pyx_RefNannySetupContext("printSegments", 0);
  26629. /* "fontTools/misc/bezierTools.py":1492
  26630. * segments on a single line as a tuple.
  26631. * """
  26632. * for segment in segments: # <<<<<<<<<<<<<<
  26633. * print(_segmentrepr(segment))
  26634. *
  26635. */
  26636. if (likely(PyList_CheckExact(__pyx_v_segments)) || PyTuple_CheckExact(__pyx_v_segments)) {
  26637. __pyx_t_1 = __pyx_v_segments; __Pyx_INCREF(__pyx_t_1);
  26638. __pyx_t_2 = 0;
  26639. __pyx_t_3 = NULL;
  26640. } else {
  26641. __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_segments); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1492, __pyx_L1_error)
  26642. __Pyx_GOTREF(__pyx_t_1);
  26643. __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)
  26644. }
  26645. for (;;) {
  26646. if (likely(!__pyx_t_3)) {
  26647. if (likely(PyList_CheckExact(__pyx_t_1))) {
  26648. {
  26649. Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
  26650. #if !CYTHON_ASSUME_SAFE_SIZE
  26651. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1492, __pyx_L1_error)
  26652. #endif
  26653. if (__pyx_t_2 >= __pyx_temp) break;
  26654. }
  26655. __pyx_t_4 = __Pyx_PyList_GetItemRefFast(__pyx_t_1, __pyx_t_2, __Pyx_ReferenceSharing_OwnStrongReference);
  26656. ++__pyx_t_2;
  26657. } else {
  26658. {
  26659. Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
  26660. #if !CYTHON_ASSUME_SAFE_SIZE
  26661. if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 1492, __pyx_L1_error)
  26662. #endif
  26663. if (__pyx_t_2 >= __pyx_temp) break;
  26664. }
  26665. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  26666. __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2));
  26667. #else
  26668. __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
  26669. #endif
  26670. ++__pyx_t_2;
  26671. }
  26672. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1492, __pyx_L1_error)
  26673. } else {
  26674. __pyx_t_4 = __pyx_t_3(__pyx_t_1);
  26675. if (unlikely(!__pyx_t_4)) {
  26676. PyObject* exc_type = PyErr_Occurred();
  26677. if (exc_type) {
  26678. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 1492, __pyx_L1_error)
  26679. PyErr_Clear();
  26680. }
  26681. break;
  26682. }
  26683. }
  26684. __Pyx_GOTREF(__pyx_t_4);
  26685. __Pyx_XDECREF_SET(__pyx_v_segment, __pyx_t_4);
  26686. __pyx_t_4 = 0;
  26687. /* "fontTools/misc/bezierTools.py":1493
  26688. * """
  26689. * for segment in segments:
  26690. * print(_segmentrepr(segment)) # <<<<<<<<<<<<<<
  26691. *
  26692. *
  26693. */
  26694. __pyx_t_5 = NULL;
  26695. __pyx_t_7 = NULL;
  26696. __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_segmentrepr); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1493, __pyx_L1_error)
  26697. __Pyx_GOTREF(__pyx_t_8);
  26698. __pyx_t_9 = 1;
  26699. #if CYTHON_UNPACK_METHODS
  26700. if (unlikely(PyMethod_Check(__pyx_t_8))) {
  26701. __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
  26702. assert(__pyx_t_7);
  26703. PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_8);
  26704. __Pyx_INCREF(__pyx_t_7);
  26705. __Pyx_INCREF(__pyx__function);
  26706. __Pyx_DECREF_SET(__pyx_t_8, __pyx__function);
  26707. __pyx_t_9 = 0;
  26708. }
  26709. #endif
  26710. {
  26711. PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_segment};
  26712. __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));
  26713. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  26714. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  26715. if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1493, __pyx_L1_error)
  26716. __Pyx_GOTREF(__pyx_t_6);
  26717. }
  26718. __pyx_t_9 = 1;
  26719. {
  26720. PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_6};
  26721. __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));
  26722. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  26723. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  26724. if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1493, __pyx_L1_error)
  26725. __Pyx_GOTREF(__pyx_t_4);
  26726. }
  26727. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  26728. /* "fontTools/misc/bezierTools.py":1492
  26729. * segments on a single line as a tuple.
  26730. * """
  26731. * for segment in segments: # <<<<<<<<<<<<<<
  26732. * print(_segmentrepr(segment))
  26733. *
  26734. */
  26735. }
  26736. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  26737. /* "fontTools/misc/bezierTools.py":1488
  26738. *
  26739. *
  26740. * def printSegments(segments): # <<<<<<<<<<<<<<
  26741. * """Helper for the doctests, displaying each segment in a list of
  26742. * segments on a single line as a tuple.
  26743. */
  26744. /* function exit code */
  26745. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  26746. goto __pyx_L0;
  26747. __pyx_L1_error:;
  26748. __Pyx_XDECREF(__pyx_t_1);
  26749. __Pyx_XDECREF(__pyx_t_4);
  26750. __Pyx_XDECREF(__pyx_t_5);
  26751. __Pyx_XDECREF(__pyx_t_6);
  26752. __Pyx_XDECREF(__pyx_t_7);
  26753. __Pyx_XDECREF(__pyx_t_8);
  26754. __Pyx_AddTraceback("fontTools.misc.bezierTools.printSegments", __pyx_clineno, __pyx_lineno, __pyx_filename);
  26755. __pyx_r = NULL;
  26756. __pyx_L0:;
  26757. __Pyx_XDECREF(__pyx_v_segment);
  26758. __Pyx_XGIVEREF(__pyx_r);
  26759. __Pyx_RefNannyFinishContext();
  26760. return __pyx_r;
  26761. }
  26762. /* #### Code section: module_exttypes ### */
  26763. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_defaults(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  26764. PyObject *o;
  26765. o = __Pyx_AllocateExtensionType(t, 1);
  26766. if (unlikely(!o)) return 0;
  26767. return o;
  26768. }
  26769. static void __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_defaults(PyObject *o) {
  26770. struct __pyx_defaults *p = (struct __pyx_defaults *)o;
  26771. #if CYTHON_USE_TP_FINALIZE
  26772. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  26773. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_defaults) {
  26774. if (PyObject_CallFinalizerFromDealloc(o)) return;
  26775. }
  26776. }
  26777. #endif
  26778. PyObject_GC_UnTrack(o);
  26779. Py_CLEAR(p->arg0);
  26780. PyTypeObject *tp = Py_TYPE(o);
  26781. #if CYTHON_USE_TYPE_SLOTS
  26782. (*tp->tp_free)(o);
  26783. #else
  26784. {
  26785. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  26786. if (tp_free) tp_free(o);
  26787. }
  26788. #endif
  26789. #if CYTHON_USE_TYPE_SPECS
  26790. Py_DECREF(tp);
  26791. #endif
  26792. }
  26793. static int __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_defaults(PyObject *o, visitproc v, void *a) {
  26794. int e;
  26795. struct __pyx_defaults *p = (struct __pyx_defaults *)o;
  26796. {
  26797. e = __Pyx_call_type_traverse(o, 1, v, a);
  26798. if (e) return e;
  26799. }
  26800. if (p->arg0) {
  26801. e = (*v)(p->arg0, a); if (e) return e;
  26802. }
  26803. return 0;
  26804. }
  26805. static int __pyx_tp_clear_9fontTools_4misc_11bezierTools___pyx_defaults(PyObject *o) {
  26806. PyObject* tmp;
  26807. struct __pyx_defaults *p = (struct __pyx_defaults *)o;
  26808. tmp = ((PyObject*)p->arg0);
  26809. p->arg0 = Py_None; Py_INCREF(Py_None);
  26810. Py_XDECREF(tmp);
  26811. return 0;
  26812. }
  26813. #if CYTHON_USE_TYPE_SPECS
  26814. static PyType_Slot __pyx_type_9fontTools_4misc_11bezierTools___pyx_defaults_slots[] = {
  26815. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_defaults},
  26816. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_defaults},
  26817. {Py_tp_clear, (void *)__pyx_tp_clear_9fontTools_4misc_11bezierTools___pyx_defaults},
  26818. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_defaults},
  26819. {0, 0},
  26820. };
  26821. static PyType_Spec __pyx_type_9fontTools_4misc_11bezierTools___pyx_defaults_spec = {
  26822. "fontTools.misc.bezierTools.__pyx_defaults",
  26823. sizeof(struct __pyx_defaults),
  26824. 0,
  26825. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  26826. __pyx_type_9fontTools_4misc_11bezierTools___pyx_defaults_slots,
  26827. };
  26828. #else
  26829. static PyTypeObject __pyx_type_9fontTools_4misc_11bezierTools___pyx_defaults = {
  26830. PyVarObject_HEAD_INIT(0, 0)
  26831. "fontTools.misc.bezierTools.""__pyx_defaults", /*tp_name*/
  26832. sizeof(struct __pyx_defaults), /*tp_basicsize*/
  26833. 0, /*tp_itemsize*/
  26834. __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_defaults, /*tp_dealloc*/
  26835. 0, /*tp_vectorcall_offset*/
  26836. 0, /*tp_getattr*/
  26837. 0, /*tp_setattr*/
  26838. 0, /*tp_as_async*/
  26839. 0, /*tp_repr*/
  26840. 0, /*tp_as_number*/
  26841. 0, /*tp_as_sequence*/
  26842. 0, /*tp_as_mapping*/
  26843. 0, /*tp_hash*/
  26844. 0, /*tp_call*/
  26845. 0, /*tp_str*/
  26846. 0, /*tp_getattro*/
  26847. 0, /*tp_setattro*/
  26848. 0, /*tp_as_buffer*/
  26849. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  26850. 0, /*tp_doc*/
  26851. __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_defaults, /*tp_traverse*/
  26852. __pyx_tp_clear_9fontTools_4misc_11bezierTools___pyx_defaults, /*tp_clear*/
  26853. 0, /*tp_richcompare*/
  26854. 0, /*tp_weaklistoffset*/
  26855. 0, /*tp_iter*/
  26856. 0, /*tp_iternext*/
  26857. 0, /*tp_methods*/
  26858. 0, /*tp_members*/
  26859. 0, /*tp_getset*/
  26860. 0, /*tp_base*/
  26861. 0, /*tp_dict*/
  26862. 0, /*tp_descr_get*/
  26863. 0, /*tp_descr_set*/
  26864. #if !CYTHON_USE_TYPE_SPECS
  26865. 0, /*tp_dictoffset*/
  26866. #endif
  26867. 0, /*tp_init*/
  26868. 0, /*tp_alloc*/
  26869. __pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_defaults, /*tp_new*/
  26870. 0, /*tp_free*/
  26871. 0, /*tp_is_gc*/
  26872. 0, /*tp_bases*/
  26873. 0, /*tp_mro*/
  26874. 0, /*tp_cache*/
  26875. 0, /*tp_subclasses*/
  26876. 0, /*tp_weaklist*/
  26877. 0, /*tp_del*/
  26878. 0, /*tp_version_tag*/
  26879. #if CYTHON_USE_TP_FINALIZE
  26880. 0, /*tp_finalize*/
  26881. #else
  26882. NULL, /*tp_finalize*/
  26883. #endif
  26884. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  26885. 0, /*tp_vectorcall*/
  26886. #endif
  26887. #if __PYX_NEED_TP_PRINT_SLOT == 1
  26888. 0, /*tp_print*/
  26889. #endif
  26890. #if PY_VERSION_HEX >= 0x030C0000
  26891. 0, /*tp_watched*/
  26892. #endif
  26893. #if PY_VERSION_HEX >= 0x030d00A4
  26894. 0, /*tp_versions_used*/
  26895. #endif
  26896. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  26897. 0, /*tp_pypy_flags*/
  26898. #endif
  26899. };
  26900. #endif
  26901. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  26902. PyObject *o;
  26903. #if CYTHON_USE_FREELISTS
  26904. 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))))
  26905. {
  26906. 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];
  26907. #if CYTHON_USE_TYPE_SPECS
  26908. Py_DECREF(Py_TYPE(o));
  26909. #endif
  26910. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr));
  26911. #if CYTHON_COMPILING_IN_LIMITED_API
  26912. (void) PyObject_Init(o, t);
  26913. #else
  26914. (void) PyObject_INIT(o, t);
  26915. #endif
  26916. PyObject_GC_Track(o);
  26917. } else
  26918. #endif
  26919. {
  26920. o = __Pyx_AllocateExtensionType(t, 1);
  26921. if (unlikely(!o)) return 0;
  26922. }
  26923. return o;
  26924. }
  26925. static void __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr(PyObject *o) {
  26926. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr *)o;
  26927. #if CYTHON_USE_TP_FINALIZE
  26928. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  26929. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr) {
  26930. if (PyObject_CallFinalizerFromDealloc(o)) return;
  26931. }
  26932. }
  26933. #endif
  26934. PyObject_GC_UnTrack(o);
  26935. Py_CLEAR(p->__pyx_genexpr_arg_0);
  26936. Py_CLEAR(p->__pyx_v_t);
  26937. #if CYTHON_USE_FREELISTS
  26938. 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))))
  26939. {
  26940. __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);
  26941. } else
  26942. #endif
  26943. {
  26944. PyTypeObject *tp = Py_TYPE(o);
  26945. #if CYTHON_USE_TYPE_SLOTS
  26946. (*tp->tp_free)(o);
  26947. #else
  26948. {
  26949. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  26950. if (tp_free) tp_free(o);
  26951. }
  26952. #endif
  26953. #if CYTHON_USE_TYPE_SPECS
  26954. Py_DECREF(tp);
  26955. #endif
  26956. }
  26957. }
  26958. static int __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr(PyObject *o, visitproc v, void *a) {
  26959. int e;
  26960. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr *)o;
  26961. {
  26962. e = __Pyx_call_type_traverse(o, 1, v, a);
  26963. if (e) return e;
  26964. }
  26965. if (p->__pyx_genexpr_arg_0) {
  26966. e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  26967. }
  26968. if (p->__pyx_v_t) {
  26969. e = (*v)(p->__pyx_v_t, a); if (e) return e;
  26970. }
  26971. return 0;
  26972. }
  26973. #if CYTHON_USE_TYPE_SPECS
  26974. static PyType_Slot __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr_slots[] = {
  26975. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr},
  26976. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr},
  26977. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr},
  26978. {0, 0},
  26979. };
  26980. static PyType_Spec __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr_spec = {
  26981. "fontTools.misc.bezierTools.__pyx_scope_struct__genexpr",
  26982. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr),
  26983. 0,
  26984. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  26985. __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr_slots,
  26986. };
  26987. #else
  26988. static PyTypeObject __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr = {
  26989. PyVarObject_HEAD_INIT(0, 0)
  26990. "fontTools.misc.bezierTools.""__pyx_scope_struct__genexpr", /*tp_name*/
  26991. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr), /*tp_basicsize*/
  26992. 0, /*tp_itemsize*/
  26993. __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr, /*tp_dealloc*/
  26994. 0, /*tp_vectorcall_offset*/
  26995. 0, /*tp_getattr*/
  26996. 0, /*tp_setattr*/
  26997. 0, /*tp_as_async*/
  26998. 0, /*tp_repr*/
  26999. 0, /*tp_as_number*/
  27000. 0, /*tp_as_sequence*/
  27001. 0, /*tp_as_mapping*/
  27002. 0, /*tp_hash*/
  27003. 0, /*tp_call*/
  27004. 0, /*tp_str*/
  27005. 0, /*tp_getattro*/
  27006. 0, /*tp_setattro*/
  27007. 0, /*tp_as_buffer*/
  27008. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  27009. 0, /*tp_doc*/
  27010. __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr, /*tp_traverse*/
  27011. 0, /*tp_clear*/
  27012. 0, /*tp_richcompare*/
  27013. 0, /*tp_weaklistoffset*/
  27014. 0, /*tp_iter*/
  27015. 0, /*tp_iternext*/
  27016. 0, /*tp_methods*/
  27017. 0, /*tp_members*/
  27018. 0, /*tp_getset*/
  27019. 0, /*tp_base*/
  27020. 0, /*tp_dict*/
  27021. 0, /*tp_descr_get*/
  27022. 0, /*tp_descr_set*/
  27023. #if !CYTHON_USE_TYPE_SPECS
  27024. 0, /*tp_dictoffset*/
  27025. #endif
  27026. 0, /*tp_init*/
  27027. 0, /*tp_alloc*/
  27028. __pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr, /*tp_new*/
  27029. 0, /*tp_free*/
  27030. 0, /*tp_is_gc*/
  27031. 0, /*tp_bases*/
  27032. 0, /*tp_mro*/
  27033. 0, /*tp_cache*/
  27034. 0, /*tp_subclasses*/
  27035. 0, /*tp_weaklist*/
  27036. 0, /*tp_del*/
  27037. 0, /*tp_version_tag*/
  27038. #if CYTHON_USE_TP_FINALIZE
  27039. 0, /*tp_finalize*/
  27040. #else
  27041. NULL, /*tp_finalize*/
  27042. #endif
  27043. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  27044. 0, /*tp_vectorcall*/
  27045. #endif
  27046. #if __PYX_NEED_TP_PRINT_SLOT == 1
  27047. 0, /*tp_print*/
  27048. #endif
  27049. #if PY_VERSION_HEX >= 0x030C0000
  27050. 0, /*tp_watched*/
  27051. #endif
  27052. #if PY_VERSION_HEX >= 0x030d00A4
  27053. 0, /*tp_versions_used*/
  27054. #endif
  27055. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  27056. 0, /*tp_pypy_flags*/
  27057. #endif
  27058. };
  27059. #endif
  27060. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  27061. PyObject *o;
  27062. #if CYTHON_USE_FREELISTS
  27063. 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))))
  27064. {
  27065. 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];
  27066. #if CYTHON_USE_TYPE_SPECS
  27067. Py_DECREF(Py_TYPE(o));
  27068. #endif
  27069. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr));
  27070. #if CYTHON_COMPILING_IN_LIMITED_API
  27071. (void) PyObject_Init(o, t);
  27072. #else
  27073. (void) PyObject_INIT(o, t);
  27074. #endif
  27075. PyObject_GC_Track(o);
  27076. } else
  27077. #endif
  27078. {
  27079. o = __Pyx_AllocateExtensionType(t, 1);
  27080. if (unlikely(!o)) return 0;
  27081. }
  27082. return o;
  27083. }
  27084. static void __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr(PyObject *o) {
  27085. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr *)o;
  27086. #if CYTHON_USE_TP_FINALIZE
  27087. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  27088. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr) {
  27089. if (PyObject_CallFinalizerFromDealloc(o)) return;
  27090. }
  27091. }
  27092. #endif
  27093. PyObject_GC_UnTrack(o);
  27094. Py_CLEAR(p->__pyx_genexpr_arg_0);
  27095. Py_CLEAR(p->__pyx_v_t);
  27096. #if CYTHON_USE_FREELISTS
  27097. 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))))
  27098. {
  27099. __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);
  27100. } else
  27101. #endif
  27102. {
  27103. PyTypeObject *tp = Py_TYPE(o);
  27104. #if CYTHON_USE_TYPE_SLOTS
  27105. (*tp->tp_free)(o);
  27106. #else
  27107. {
  27108. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  27109. if (tp_free) tp_free(o);
  27110. }
  27111. #endif
  27112. #if CYTHON_USE_TYPE_SPECS
  27113. Py_DECREF(tp);
  27114. #endif
  27115. }
  27116. }
  27117. static int __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
  27118. int e;
  27119. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr *)o;
  27120. {
  27121. e = __Pyx_call_type_traverse(o, 1, v, a);
  27122. if (e) return e;
  27123. }
  27124. if (p->__pyx_genexpr_arg_0) {
  27125. e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  27126. }
  27127. if (p->__pyx_v_t) {
  27128. e = (*v)(p->__pyx_v_t, a); if (e) return e;
  27129. }
  27130. return 0;
  27131. }
  27132. #if CYTHON_USE_TYPE_SPECS
  27133. static PyType_Slot __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr_slots[] = {
  27134. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr},
  27135. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr},
  27136. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr},
  27137. {0, 0},
  27138. };
  27139. static PyType_Spec __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr_spec = {
  27140. "fontTools.misc.bezierTools.__pyx_scope_struct_1_genexpr",
  27141. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr),
  27142. 0,
  27143. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  27144. __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr_slots,
  27145. };
  27146. #else
  27147. static PyTypeObject __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr = {
  27148. PyVarObject_HEAD_INIT(0, 0)
  27149. "fontTools.misc.bezierTools.""__pyx_scope_struct_1_genexpr", /*tp_name*/
  27150. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
  27151. 0, /*tp_itemsize*/
  27152. __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
  27153. 0, /*tp_vectorcall_offset*/
  27154. 0, /*tp_getattr*/
  27155. 0, /*tp_setattr*/
  27156. 0, /*tp_as_async*/
  27157. 0, /*tp_repr*/
  27158. 0, /*tp_as_number*/
  27159. 0, /*tp_as_sequence*/
  27160. 0, /*tp_as_mapping*/
  27161. 0, /*tp_hash*/
  27162. 0, /*tp_call*/
  27163. 0, /*tp_str*/
  27164. 0, /*tp_getattro*/
  27165. 0, /*tp_setattro*/
  27166. 0, /*tp_as_buffer*/
  27167. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  27168. 0, /*tp_doc*/
  27169. __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr, /*tp_traverse*/
  27170. 0, /*tp_clear*/
  27171. 0, /*tp_richcompare*/
  27172. 0, /*tp_weaklistoffset*/
  27173. 0, /*tp_iter*/
  27174. 0, /*tp_iternext*/
  27175. 0, /*tp_methods*/
  27176. 0, /*tp_members*/
  27177. 0, /*tp_getset*/
  27178. 0, /*tp_base*/
  27179. 0, /*tp_dict*/
  27180. 0, /*tp_descr_get*/
  27181. 0, /*tp_descr_set*/
  27182. #if !CYTHON_USE_TYPE_SPECS
  27183. 0, /*tp_dictoffset*/
  27184. #endif
  27185. 0, /*tp_init*/
  27186. 0, /*tp_alloc*/
  27187. __pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr, /*tp_new*/
  27188. 0, /*tp_free*/
  27189. 0, /*tp_is_gc*/
  27190. 0, /*tp_bases*/
  27191. 0, /*tp_mro*/
  27192. 0, /*tp_cache*/
  27193. 0, /*tp_subclasses*/
  27194. 0, /*tp_weaklist*/
  27195. 0, /*tp_del*/
  27196. 0, /*tp_version_tag*/
  27197. #if CYTHON_USE_TP_FINALIZE
  27198. 0, /*tp_finalize*/
  27199. #else
  27200. NULL, /*tp_finalize*/
  27201. #endif
  27202. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  27203. 0, /*tp_vectorcall*/
  27204. #endif
  27205. #if __PYX_NEED_TP_PRINT_SLOT == 1
  27206. 0, /*tp_print*/
  27207. #endif
  27208. #if PY_VERSION_HEX >= 0x030C0000
  27209. 0, /*tp_watched*/
  27210. #endif
  27211. #if PY_VERSION_HEX >= 0x030d00A4
  27212. 0, /*tp_versions_used*/
  27213. #endif
  27214. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  27215. 0, /*tp_pypy_flags*/
  27216. #endif
  27217. };
  27218. #endif
  27219. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  27220. PyObject *o;
  27221. #if CYTHON_USE_FREELISTS
  27222. 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))))
  27223. {
  27224. 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];
  27225. #if CYTHON_USE_TYPE_SPECS
  27226. Py_DECREF(Py_TYPE(o));
  27227. #endif
  27228. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC));
  27229. #if CYTHON_COMPILING_IN_LIMITED_API
  27230. (void) PyObject_Init(o, t);
  27231. #else
  27232. (void) PyObject_INIT(o, t);
  27233. #endif
  27234. PyObject_GC_Track(o);
  27235. } else
  27236. #endif
  27237. {
  27238. o = __Pyx_AllocateExtensionType(t, 1);
  27239. if (unlikely(!o)) return 0;
  27240. }
  27241. return o;
  27242. }
  27243. static void __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC(PyObject *o) {
  27244. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC *)o;
  27245. #if CYTHON_USE_TP_FINALIZE
  27246. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  27247. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC) {
  27248. if (PyObject_CallFinalizerFromDealloc(o)) return;
  27249. }
  27250. }
  27251. #endif
  27252. PyObject_GC_UnTrack(o);
  27253. Py_CLEAR(p->__pyx_v_ts);
  27254. #if CYTHON_USE_FREELISTS
  27255. 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))))
  27256. {
  27257. __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);
  27258. } else
  27259. #endif
  27260. {
  27261. PyTypeObject *tp = Py_TYPE(o);
  27262. #if CYTHON_USE_TYPE_SLOTS
  27263. (*tp->tp_free)(o);
  27264. #else
  27265. {
  27266. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  27267. if (tp_free) tp_free(o);
  27268. }
  27269. #endif
  27270. #if CYTHON_USE_TYPE_SPECS
  27271. Py_DECREF(tp);
  27272. #endif
  27273. }
  27274. }
  27275. static int __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC(PyObject *o, visitproc v, void *a) {
  27276. int e;
  27277. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC *)o;
  27278. {
  27279. e = __Pyx_call_type_traverse(o, 1, v, a);
  27280. if (e) return e;
  27281. }
  27282. if (p->__pyx_v_ts) {
  27283. e = (*v)(p->__pyx_v_ts, a); if (e) return e;
  27284. }
  27285. return 0;
  27286. }
  27287. #if CYTHON_USE_TYPE_SPECS
  27288. static PyType_Slot __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC_slots[] = {
  27289. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC},
  27290. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC},
  27291. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC},
  27292. {0, 0},
  27293. };
  27294. static PyType_Spec __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC_spec = {
  27295. "fontTools.misc.bezierTools.__pyx_scope_struct_2_splitCubicAtTC",
  27296. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC),
  27297. 0,
  27298. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  27299. __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC_slots,
  27300. };
  27301. #else
  27302. static PyTypeObject __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC = {
  27303. PyVarObject_HEAD_INIT(0, 0)
  27304. "fontTools.misc.bezierTools.""__pyx_scope_struct_2_splitCubicAtTC", /*tp_name*/
  27305. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC), /*tp_basicsize*/
  27306. 0, /*tp_itemsize*/
  27307. __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC, /*tp_dealloc*/
  27308. 0, /*tp_vectorcall_offset*/
  27309. 0, /*tp_getattr*/
  27310. 0, /*tp_setattr*/
  27311. 0, /*tp_as_async*/
  27312. 0, /*tp_repr*/
  27313. 0, /*tp_as_number*/
  27314. 0, /*tp_as_sequence*/
  27315. 0, /*tp_as_mapping*/
  27316. 0, /*tp_hash*/
  27317. 0, /*tp_call*/
  27318. 0, /*tp_str*/
  27319. 0, /*tp_getattro*/
  27320. 0, /*tp_setattro*/
  27321. 0, /*tp_as_buffer*/
  27322. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  27323. 0, /*tp_doc*/
  27324. __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC, /*tp_traverse*/
  27325. 0, /*tp_clear*/
  27326. 0, /*tp_richcompare*/
  27327. 0, /*tp_weaklistoffset*/
  27328. 0, /*tp_iter*/
  27329. 0, /*tp_iternext*/
  27330. 0, /*tp_methods*/
  27331. 0, /*tp_members*/
  27332. 0, /*tp_getset*/
  27333. 0, /*tp_base*/
  27334. 0, /*tp_dict*/
  27335. 0, /*tp_descr_get*/
  27336. 0, /*tp_descr_set*/
  27337. #if !CYTHON_USE_TYPE_SPECS
  27338. 0, /*tp_dictoffset*/
  27339. #endif
  27340. 0, /*tp_init*/
  27341. 0, /*tp_alloc*/
  27342. __pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC, /*tp_new*/
  27343. 0, /*tp_free*/
  27344. 0, /*tp_is_gc*/
  27345. 0, /*tp_bases*/
  27346. 0, /*tp_mro*/
  27347. 0, /*tp_cache*/
  27348. 0, /*tp_subclasses*/
  27349. 0, /*tp_weaklist*/
  27350. 0, /*tp_del*/
  27351. 0, /*tp_version_tag*/
  27352. #if CYTHON_USE_TP_FINALIZE
  27353. 0, /*tp_finalize*/
  27354. #else
  27355. NULL, /*tp_finalize*/
  27356. #endif
  27357. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  27358. 0, /*tp_vectorcall*/
  27359. #endif
  27360. #if __PYX_NEED_TP_PRINT_SLOT == 1
  27361. 0, /*tp_print*/
  27362. #endif
  27363. #if PY_VERSION_HEX >= 0x030C0000
  27364. 0, /*tp_watched*/
  27365. #endif
  27366. #if PY_VERSION_HEX >= 0x030d00A4
  27367. 0, /*tp_versions_used*/
  27368. #endif
  27369. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  27370. 0, /*tp_pypy_flags*/
  27371. #endif
  27372. };
  27373. #endif
  27374. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  27375. PyObject *o;
  27376. #if CYTHON_USE_FREELISTS
  27377. 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))))
  27378. {
  27379. 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];
  27380. #if CYTHON_USE_TYPE_SPECS
  27381. Py_DECREF(Py_TYPE(o));
  27382. #endif
  27383. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC));
  27384. #if CYTHON_COMPILING_IN_LIMITED_API
  27385. (void) PyObject_Init(o, t);
  27386. #else
  27387. (void) PyObject_INIT(o, t);
  27388. #endif
  27389. PyObject_GC_Track(o);
  27390. } else
  27391. #endif
  27392. {
  27393. o = __Pyx_AllocateExtensionType(t, 1);
  27394. if (unlikely(!o)) return 0;
  27395. }
  27396. return o;
  27397. }
  27398. static void __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC(PyObject *o) {
  27399. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC *)o;
  27400. #if CYTHON_USE_TP_FINALIZE
  27401. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  27402. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC) {
  27403. if (PyObject_CallFinalizerFromDealloc(o)) return;
  27404. }
  27405. }
  27406. #endif
  27407. PyObject_GC_UnTrack(o);
  27408. Py_CLEAR(p->__pyx_v_i);
  27409. Py_CLEAR(p->__pyx_v_pt1);
  27410. Py_CLEAR(p->__pyx_v_pt2);
  27411. Py_CLEAR(p->__pyx_v_pt3);
  27412. Py_CLEAR(p->__pyx_v_pt4);
  27413. Py_CLEAR(p->__pyx_v_ts);
  27414. Py_CLEAR(p->__pyx_t_0);
  27415. #if CYTHON_USE_FREELISTS
  27416. 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))))
  27417. {
  27418. __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);
  27419. } else
  27420. #endif
  27421. {
  27422. PyTypeObject *tp = Py_TYPE(o);
  27423. #if CYTHON_USE_TYPE_SLOTS
  27424. (*tp->tp_free)(o);
  27425. #else
  27426. {
  27427. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  27428. if (tp_free) tp_free(o);
  27429. }
  27430. #endif
  27431. #if CYTHON_USE_TYPE_SPECS
  27432. Py_DECREF(tp);
  27433. #endif
  27434. }
  27435. }
  27436. static int __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC(PyObject *o, visitproc v, void *a) {
  27437. int e;
  27438. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC *)o;
  27439. {
  27440. e = __Pyx_call_type_traverse(o, 1, v, a);
  27441. if (e) return e;
  27442. }
  27443. if (p->__pyx_v_i) {
  27444. e = (*v)(p->__pyx_v_i, a); if (e) return e;
  27445. }
  27446. if (p->__pyx_v_pt1) {
  27447. e = (*v)(p->__pyx_v_pt1, a); if (e) return e;
  27448. }
  27449. if (p->__pyx_v_pt2) {
  27450. e = (*v)(p->__pyx_v_pt2, a); if (e) return e;
  27451. }
  27452. if (p->__pyx_v_pt3) {
  27453. e = (*v)(p->__pyx_v_pt3, a); if (e) return e;
  27454. }
  27455. if (p->__pyx_v_pt4) {
  27456. e = (*v)(p->__pyx_v_pt4, a); if (e) return e;
  27457. }
  27458. if (p->__pyx_v_ts) {
  27459. e = (*v)(p->__pyx_v_ts, a); if (e) return e;
  27460. }
  27461. if (p->__pyx_t_0) {
  27462. e = (*v)(p->__pyx_t_0, a); if (e) return e;
  27463. }
  27464. return 0;
  27465. }
  27466. #if CYTHON_USE_TYPE_SPECS
  27467. static PyType_Slot __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC_slots[] = {
  27468. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC},
  27469. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC},
  27470. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC},
  27471. {0, 0},
  27472. };
  27473. static PyType_Spec __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC_spec = {
  27474. "fontTools.misc.bezierTools.__pyx_scope_struct_3__splitCubicAtTC",
  27475. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC),
  27476. 0,
  27477. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  27478. __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC_slots,
  27479. };
  27480. #else
  27481. static PyTypeObject __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC = {
  27482. PyVarObject_HEAD_INIT(0, 0)
  27483. "fontTools.misc.bezierTools.""__pyx_scope_struct_3__splitCubicAtTC", /*tp_name*/
  27484. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC), /*tp_basicsize*/
  27485. 0, /*tp_itemsize*/
  27486. __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC, /*tp_dealloc*/
  27487. 0, /*tp_vectorcall_offset*/
  27488. 0, /*tp_getattr*/
  27489. 0, /*tp_setattr*/
  27490. 0, /*tp_as_async*/
  27491. 0, /*tp_repr*/
  27492. 0, /*tp_as_number*/
  27493. 0, /*tp_as_sequence*/
  27494. 0, /*tp_as_mapping*/
  27495. 0, /*tp_hash*/
  27496. 0, /*tp_call*/
  27497. 0, /*tp_str*/
  27498. 0, /*tp_getattro*/
  27499. 0, /*tp_setattro*/
  27500. 0, /*tp_as_buffer*/
  27501. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  27502. 0, /*tp_doc*/
  27503. __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC, /*tp_traverse*/
  27504. 0, /*tp_clear*/
  27505. 0, /*tp_richcompare*/
  27506. 0, /*tp_weaklistoffset*/
  27507. 0, /*tp_iter*/
  27508. 0, /*tp_iternext*/
  27509. 0, /*tp_methods*/
  27510. 0, /*tp_members*/
  27511. 0, /*tp_getset*/
  27512. 0, /*tp_base*/
  27513. 0, /*tp_dict*/
  27514. 0, /*tp_descr_get*/
  27515. 0, /*tp_descr_set*/
  27516. #if !CYTHON_USE_TYPE_SPECS
  27517. 0, /*tp_dictoffset*/
  27518. #endif
  27519. 0, /*tp_init*/
  27520. 0, /*tp_alloc*/
  27521. __pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC, /*tp_new*/
  27522. 0, /*tp_free*/
  27523. 0, /*tp_is_gc*/
  27524. 0, /*tp_bases*/
  27525. 0, /*tp_mro*/
  27526. 0, /*tp_cache*/
  27527. 0, /*tp_subclasses*/
  27528. 0, /*tp_weaklist*/
  27529. 0, /*tp_del*/
  27530. 0, /*tp_version_tag*/
  27531. #if CYTHON_USE_TP_FINALIZE
  27532. 0, /*tp_finalize*/
  27533. #else
  27534. NULL, /*tp_finalize*/
  27535. #endif
  27536. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  27537. 0, /*tp_vectorcall*/
  27538. #endif
  27539. #if __PYX_NEED_TP_PRINT_SLOT == 1
  27540. 0, /*tp_print*/
  27541. #endif
  27542. #if PY_VERSION_HEX >= 0x030C0000
  27543. 0, /*tp_watched*/
  27544. #endif
  27545. #if PY_VERSION_HEX >= 0x030d00A4
  27546. 0, /*tp_versions_used*/
  27547. #endif
  27548. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  27549. 0, /*tp_pypy_flags*/
  27550. #endif
  27551. };
  27552. #endif
  27553. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  27554. PyObject *o;
  27555. #if CYTHON_USE_FREELISTS
  27556. 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))))
  27557. {
  27558. 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];
  27559. #if CYTHON_USE_TYPE_SPECS
  27560. Py_DECREF(Py_TYPE(o));
  27561. #endif
  27562. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr));
  27563. #if CYTHON_COMPILING_IN_LIMITED_API
  27564. (void) PyObject_Init(o, t);
  27565. #else
  27566. (void) PyObject_INIT(o, t);
  27567. #endif
  27568. PyObject_GC_Track(o);
  27569. } else
  27570. #endif
  27571. {
  27572. o = __Pyx_AllocateExtensionType(t, 1);
  27573. if (unlikely(!o)) return 0;
  27574. }
  27575. return o;
  27576. }
  27577. static void __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr(PyObject *o) {
  27578. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr *)o;
  27579. #if CYTHON_USE_TP_FINALIZE
  27580. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  27581. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr) {
  27582. if (PyObject_CallFinalizerFromDealloc(o)) return;
  27583. }
  27584. }
  27585. #endif
  27586. PyObject_GC_UnTrack(o);
  27587. Py_CLEAR(p->__pyx_genexpr_arg_0);
  27588. Py_CLEAR(p->__pyx_v_i);
  27589. #if CYTHON_USE_FREELISTS
  27590. 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))))
  27591. {
  27592. __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);
  27593. } else
  27594. #endif
  27595. {
  27596. PyTypeObject *tp = Py_TYPE(o);
  27597. #if CYTHON_USE_TYPE_SLOTS
  27598. (*tp->tp_free)(o);
  27599. #else
  27600. {
  27601. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  27602. if (tp_free) tp_free(o);
  27603. }
  27604. #endif
  27605. #if CYTHON_USE_TYPE_SPECS
  27606. Py_DECREF(tp);
  27607. #endif
  27608. }
  27609. }
  27610. static int __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr(PyObject *o, visitproc v, void *a) {
  27611. int e;
  27612. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr *)o;
  27613. {
  27614. e = __Pyx_call_type_traverse(o, 1, v, a);
  27615. if (e) return e;
  27616. }
  27617. if (p->__pyx_genexpr_arg_0) {
  27618. e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  27619. }
  27620. if (p->__pyx_v_i) {
  27621. e = (*v)(p->__pyx_v_i, a); if (e) return e;
  27622. }
  27623. return 0;
  27624. }
  27625. #if CYTHON_USE_TYPE_SPECS
  27626. static PyType_Slot __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr_slots[] = {
  27627. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr},
  27628. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr},
  27629. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr},
  27630. {0, 0},
  27631. };
  27632. static PyType_Spec __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr_spec = {
  27633. "fontTools.misc.bezierTools.__pyx_scope_struct_4_genexpr",
  27634. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr),
  27635. 0,
  27636. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  27637. __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr_slots,
  27638. };
  27639. #else
  27640. static PyTypeObject __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr = {
  27641. PyVarObject_HEAD_INIT(0, 0)
  27642. "fontTools.misc.bezierTools.""__pyx_scope_struct_4_genexpr", /*tp_name*/
  27643. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr), /*tp_basicsize*/
  27644. 0, /*tp_itemsize*/
  27645. __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr, /*tp_dealloc*/
  27646. 0, /*tp_vectorcall_offset*/
  27647. 0, /*tp_getattr*/
  27648. 0, /*tp_setattr*/
  27649. 0, /*tp_as_async*/
  27650. 0, /*tp_repr*/
  27651. 0, /*tp_as_number*/
  27652. 0, /*tp_as_sequence*/
  27653. 0, /*tp_as_mapping*/
  27654. 0, /*tp_hash*/
  27655. 0, /*tp_call*/
  27656. 0, /*tp_str*/
  27657. 0, /*tp_getattro*/
  27658. 0, /*tp_setattro*/
  27659. 0, /*tp_as_buffer*/
  27660. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  27661. 0, /*tp_doc*/
  27662. __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr, /*tp_traverse*/
  27663. 0, /*tp_clear*/
  27664. 0, /*tp_richcompare*/
  27665. 0, /*tp_weaklistoffset*/
  27666. 0, /*tp_iter*/
  27667. 0, /*tp_iternext*/
  27668. 0, /*tp_methods*/
  27669. 0, /*tp_members*/
  27670. 0, /*tp_getset*/
  27671. 0, /*tp_base*/
  27672. 0, /*tp_dict*/
  27673. 0, /*tp_descr_get*/
  27674. 0, /*tp_descr_set*/
  27675. #if !CYTHON_USE_TYPE_SPECS
  27676. 0, /*tp_dictoffset*/
  27677. #endif
  27678. 0, /*tp_init*/
  27679. 0, /*tp_alloc*/
  27680. __pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr, /*tp_new*/
  27681. 0, /*tp_free*/
  27682. 0, /*tp_is_gc*/
  27683. 0, /*tp_bases*/
  27684. 0, /*tp_mro*/
  27685. 0, /*tp_cache*/
  27686. 0, /*tp_subclasses*/
  27687. 0, /*tp_weaklist*/
  27688. 0, /*tp_del*/
  27689. 0, /*tp_version_tag*/
  27690. #if CYTHON_USE_TP_FINALIZE
  27691. 0, /*tp_finalize*/
  27692. #else
  27693. NULL, /*tp_finalize*/
  27694. #endif
  27695. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  27696. 0, /*tp_vectorcall*/
  27697. #endif
  27698. #if __PYX_NEED_TP_PRINT_SLOT == 1
  27699. 0, /*tp_print*/
  27700. #endif
  27701. #if PY_VERSION_HEX >= 0x030C0000
  27702. 0, /*tp_watched*/
  27703. #endif
  27704. #if PY_VERSION_HEX >= 0x030d00A4
  27705. 0, /*tp_versions_used*/
  27706. #endif
  27707. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  27708. 0, /*tp_pypy_flags*/
  27709. #endif
  27710. };
  27711. #endif
  27712. 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) {
  27713. PyObject *o;
  27714. #if CYTHON_USE_FREELISTS
  27715. 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))))
  27716. {
  27717. 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];
  27718. #if CYTHON_USE_TYPE_SPECS
  27719. Py_DECREF(Py_TYPE(o));
  27720. #endif
  27721. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t));
  27722. #if CYTHON_COMPILING_IN_LIMITED_API
  27723. (void) PyObject_Init(o, t);
  27724. #else
  27725. (void) PyObject_INIT(o, t);
  27726. #endif
  27727. PyObject_GC_Track(o);
  27728. } else
  27729. #endif
  27730. {
  27731. o = __Pyx_AllocateExtensionType(t, 1);
  27732. if (unlikely(!o)) return 0;
  27733. }
  27734. return o;
  27735. }
  27736. static void __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t(PyObject *o) {
  27737. 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;
  27738. #if CYTHON_USE_TP_FINALIZE
  27739. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  27740. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t) {
  27741. if (PyObject_CallFinalizerFromDealloc(o)) return;
  27742. }
  27743. }
  27744. #endif
  27745. PyObject_GC_UnTrack(o);
  27746. Py_CLEAR(p->__pyx_v_precision);
  27747. #if CYTHON_USE_FREELISTS
  27748. 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))))
  27749. {
  27750. __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);
  27751. } else
  27752. #endif
  27753. {
  27754. PyTypeObject *tp = Py_TYPE(o);
  27755. #if CYTHON_USE_TYPE_SLOTS
  27756. (*tp->tp_free)(o);
  27757. #else
  27758. {
  27759. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  27760. if (tp_free) tp_free(o);
  27761. }
  27762. #endif
  27763. #if CYTHON_USE_TYPE_SPECS
  27764. Py_DECREF(tp);
  27765. #endif
  27766. }
  27767. }
  27768. static int __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t(PyObject *o, visitproc v, void *a) {
  27769. int e;
  27770. 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;
  27771. {
  27772. e = __Pyx_call_type_traverse(o, 1, v, a);
  27773. if (e) return e;
  27774. }
  27775. if (p->__pyx_v_precision) {
  27776. e = (*v)(p->__pyx_v_precision, a); if (e) return e;
  27777. }
  27778. return 0;
  27779. }
  27780. static int __pyx_tp_clear_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t(PyObject *o) {
  27781. PyObject* tmp;
  27782. 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;
  27783. tmp = ((PyObject*)p->__pyx_v_precision);
  27784. p->__pyx_v_precision = Py_None; Py_INCREF(Py_None);
  27785. Py_XDECREF(tmp);
  27786. return 0;
  27787. }
  27788. #if CYTHON_USE_TYPE_SPECS
  27789. static PyType_Slot __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t_slots[] = {
  27790. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t},
  27791. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t},
  27792. {Py_tp_clear, (void *)__pyx_tp_clear_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t},
  27793. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t},
  27794. {0, 0},
  27795. };
  27796. static PyType_Spec __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t_spec = {
  27797. "fontTools.misc.bezierTools.__pyx_scope_struct_5__curve_curve_intersections_t",
  27798. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t),
  27799. 0,
  27800. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  27801. __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t_slots,
  27802. };
  27803. #else
  27804. static PyTypeObject __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t = {
  27805. PyVarObject_HEAD_INIT(0, 0)
  27806. "fontTools.misc.bezierTools.""__pyx_scope_struct_5__curve_curve_intersections_t", /*tp_name*/
  27807. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t), /*tp_basicsize*/
  27808. 0, /*tp_itemsize*/
  27809. __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t, /*tp_dealloc*/
  27810. 0, /*tp_vectorcall_offset*/
  27811. 0, /*tp_getattr*/
  27812. 0, /*tp_setattr*/
  27813. 0, /*tp_as_async*/
  27814. 0, /*tp_repr*/
  27815. 0, /*tp_as_number*/
  27816. 0, /*tp_as_sequence*/
  27817. 0, /*tp_as_mapping*/
  27818. 0, /*tp_hash*/
  27819. 0, /*tp_call*/
  27820. 0, /*tp_str*/
  27821. 0, /*tp_getattro*/
  27822. 0, /*tp_setattro*/
  27823. 0, /*tp_as_buffer*/
  27824. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  27825. 0, /*tp_doc*/
  27826. __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t, /*tp_traverse*/
  27827. __pyx_tp_clear_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t, /*tp_clear*/
  27828. 0, /*tp_richcompare*/
  27829. 0, /*tp_weaklistoffset*/
  27830. 0, /*tp_iter*/
  27831. 0, /*tp_iternext*/
  27832. 0, /*tp_methods*/
  27833. 0, /*tp_members*/
  27834. 0, /*tp_getset*/
  27835. 0, /*tp_base*/
  27836. 0, /*tp_dict*/
  27837. 0, /*tp_descr_get*/
  27838. 0, /*tp_descr_set*/
  27839. #if !CYTHON_USE_TYPE_SPECS
  27840. 0, /*tp_dictoffset*/
  27841. #endif
  27842. 0, /*tp_init*/
  27843. 0, /*tp_alloc*/
  27844. __pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t, /*tp_new*/
  27845. 0, /*tp_free*/
  27846. 0, /*tp_is_gc*/
  27847. 0, /*tp_bases*/
  27848. 0, /*tp_mro*/
  27849. 0, /*tp_cache*/
  27850. 0, /*tp_subclasses*/
  27851. 0, /*tp_weaklist*/
  27852. 0, /*tp_del*/
  27853. 0, /*tp_version_tag*/
  27854. #if CYTHON_USE_TP_FINALIZE
  27855. 0, /*tp_finalize*/
  27856. #else
  27857. NULL, /*tp_finalize*/
  27858. #endif
  27859. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  27860. 0, /*tp_vectorcall*/
  27861. #endif
  27862. #if __PYX_NEED_TP_PRINT_SLOT == 1
  27863. 0, /*tp_print*/
  27864. #endif
  27865. #if PY_VERSION_HEX >= 0x030C0000
  27866. 0, /*tp_watched*/
  27867. #endif
  27868. #if PY_VERSION_HEX >= 0x030d00A4
  27869. 0, /*tp_versions_used*/
  27870. #endif
  27871. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  27872. 0, /*tp_pypy_flags*/
  27873. #endif
  27874. };
  27875. #endif
  27876. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  27877. PyObject *o;
  27878. #if CYTHON_USE_FREELISTS
  27879. 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))))
  27880. {
  27881. 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];
  27882. #if CYTHON_USE_TYPE_SPECS
  27883. Py_DECREF(Py_TYPE(o));
  27884. #endif
  27885. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr));
  27886. #if CYTHON_COMPILING_IN_LIMITED_API
  27887. (void) PyObject_Init(o, t);
  27888. #else
  27889. (void) PyObject_INIT(o, t);
  27890. #endif
  27891. PyObject_GC_Track(o);
  27892. } else
  27893. #endif
  27894. {
  27895. o = __Pyx_AllocateExtensionType(t, 1);
  27896. if (unlikely(!o)) return 0;
  27897. }
  27898. return o;
  27899. }
  27900. static void __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr(PyObject *o) {
  27901. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr *)o;
  27902. #if CYTHON_USE_TP_FINALIZE
  27903. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  27904. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr) {
  27905. if (PyObject_CallFinalizerFromDealloc(o)) return;
  27906. }
  27907. }
  27908. #endif
  27909. PyObject_GC_UnTrack(o);
  27910. Py_CLEAR(p->__pyx_genexpr_arg_0);
  27911. Py_CLEAR(p->__pyx_v_p);
  27912. #if CYTHON_USE_FREELISTS
  27913. 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))))
  27914. {
  27915. __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);
  27916. } else
  27917. #endif
  27918. {
  27919. PyTypeObject *tp = Py_TYPE(o);
  27920. #if CYTHON_USE_TYPE_SLOTS
  27921. (*tp->tp_free)(o);
  27922. #else
  27923. {
  27924. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  27925. if (tp_free) tp_free(o);
  27926. }
  27927. #endif
  27928. #if CYTHON_USE_TYPE_SPECS
  27929. Py_DECREF(tp);
  27930. #endif
  27931. }
  27932. }
  27933. static int __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr(PyObject *o, visitproc v, void *a) {
  27934. int e;
  27935. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr *)o;
  27936. {
  27937. e = __Pyx_call_type_traverse(o, 1, v, a);
  27938. if (e) return e;
  27939. }
  27940. if (p->__pyx_genexpr_arg_0) {
  27941. e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  27942. }
  27943. if (p->__pyx_v_p) {
  27944. e = (*v)(p->__pyx_v_p, a); if (e) return e;
  27945. }
  27946. return 0;
  27947. }
  27948. #if CYTHON_USE_TYPE_SPECS
  27949. static PyType_Slot __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr_slots[] = {
  27950. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr},
  27951. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr},
  27952. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr},
  27953. {0, 0},
  27954. };
  27955. static PyType_Spec __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr_spec = {
  27956. "fontTools.misc.bezierTools.__pyx_scope_struct_6_genexpr",
  27957. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr),
  27958. 0,
  27959. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  27960. __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr_slots,
  27961. };
  27962. #else
  27963. static PyTypeObject __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr = {
  27964. PyVarObject_HEAD_INIT(0, 0)
  27965. "fontTools.misc.bezierTools.""__pyx_scope_struct_6_genexpr", /*tp_name*/
  27966. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr), /*tp_basicsize*/
  27967. 0, /*tp_itemsize*/
  27968. __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr, /*tp_dealloc*/
  27969. 0, /*tp_vectorcall_offset*/
  27970. 0, /*tp_getattr*/
  27971. 0, /*tp_setattr*/
  27972. 0, /*tp_as_async*/
  27973. 0, /*tp_repr*/
  27974. 0, /*tp_as_number*/
  27975. 0, /*tp_as_sequence*/
  27976. 0, /*tp_as_mapping*/
  27977. 0, /*tp_hash*/
  27978. 0, /*tp_call*/
  27979. 0, /*tp_str*/
  27980. 0, /*tp_getattro*/
  27981. 0, /*tp_setattro*/
  27982. 0, /*tp_as_buffer*/
  27983. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  27984. 0, /*tp_doc*/
  27985. __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr, /*tp_traverse*/
  27986. 0, /*tp_clear*/
  27987. 0, /*tp_richcompare*/
  27988. 0, /*tp_weaklistoffset*/
  27989. 0, /*tp_iter*/
  27990. 0, /*tp_iternext*/
  27991. 0, /*tp_methods*/
  27992. 0, /*tp_members*/
  27993. 0, /*tp_getset*/
  27994. 0, /*tp_base*/
  27995. 0, /*tp_dict*/
  27996. 0, /*tp_descr_get*/
  27997. 0, /*tp_descr_set*/
  27998. #if !CYTHON_USE_TYPE_SPECS
  27999. 0, /*tp_dictoffset*/
  28000. #endif
  28001. 0, /*tp_init*/
  28002. 0, /*tp_alloc*/
  28003. __pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr, /*tp_new*/
  28004. 0, /*tp_free*/
  28005. 0, /*tp_is_gc*/
  28006. 0, /*tp_bases*/
  28007. 0, /*tp_mro*/
  28008. 0, /*tp_cache*/
  28009. 0, /*tp_subclasses*/
  28010. 0, /*tp_weaklist*/
  28011. 0, /*tp_del*/
  28012. 0, /*tp_version_tag*/
  28013. #if CYTHON_USE_TP_FINALIZE
  28014. 0, /*tp_finalize*/
  28015. #else
  28016. NULL, /*tp_finalize*/
  28017. #endif
  28018. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  28019. 0, /*tp_vectorcall*/
  28020. #endif
  28021. #if __PYX_NEED_TP_PRINT_SLOT == 1
  28022. 0, /*tp_print*/
  28023. #endif
  28024. #if PY_VERSION_HEX >= 0x030C0000
  28025. 0, /*tp_watched*/
  28026. #endif
  28027. #if PY_VERSION_HEX >= 0x030d00A4
  28028. 0, /*tp_versions_used*/
  28029. #endif
  28030. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  28031. 0, /*tp_pypy_flags*/
  28032. #endif
  28033. };
  28034. #endif
  28035. static PyObject *__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  28036. PyObject *o;
  28037. #if CYTHON_USE_FREELISTS
  28038. 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))))
  28039. {
  28040. 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];
  28041. #if CYTHON_USE_TYPE_SPECS
  28042. Py_DECREF(Py_TYPE(o));
  28043. #endif
  28044. memset(o, 0, sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr));
  28045. #if CYTHON_COMPILING_IN_LIMITED_API
  28046. (void) PyObject_Init(o, t);
  28047. #else
  28048. (void) PyObject_INIT(o, t);
  28049. #endif
  28050. PyObject_GC_Track(o);
  28051. } else
  28052. #endif
  28053. {
  28054. o = __Pyx_AllocateExtensionType(t, 1);
  28055. if (unlikely(!o)) return 0;
  28056. }
  28057. return o;
  28058. }
  28059. static void __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr(PyObject *o) {
  28060. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr *)o;
  28061. #if CYTHON_USE_TP_FINALIZE
  28062. if (unlikely(__Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
  28063. if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr) {
  28064. if (PyObject_CallFinalizerFromDealloc(o)) return;
  28065. }
  28066. }
  28067. #endif
  28068. PyObject_GC_UnTrack(o);
  28069. Py_CLEAR(p->__pyx_genexpr_arg_0);
  28070. Py_CLEAR(p->__pyx_v_x);
  28071. #if CYTHON_USE_FREELISTS
  28072. 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))))
  28073. {
  28074. __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);
  28075. } else
  28076. #endif
  28077. {
  28078. PyTypeObject *tp = Py_TYPE(o);
  28079. #if CYTHON_USE_TYPE_SLOTS
  28080. (*tp->tp_free)(o);
  28081. #else
  28082. {
  28083. freefunc tp_free = (freefunc)PyType_GetSlot(tp, Py_tp_free);
  28084. if (tp_free) tp_free(o);
  28085. }
  28086. #endif
  28087. #if CYTHON_USE_TYPE_SPECS
  28088. Py_DECREF(tp);
  28089. #endif
  28090. }
  28091. }
  28092. static int __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr(PyObject *o, visitproc v, void *a) {
  28093. int e;
  28094. struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr *p = (struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr *)o;
  28095. {
  28096. e = __Pyx_call_type_traverse(o, 1, v, a);
  28097. if (e) return e;
  28098. }
  28099. if (p->__pyx_genexpr_arg_0) {
  28100. e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  28101. }
  28102. if (p->__pyx_v_x) {
  28103. e = (*v)(p->__pyx_v_x, a); if (e) return e;
  28104. }
  28105. return 0;
  28106. }
  28107. #if CYTHON_USE_TYPE_SPECS
  28108. static PyType_Slot __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr_slots[] = {
  28109. {Py_tp_dealloc, (void *)__pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr},
  28110. {Py_tp_traverse, (void *)__pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr},
  28111. {Py_tp_new, (void *)__pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr},
  28112. {0, 0},
  28113. };
  28114. static PyType_Spec __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr_spec = {
  28115. "fontTools.misc.bezierTools.__pyx_scope_struct_7_genexpr",
  28116. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr),
  28117. 0,
  28118. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC,
  28119. __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr_slots,
  28120. };
  28121. #else
  28122. static PyTypeObject __pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr = {
  28123. PyVarObject_HEAD_INIT(0, 0)
  28124. "fontTools.misc.bezierTools.""__pyx_scope_struct_7_genexpr", /*tp_name*/
  28125. sizeof(struct __pyx_obj_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr), /*tp_basicsize*/
  28126. 0, /*tp_itemsize*/
  28127. __pyx_tp_dealloc_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr, /*tp_dealloc*/
  28128. 0, /*tp_vectorcall_offset*/
  28129. 0, /*tp_getattr*/
  28130. 0, /*tp_setattr*/
  28131. 0, /*tp_as_async*/
  28132. 0, /*tp_repr*/
  28133. 0, /*tp_as_number*/
  28134. 0, /*tp_as_sequence*/
  28135. 0, /*tp_as_mapping*/
  28136. 0, /*tp_hash*/
  28137. 0, /*tp_call*/
  28138. 0, /*tp_str*/
  28139. 0, /*tp_getattro*/
  28140. 0, /*tp_setattro*/
  28141. 0, /*tp_as_buffer*/
  28142. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  28143. 0, /*tp_doc*/
  28144. __pyx_tp_traverse_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr, /*tp_traverse*/
  28145. 0, /*tp_clear*/
  28146. 0, /*tp_richcompare*/
  28147. 0, /*tp_weaklistoffset*/
  28148. 0, /*tp_iter*/
  28149. 0, /*tp_iternext*/
  28150. 0, /*tp_methods*/
  28151. 0, /*tp_members*/
  28152. 0, /*tp_getset*/
  28153. 0, /*tp_base*/
  28154. 0, /*tp_dict*/
  28155. 0, /*tp_descr_get*/
  28156. 0, /*tp_descr_set*/
  28157. #if !CYTHON_USE_TYPE_SPECS
  28158. 0, /*tp_dictoffset*/
  28159. #endif
  28160. 0, /*tp_init*/
  28161. 0, /*tp_alloc*/
  28162. __pyx_tp_new_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr, /*tp_new*/
  28163. 0, /*tp_free*/
  28164. 0, /*tp_is_gc*/
  28165. 0, /*tp_bases*/
  28166. 0, /*tp_mro*/
  28167. 0, /*tp_cache*/
  28168. 0, /*tp_subclasses*/
  28169. 0, /*tp_weaklist*/
  28170. 0, /*tp_del*/
  28171. 0, /*tp_version_tag*/
  28172. #if CYTHON_USE_TP_FINALIZE
  28173. 0, /*tp_finalize*/
  28174. #else
  28175. NULL, /*tp_finalize*/
  28176. #endif
  28177. #if !CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800
  28178. 0, /*tp_vectorcall*/
  28179. #endif
  28180. #if __PYX_NEED_TP_PRINT_SLOT == 1
  28181. 0, /*tp_print*/
  28182. #endif
  28183. #if PY_VERSION_HEX >= 0x030C0000
  28184. 0, /*tp_watched*/
  28185. #endif
  28186. #if PY_VERSION_HEX >= 0x030d00A4
  28187. 0, /*tp_versions_used*/
  28188. #endif
  28189. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
  28190. 0, /*tp_pypy_flags*/
  28191. #endif
  28192. };
  28193. #endif
  28194. static PyMethodDef __pyx_methods[] = {
  28195. {0, 0, 0, 0}
  28196. };
  28197. /* #### Code section: initfunc_declarations ### */
  28198. static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate); /*proto*/
  28199. static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
  28200. static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void); /*proto*/
  28201. static CYTHON_SMALL_CODE int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate); /*proto*/
  28202. static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  28203. static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  28204. static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  28205. static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  28206. static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  28207. static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  28208. static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate); /*proto*/
  28209. static CYTHON_SMALL_CODE int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate); /*proto*/
  28210. /* #### Code section: init_module ### */
  28211. static int __Pyx_modinit_global_init_code(__pyx_mstatetype *__pyx_mstate) {
  28212. __Pyx_RefNannyDeclarations
  28213. CYTHON_UNUSED_VAR(__pyx_mstate);
  28214. __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  28215. /*--- Global init code ---*/
  28216. __Pyx_RefNannyFinishContext();
  28217. return 0;
  28218. }
  28219. static int __Pyx_modinit_variable_export_code(__pyx_mstatetype *__pyx_mstate) {
  28220. __Pyx_RefNannyDeclarations
  28221. CYTHON_UNUSED_VAR(__pyx_mstate);
  28222. __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  28223. /*--- Variable export code ---*/
  28224. __Pyx_RefNannyFinishContext();
  28225. return 0;
  28226. }
  28227. static int __Pyx_modinit_function_export_code(__pyx_mstatetype *__pyx_mstate) {
  28228. __Pyx_RefNannyDeclarations
  28229. CYTHON_UNUSED_VAR(__pyx_mstate);
  28230. __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  28231. /*--- Function export code ---*/
  28232. __Pyx_RefNannyFinishContext();
  28233. return 0;
  28234. }
  28235. static int __Pyx_modinit_type_init_code(__pyx_mstatetype *__pyx_mstate) {
  28236. __Pyx_RefNannyDeclarations
  28237. CYTHON_UNUSED_VAR(__pyx_mstate);
  28238. int __pyx_lineno = 0;
  28239. const char *__pyx_filename = NULL;
  28240. int __pyx_clineno = 0;
  28241. __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  28242. /*--- Type init code ---*/
  28243. #if CYTHON_USE_TYPE_SPECS
  28244. __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)
  28245. 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)
  28246. #else
  28247. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_defaults = &__pyx_type_9fontTools_4misc_11bezierTools___pyx_defaults;
  28248. #endif
  28249. #if !CYTHON_COMPILING_IN_LIMITED_API
  28250. #endif
  28251. #if !CYTHON_USE_TYPE_SPECS
  28252. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_defaults) < (0)) __PYX_ERR(0, 815, __pyx_L1_error)
  28253. #endif
  28254. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28255. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_defaults);
  28256. #endif
  28257. #if !CYTHON_COMPILING_IN_LIMITED_API
  28258. 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)) {
  28259. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_defaults->tp_getattro = PyObject_GenericGetAttr;
  28260. }
  28261. #endif
  28262. #if CYTHON_USE_TYPE_SPECS
  28263. __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)
  28264. 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)
  28265. #else
  28266. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr = &__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr;
  28267. #endif
  28268. #if !CYTHON_COMPILING_IN_LIMITED_API
  28269. #endif
  28270. #if !CYTHON_USE_TYPE_SPECS
  28271. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr) < (0)) __PYX_ERR(0, 546, __pyx_L1_error)
  28272. #endif
  28273. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28274. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr);
  28275. #endif
  28276. #if !CYTHON_COMPILING_IN_LIMITED_API
  28277. 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)) {
  28278. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct__genexpr->tp_getattro = PyObject_GenericGetAttr;
  28279. }
  28280. #endif
  28281. #if CYTHON_USE_TYPE_SPECS
  28282. __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)
  28283. 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)
  28284. #else
  28285. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr = &__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr;
  28286. #endif
  28287. #if !CYTHON_COMPILING_IN_LIMITED_API
  28288. #endif
  28289. #if !CYTHON_USE_TYPE_SPECS
  28290. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr) < (0)) __PYX_ERR(0, 583, __pyx_L1_error)
  28291. #endif
  28292. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28293. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr);
  28294. #endif
  28295. #if !CYTHON_COMPILING_IN_LIMITED_API
  28296. 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)) {
  28297. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_1_genexpr->tp_getattro = PyObject_GenericGetAttr;
  28298. }
  28299. #endif
  28300. #if CYTHON_USE_TYPE_SPECS
  28301. __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)
  28302. 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)
  28303. #else
  28304. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC = &__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC;
  28305. #endif
  28306. #if !CYTHON_COMPILING_IN_LIMITED_API
  28307. #endif
  28308. #if !CYTHON_USE_TYPE_SPECS
  28309. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC) < (0)) __PYX_ERR(0, 644, __pyx_L1_error)
  28310. #endif
  28311. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28312. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC);
  28313. #endif
  28314. #if !CYTHON_COMPILING_IN_LIMITED_API
  28315. 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)) {
  28316. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_2_splitCubicAtTC->tp_getattro = PyObject_GenericGetAttr;
  28317. }
  28318. #endif
  28319. #if CYTHON_USE_TYPE_SPECS
  28320. __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)
  28321. 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)
  28322. #else
  28323. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC = &__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC;
  28324. #endif
  28325. #if !CYTHON_COMPILING_IN_LIMITED_API
  28326. #endif
  28327. #if !CYTHON_USE_TYPE_SPECS
  28328. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC) < (0)) __PYX_ERR(0, 770, __pyx_L1_error)
  28329. #endif
  28330. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28331. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC);
  28332. #endif
  28333. #if !CYTHON_COMPILING_IN_LIMITED_API
  28334. 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)) {
  28335. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_3__splitCubicAtTC->tp_getattro = PyObject_GenericGetAttr;
  28336. }
  28337. #endif
  28338. #if CYTHON_USE_TYPE_SPECS
  28339. __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)
  28340. 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)
  28341. #else
  28342. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr = &__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr;
  28343. #endif
  28344. #if !CYTHON_COMPILING_IN_LIMITED_API
  28345. #endif
  28346. #if !CYTHON_USE_TYPE_SPECS
  28347. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr) < (0)) __PYX_ERR(0, 1252, __pyx_L1_error)
  28348. #endif
  28349. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28350. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr);
  28351. #endif
  28352. #if !CYTHON_COMPILING_IN_LIMITED_API
  28353. 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)) {
  28354. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_4_genexpr->tp_getattro = PyObject_GenericGetAttr;
  28355. }
  28356. #endif
  28357. #if CYTHON_USE_TYPE_SPECS
  28358. __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)
  28359. 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)
  28360. #else
  28361. __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;
  28362. #endif
  28363. #if !CYTHON_COMPILING_IN_LIMITED_API
  28364. #endif
  28365. #if !CYTHON_USE_TYPE_SPECS
  28366. 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)
  28367. #endif
  28368. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28369. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t);
  28370. #endif
  28371. #if !CYTHON_COMPILING_IN_LIMITED_API
  28372. 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)) {
  28373. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_5__curve_curve_intersections_t->tp_getattro = PyObject_GenericGetAttr;
  28374. }
  28375. #endif
  28376. #if CYTHON_USE_TYPE_SPECS
  28377. __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)
  28378. 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)
  28379. #else
  28380. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr = &__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr;
  28381. #endif
  28382. #if !CYTHON_COMPILING_IN_LIMITED_API
  28383. #endif
  28384. #if !CYTHON_USE_TYPE_SPECS
  28385. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr) < (0)) __PYX_ERR(0, 1382, __pyx_L1_error)
  28386. #endif
  28387. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28388. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr);
  28389. #endif
  28390. #if !CYTHON_COMPILING_IN_LIMITED_API
  28391. 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)) {
  28392. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_6_genexpr->tp_getattro = PyObject_GenericGetAttr;
  28393. }
  28394. #endif
  28395. #if CYTHON_USE_TYPE_SPECS
  28396. __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)
  28397. 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)
  28398. #else
  28399. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr = &__pyx_type_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr;
  28400. #endif
  28401. #if !CYTHON_COMPILING_IN_LIMITED_API
  28402. #endif
  28403. #if !CYTHON_USE_TYPE_SPECS
  28404. if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr) < (0)) __PYX_ERR(0, 1485, __pyx_L1_error)
  28405. #endif
  28406. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28407. PyUnstable_Object_EnableDeferredRefcount((PyObject*)__pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr);
  28408. #endif
  28409. #if !CYTHON_COMPILING_IN_LIMITED_API
  28410. 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)) {
  28411. __pyx_mstate->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_scope_struct_7_genexpr->tp_getattro = PyObject_GenericGetAttr;
  28412. }
  28413. #endif
  28414. __Pyx_RefNannyFinishContext();
  28415. return 0;
  28416. __pyx_L1_error:;
  28417. __Pyx_RefNannyFinishContext();
  28418. return -1;
  28419. }
  28420. static int __Pyx_modinit_type_import_code(__pyx_mstatetype *__pyx_mstate) {
  28421. __Pyx_RefNannyDeclarations
  28422. CYTHON_UNUSED_VAR(__pyx_mstate);
  28423. __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  28424. /*--- Type import code ---*/
  28425. __Pyx_RefNannyFinishContext();
  28426. return 0;
  28427. }
  28428. static int __Pyx_modinit_variable_import_code(__pyx_mstatetype *__pyx_mstate) {
  28429. __Pyx_RefNannyDeclarations
  28430. CYTHON_UNUSED_VAR(__pyx_mstate);
  28431. __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  28432. /*--- Variable import code ---*/
  28433. __Pyx_RefNannyFinishContext();
  28434. return 0;
  28435. }
  28436. static int __Pyx_modinit_function_import_code(__pyx_mstatetype *__pyx_mstate) {
  28437. __Pyx_RefNannyDeclarations
  28438. CYTHON_UNUSED_VAR(__pyx_mstate);
  28439. __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  28440. /*--- Function import code ---*/
  28441. __Pyx_RefNannyFinishContext();
  28442. return 0;
  28443. }
  28444. #if CYTHON_PEP489_MULTI_PHASE_INIT
  28445. static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
  28446. static int __pyx_pymod_exec_bezierTools(PyObject* module); /*proto*/
  28447. static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  28448. {Py_mod_create, (void*)__pyx_pymod_create},
  28449. {Py_mod_exec, (void*)__pyx_pymod_exec_bezierTools},
  28450. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  28451. {Py_mod_gil, Py_MOD_GIL_USED},
  28452. #endif
  28453. #if PY_VERSION_HEX >= 0x030C0000 && CYTHON_USE_MODULE_STATE
  28454. {Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
  28455. #endif
  28456. {0, NULL}
  28457. };
  28458. #endif
  28459. #ifdef __cplusplus
  28460. namespace {
  28461. struct PyModuleDef __pyx_moduledef =
  28462. #else
  28463. static struct PyModuleDef __pyx_moduledef =
  28464. #endif
  28465. {
  28466. PyModuleDef_HEAD_INIT,
  28467. "bezierTools",
  28468. __pyx_k_fontTools_misc_bezierTools_py_to, /* m_doc */
  28469. #if CYTHON_USE_MODULE_STATE
  28470. sizeof(__pyx_mstatetype), /* m_size */
  28471. #else
  28472. (CYTHON_PEP489_MULTI_PHASE_INIT) ? 0 : -1, /* m_size */
  28473. #endif
  28474. __pyx_methods /* m_methods */,
  28475. #if CYTHON_PEP489_MULTI_PHASE_INIT
  28476. __pyx_moduledef_slots, /* m_slots */
  28477. #else
  28478. NULL, /* m_reload */
  28479. #endif
  28480. #if CYTHON_USE_MODULE_STATE
  28481. __pyx_m_traverse, /* m_traverse */
  28482. __pyx_m_clear, /* m_clear */
  28483. NULL /* m_free */
  28484. #else
  28485. NULL, /* m_traverse */
  28486. NULL, /* m_clear */
  28487. NULL /* m_free */
  28488. #endif
  28489. };
  28490. #ifdef __cplusplus
  28491. } /* anonymous namespace */
  28492. #endif
  28493. /* PyModInitFuncType */
  28494. #ifndef CYTHON_NO_PYINIT_EXPORT
  28495. #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
  28496. #else
  28497. #ifdef __cplusplus
  28498. #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
  28499. #else
  28500. #define __Pyx_PyMODINIT_FUNC PyObject *
  28501. #endif
  28502. #endif
  28503. __Pyx_PyMODINIT_FUNC PyInit_bezierTools(void) CYTHON_SMALL_CODE; /*proto*/
  28504. __Pyx_PyMODINIT_FUNC PyInit_bezierTools(void)
  28505. #if CYTHON_PEP489_MULTI_PHASE_INIT
  28506. {
  28507. return PyModuleDef_Init(&__pyx_moduledef);
  28508. }
  28509. /* ModuleCreationPEP489 */
  28510. #if CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\
  28511. || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000))
  28512. static PY_INT64_T __Pyx_GetCurrentInterpreterId(void) {
  28513. {
  28514. PyObject *module = PyImport_ImportModule("_interpreters"); // 3.13+ I think
  28515. if (!module) {
  28516. PyErr_Clear(); // just try the 3.8-3.12 version
  28517. module = PyImport_ImportModule("_xxsubinterpreters");
  28518. if (!module) goto bad;
  28519. }
  28520. PyObject *current = PyObject_CallMethod(module, "get_current", NULL);
  28521. Py_DECREF(module);
  28522. if (!current) goto bad;
  28523. if (PyTuple_Check(current)) {
  28524. PyObject *new_current = PySequence_GetItem(current, 0);
  28525. Py_DECREF(current);
  28526. current = new_current;
  28527. if (!new_current) goto bad;
  28528. }
  28529. long long as_c_int = PyLong_AsLongLong(current);
  28530. Py_DECREF(current);
  28531. return as_c_int;
  28532. }
  28533. bad:
  28534. PySys_WriteStderr("__Pyx_GetCurrentInterpreterId failed. Try setting the C define CYTHON_PEP489_MULTI_PHASE_INIT=0\n");
  28535. return -1;
  28536. }
  28537. #endif
  28538. #if !CYTHON_USE_MODULE_STATE
  28539. static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
  28540. static PY_INT64_T main_interpreter_id = -1;
  28541. #if CYTHON_COMPILING_IN_GRAAL && defined(GRAALPY_VERSION_NUM) && GRAALPY_VERSION_NUM > 0x19000000
  28542. PY_INT64_T current_id = GraalPyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
  28543. #elif CYTHON_COMPILING_IN_GRAAL
  28544. PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
  28545. #elif CYTHON_COMPILING_IN_LIMITED_API && (__PYX_LIMITED_VERSION_HEX < 0x03090000\
  28546. || ((defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) && __PYX_LIMITED_VERSION_HEX < 0x030A0000))
  28547. PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId();
  28548. #elif CYTHON_COMPILING_IN_LIMITED_API
  28549. PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get());
  28550. #else
  28551. PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
  28552. #endif
  28553. if (unlikely(current_id == -1)) {
  28554. return -1;
  28555. }
  28556. if (main_interpreter_id == -1) {
  28557. main_interpreter_id = current_id;
  28558. return 0;
  28559. } else if (unlikely(main_interpreter_id != current_id)) {
  28560. PyErr_SetString(
  28561. PyExc_ImportError,
  28562. "Interpreter change detected - this module can only be loaded into one interpreter per process.");
  28563. return -1;
  28564. }
  28565. return 0;
  28566. }
  28567. #endif
  28568. 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)
  28569. {
  28570. PyObject *value = PyObject_GetAttrString(spec, from_name);
  28571. int result = 0;
  28572. if (likely(value)) {
  28573. if (allow_none || value != Py_None) {
  28574. result = PyDict_SetItemString(moddict, to_name, value);
  28575. }
  28576. Py_DECREF(value);
  28577. } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
  28578. PyErr_Clear();
  28579. } else {
  28580. result = -1;
  28581. }
  28582. return result;
  28583. }
  28584. static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) {
  28585. PyObject *module = NULL, *moddict, *modname;
  28586. CYTHON_UNUSED_VAR(def);
  28587. #if !CYTHON_USE_MODULE_STATE
  28588. if (__Pyx_check_single_interpreter())
  28589. return NULL;
  28590. #endif
  28591. if (__pyx_m)
  28592. return __Pyx_NewRef(__pyx_m);
  28593. modname = PyObject_GetAttrString(spec, "name");
  28594. if (unlikely(!modname)) goto bad;
  28595. module = PyModule_NewObject(modname);
  28596. Py_DECREF(modname);
  28597. if (unlikely(!module)) goto bad;
  28598. moddict = PyModule_GetDict(module);
  28599. if (unlikely(!moddict)) goto bad;
  28600. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
  28601. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
  28602. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
  28603. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
  28604. return module;
  28605. bad:
  28606. Py_XDECREF(module);
  28607. return NULL;
  28608. }
  28609. static CYTHON_SMALL_CODE int __pyx_pymod_exec_bezierTools(PyObject *__pyx_pyinit_module)
  28610. #endif
  28611. {
  28612. int stringtab_initialized = 0;
  28613. #if CYTHON_USE_MODULE_STATE
  28614. int pystate_addmodule_run = 0;
  28615. #endif
  28616. __pyx_mstatetype *__pyx_mstate = NULL;
  28617. PyObject *__pyx_t_1 = NULL;
  28618. PyObject *__pyx_t_2 = NULL;
  28619. Py_ssize_t __pyx_t_3;
  28620. PyObject *__pyx_t_4 = NULL;
  28621. PyObject *__pyx_t_5 = NULL;
  28622. PyObject *__pyx_t_6 = NULL;
  28623. PyObject *__pyx_t_7 = NULL;
  28624. PyObject *__pyx_t_8 = NULL;
  28625. size_t __pyx_t_9;
  28626. int __pyx_t_10;
  28627. PyObject *__pyx_t_11 = NULL;
  28628. PyObject *__pyx_t_12 = NULL;
  28629. PyObject *__pyx_t_13 = NULL;
  28630. int __pyx_lineno = 0;
  28631. const char *__pyx_filename = NULL;
  28632. int __pyx_clineno = 0;
  28633. __Pyx_RefNannyDeclarations
  28634. #if CYTHON_PEP489_MULTI_PHASE_INIT
  28635. if (__pyx_m) {
  28636. if (__pyx_m == __pyx_pyinit_module) return 0;
  28637. PyErr_SetString(PyExc_RuntimeError, "Module 'bezierTools' has already been imported. Re-initialisation is not supported.");
  28638. return -1;
  28639. }
  28640. #else
  28641. if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  28642. #endif
  28643. /*--- Module creation code ---*/
  28644. #if CYTHON_PEP489_MULTI_PHASE_INIT
  28645. __pyx_t_1 = __pyx_pyinit_module;
  28646. Py_INCREF(__pyx_t_1);
  28647. #else
  28648. __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  28649. #endif
  28650. #if CYTHON_USE_MODULE_STATE
  28651. {
  28652. int add_module_result = __Pyx_State_AddModule(__pyx_t_1, &__pyx_moduledef);
  28653. __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "bezierTools" pseudovariable */
  28654. if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  28655. pystate_addmodule_run = 1;
  28656. }
  28657. #else
  28658. __pyx_m = __pyx_t_1;
  28659. #endif
  28660. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  28661. PyUnstable_Module_SetGIL(__pyx_m, Py_MOD_GIL_USED);
  28662. #endif
  28663. __pyx_mstate = __pyx_mstate_global;
  28664. CYTHON_UNUSED_VAR(__pyx_t_1);
  28665. __pyx_mstate->__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_mstate->__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  28666. Py_INCREF(__pyx_mstate->__pyx_d);
  28667. __pyx_mstate->__pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_mstate->__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  28668. __pyx_mstate->__pyx_cython_runtime = __Pyx_PyImport_AddModuleRef("cython_runtime"); if (unlikely(!__pyx_mstate->__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  28669. if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_mstate->__pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  28670. /* ImportRefnannyAPI */
  28671. #if CYTHON_REFNANNY
  28672. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  28673. if (!__Pyx_RefNanny) {
  28674. PyErr_Clear();
  28675. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  28676. if (!__Pyx_RefNanny)
  28677. Py_FatalError("failed to import 'refnanny' module");
  28678. }
  28679. #endif
  28680. __Pyx_RefNannySetupContext("PyInit_bezierTools", 0);
  28681. __Pyx_init_runtime_version();
  28682. 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)
  28683. __pyx_mstate->__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_mstate->__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  28684. __pyx_mstate->__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  28685. __pyx_mstate->__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_mstate->__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  28686. /*--- Library function declarations ---*/
  28687. /*--- Initialize various global constants etc. ---*/
  28688. if (__Pyx_InitConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  28689. stringtab_initialized = 1;
  28690. if (__Pyx_InitGlobals() < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  28691. if (__pyx_module_is_main_fontTools__misc__bezierTools) {
  28692. 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)
  28693. }
  28694. {
  28695. PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
  28696. if (!PyDict_GetItemString(modules, "fontTools.misc.bezierTools")) {
  28697. if (unlikely((PyDict_SetItemString(modules, "fontTools.misc.bezierTools", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  28698. }
  28699. }
  28700. /*--- Builtin init code ---*/
  28701. if (__Pyx_InitCachedBuiltins(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  28702. /*--- Constants init code ---*/
  28703. if (__Pyx_InitCachedConstants(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  28704. if (__Pyx_CreateCodeObjects(__pyx_mstate) < (0)) __PYX_ERR(0, 1, __pyx_L1_error)
  28705. /*--- Global type/function init code ---*/
  28706. (void)__Pyx_modinit_global_init_code(__pyx_mstate);
  28707. (void)__Pyx_modinit_variable_export_code(__pyx_mstate);
  28708. (void)__Pyx_modinit_function_export_code(__pyx_mstate);
  28709. if (unlikely((__Pyx_modinit_type_init_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  28710. (void)__Pyx_modinit_type_import_code(__pyx_mstate);
  28711. (void)__Pyx_modinit_variable_import_code(__pyx_mstate);
  28712. (void)__Pyx_modinit_function_import_code(__pyx_mstate);
  28713. /*--- Execution code ---*/
  28714. /* "fontTools/misc/bezierTools.py":5
  28715. * """
  28716. *
  28717. * from fontTools.misc.arrayTools import calcBounds, sectRect, rectArea # <<<<<<<<<<<<<<
  28718. * from fontTools.misc.transform import Identity
  28719. * import math
  28720. */
  28721. {
  28722. 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};
  28723. __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)
  28724. }
  28725. __pyx_t_2 = __pyx_t_1;
  28726. __Pyx_GOTREF(__pyx_t_2);
  28727. {
  28728. 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};
  28729. for (__pyx_t_3=0; __pyx_t_3 < 3; __pyx_t_3++) {
  28730. __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)
  28731. __Pyx_GOTREF(__pyx_t_4);
  28732. 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)
  28733. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  28734. }
  28735. }
  28736. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28737. /* "fontTools/misc/bezierTools.py":6
  28738. *
  28739. * from fontTools.misc.arrayTools import calcBounds, sectRect, rectArea
  28740. * from fontTools.misc.transform import Identity # <<<<<<<<<<<<<<
  28741. * import math
  28742. * from collections import namedtuple
  28743. */
  28744. {
  28745. PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Identity};
  28746. __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)
  28747. }
  28748. __pyx_t_2 = __pyx_t_1;
  28749. __Pyx_GOTREF(__pyx_t_2);
  28750. {
  28751. PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_Identity};
  28752. __pyx_t_3 = 0; {
  28753. __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)
  28754. __Pyx_GOTREF(__pyx_t_4);
  28755. 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)
  28756. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  28757. }
  28758. }
  28759. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28760. /* "fontTools/misc/bezierTools.py":7
  28761. * from fontTools.misc.arrayTools import calcBounds, sectRect, rectArea
  28762. * from fontTools.misc.transform import Identity
  28763. * import math # <<<<<<<<<<<<<<
  28764. * from collections import namedtuple
  28765. *
  28766. */
  28767. __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)
  28768. __pyx_t_2 = __pyx_t_1;
  28769. __Pyx_GOTREF(__pyx_t_2);
  28770. 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)
  28771. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28772. /* "fontTools/misc/bezierTools.py":8
  28773. * from fontTools.misc.transform import Identity
  28774. * import math
  28775. * from collections import namedtuple # <<<<<<<<<<<<<<
  28776. *
  28777. * try:
  28778. */
  28779. {
  28780. PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_namedtuple};
  28781. __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)
  28782. }
  28783. __pyx_t_2 = __pyx_t_1;
  28784. __Pyx_GOTREF(__pyx_t_2);
  28785. {
  28786. PyObject* const __pyx_imported_names[] = {__pyx_mstate_global->__pyx_n_u_namedtuple};
  28787. __pyx_t_3 = 0; {
  28788. __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)
  28789. __Pyx_GOTREF(__pyx_t_4);
  28790. 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)
  28791. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  28792. }
  28793. }
  28794. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28795. /* "fontTools/misc/bezierTools.py":10
  28796. * from collections import namedtuple
  28797. *
  28798. * try: # <<<<<<<<<<<<<<
  28799. * import cython
  28800. * except (AttributeError, ImportError):
  28801. */
  28802. {
  28803. (void)__pyx_t_1; (void)__pyx_t_5; (void)__pyx_t_6; /* mark used */
  28804. /*try:*/ {
  28805. /* "fontTools/misc/bezierTools.py":11
  28806. *
  28807. * try:
  28808. * import cython # <<<<<<<<<<<<<<
  28809. * except (AttributeError, ImportError):
  28810. * # if cython not installed, use mock module with no-op decorators and types
  28811. */
  28812. }
  28813. }
  28814. /* "fontTools/misc/bezierTools.py":15
  28815. * # if cython not installed, use mock module with no-op decorators and types
  28816. * from fontTools.misc import cython
  28817. * COMPILED = cython.compiled # <<<<<<<<<<<<<<
  28818. *
  28819. *
  28820. */
  28821. 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)
  28822. /* "fontTools/misc/bezierTools.py":18
  28823. *
  28824. *
  28825. * EPSILON = 1e-9 # <<<<<<<<<<<<<<
  28826. *
  28827. *
  28828. */
  28829. 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)
  28830. /* "fontTools/misc/bezierTools.py":21
  28831. *
  28832. *
  28833. * Intersection = namedtuple("Intersection", ["pt", "t1", "t2"]) # <<<<<<<<<<<<<<
  28834. *
  28835. *
  28836. */
  28837. __pyx_t_4 = NULL;
  28838. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_namedtuple); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 21, __pyx_L1_error)
  28839. __Pyx_GOTREF(__pyx_t_7);
  28840. __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)
  28841. __Pyx_GOTREF(__pyx_t_8);
  28842. __pyx_t_9 = 1;
  28843. {
  28844. PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_mstate_global->__pyx_n_u_Intersection, __pyx_t_8};
  28845. __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));
  28846. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  28847. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  28848. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  28849. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error)
  28850. __Pyx_GOTREF(__pyx_t_2);
  28851. }
  28852. 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)
  28853. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28854. /* "fontTools/misc/bezierTools.py":24
  28855. *
  28856. *
  28857. * __all__ = [ # <<<<<<<<<<<<<<
  28858. * "approximateCubicArcLength",
  28859. * "approximateCubicArcLengthC",
  28860. */
  28861. __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)
  28862. __Pyx_GOTREF(__pyx_t_2);
  28863. 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)
  28864. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28865. /* "fontTools/misc/bezierTools.py":56
  28866. *
  28867. *
  28868. * def calcCubicArcLength(pt1, pt2, pt3, pt4, tolerance=0.005): # <<<<<<<<<<<<<<
  28869. * """Calculates the arc length for a cubic Bezier segment.
  28870. *
  28871. */
  28872. __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)
  28873. __Pyx_GOTREF(__pyx_t_2);
  28874. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28875. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  28876. #endif
  28877. __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[2]);
  28878. 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)
  28879. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28880. /* "fontTools/misc/bezierTools.py":75
  28881. *
  28882. *
  28883. * def _split_cubic_into_two(p0, p1, p2, p3): # <<<<<<<<<<<<<<
  28884. * mid = (p0 + 3 * (p1 + p2) + p3) * 0.125
  28885. * deriv3 = (p3 + p2 - p1 - p0) * 0.125
  28886. */
  28887. __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)
  28888. __Pyx_GOTREF(__pyx_t_2);
  28889. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28890. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  28891. #endif
  28892. 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)
  28893. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28894. /* "fontTools/misc/bezierTools.py":84
  28895. *
  28896. *
  28897. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  28898. * @cython.locals(
  28899. * p0=cython.complex,
  28900. */
  28901. __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)
  28902. __Pyx_GOTREF(__pyx_t_2);
  28903. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28904. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  28905. #endif
  28906. 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)
  28907. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28908. /* "fontTools/misc/bezierTools.py":115
  28909. * mult=cython.double,
  28910. * )
  28911. * def calcCubicArcLengthC(pt1, pt2, pt3, pt4, tolerance=0.005): # <<<<<<<<<<<<<<
  28912. * """Calculates the arc length for a cubic Bezier segment.
  28913. *
  28914. */
  28915. __pyx_t_2 = PyFloat_FromDouble(((double)0.005)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 115, __pyx_L1_error)
  28916. __Pyx_GOTREF(__pyx_t_2);
  28917. /* "fontTools/misc/bezierTools.py":104
  28918. *
  28919. *
  28920. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  28921. * @cython.locals(
  28922. * pt1=cython.complex,
  28923. */
  28924. __pyx_t_7 = PyTuple_Pack(1, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 104, __pyx_L1_error)
  28925. __Pyx_GOTREF(__pyx_t_7);
  28926. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28927. __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)
  28928. __Pyx_GOTREF(__pyx_t_2);
  28929. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28930. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  28931. #endif
  28932. __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_t_7);
  28933. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  28934. 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)
  28935. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28936. /* "fontTools/misc/bezierTools.py":129
  28937. *
  28938. *
  28939. * epsilonDigits = 6 # <<<<<<<<<<<<<<
  28940. * epsilon = 1e-10
  28941. *
  28942. */
  28943. 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)
  28944. /* "fontTools/misc/bezierTools.py":130
  28945. *
  28946. * epsilonDigits = 6
  28947. * epsilon = 1e-10 # <<<<<<<<<<<<<<
  28948. *
  28949. *
  28950. */
  28951. 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)
  28952. /* "fontTools/misc/bezierTools.py":151
  28953. *
  28954. *
  28955. * def calcQuadraticArcLength(pt1, pt2, pt3): # <<<<<<<<<<<<<<
  28956. * """Calculates the arc length for a quadratic Bezier segment.
  28957. *
  28958. */
  28959. __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)
  28960. __Pyx_GOTREF(__pyx_t_2);
  28961. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28962. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  28963. #endif
  28964. 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)
  28965. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28966. /* "fontTools/misc/bezierTools.py":186
  28967. *
  28968. *
  28969. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  28970. * @cython.locals(
  28971. * pt1=cython.complex,
  28972. */
  28973. __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)
  28974. __Pyx_GOTREF(__pyx_t_2);
  28975. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28976. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  28977. #endif
  28978. 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)
  28979. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28980. /* "fontTools/misc/bezierTools.py":237
  28981. *
  28982. *
  28983. * def approximateQuadraticArcLength(pt1, pt2, pt3): # <<<<<<<<<<<<<<
  28984. * """Calculates the arc length for a quadratic Bezier segment.
  28985. *
  28986. */
  28987. __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)
  28988. __Pyx_GOTREF(__pyx_t_2);
  28989. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  28990. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  28991. #endif
  28992. 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)
  28993. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  28994. /* "fontTools/misc/bezierTools.py":254
  28995. *
  28996. *
  28997. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  28998. * @cython.locals(
  28999. * pt1=cython.complex,
  29000. */
  29001. __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)
  29002. __Pyx_GOTREF(__pyx_t_2);
  29003. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29004. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29005. #endif
  29006. 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)
  29007. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29008. /* "fontTools/misc/bezierTools.py":298
  29009. *
  29010. *
  29011. * def calcQuadraticBounds(pt1, pt2, pt3): # <<<<<<<<<<<<<<
  29012. * """Calculates the bounding rectangle for a quadratic Bezier segment.
  29013. *
  29014. */
  29015. __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)
  29016. __Pyx_GOTREF(__pyx_t_2);
  29017. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29018. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29019. #endif
  29020. 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)
  29021. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29022. /* "fontTools/misc/bezierTools.py":332
  29023. *
  29024. *
  29025. * def approximateCubicArcLength(pt1, pt2, pt3, pt4): # <<<<<<<<<<<<<<
  29026. * """Approximates the arc length for a cubic Bezier segment.
  29027. *
  29028. */
  29029. __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)
  29030. __Pyx_GOTREF(__pyx_t_2);
  29031. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29032. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29033. #endif
  29034. 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)
  29035. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29036. /* "fontTools/misc/bezierTools.py":362
  29037. *
  29038. *
  29039. * @cython.returns(cython.double) # <<<<<<<<<<<<<<
  29040. * @cython.locals(
  29041. * pt1=cython.complex,
  29042. */
  29043. __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)
  29044. __Pyx_GOTREF(__pyx_t_2);
  29045. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29046. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29047. #endif
  29048. 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)
  29049. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29050. /* "fontTools/misc/bezierTools.py":412
  29051. *
  29052. *
  29053. * def calcCubicBounds(pt1, pt2, pt3, pt4): # <<<<<<<<<<<<<<
  29054. * """Calculates the bounding rectangle for a quadratic Bezier segment.
  29055. *
  29056. */
  29057. __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)
  29058. __Pyx_GOTREF(__pyx_t_2);
  29059. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29060. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29061. #endif
  29062. 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)
  29063. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29064. /* "fontTools/misc/bezierTools.py":450
  29065. *
  29066. *
  29067. * def splitLine(pt1, pt2, where, isHorizontal): # <<<<<<<<<<<<<<
  29068. * """Split a line at a given coordinate.
  29069. *
  29070. */
  29071. __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)
  29072. __Pyx_GOTREF(__pyx_t_2);
  29073. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29074. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29075. #endif
  29076. 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)
  29077. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29078. /* "fontTools/misc/bezierTools.py":507
  29079. *
  29080. *
  29081. * def splitQuadratic(pt1, pt2, pt3, where, isHorizontal): # <<<<<<<<<<<<<<
  29082. * """Split a quadratic Bezier curve at a given coordinate.
  29083. *
  29084. */
  29085. __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)
  29086. __Pyx_GOTREF(__pyx_t_2);
  29087. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29088. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29089. #endif
  29090. 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)
  29091. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29092. /* "fontTools/misc/bezierTools.py":552
  29093. *
  29094. *
  29095. * def splitCubic(pt1, pt2, pt3, pt4, where, isHorizontal): # <<<<<<<<<<<<<<
  29096. * """Split a cubic Bezier curve at a given coordinate.
  29097. *
  29098. */
  29099. __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)
  29100. __Pyx_GOTREF(__pyx_t_2);
  29101. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29102. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29103. #endif
  29104. 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)
  29105. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29106. /* "fontTools/misc/bezierTools.py":589
  29107. *
  29108. *
  29109. * def splitQuadraticAtT(pt1, pt2, pt3, *ts): # <<<<<<<<<<<<<<
  29110. * """Split a quadratic Bezier curve at one or more values of t.
  29111. *
  29112. */
  29113. __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)
  29114. __Pyx_GOTREF(__pyx_t_2);
  29115. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29116. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29117. #endif
  29118. 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)
  29119. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29120. /* "fontTools/misc/bezierTools.py":613
  29121. *
  29122. *
  29123. * def splitCubicAtT(pt1, pt2, pt3, pt4, *ts): # <<<<<<<<<<<<<<
  29124. * """Split a cubic Bezier curve at one or more values of t.
  29125. *
  29126. */
  29127. __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)
  29128. __Pyx_GOTREF(__pyx_t_2);
  29129. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29130. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29131. #endif
  29132. 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)
  29133. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29134. /* "fontTools/misc/bezierTools.py":644
  29135. *
  29136. *
  29137. * @cython.locals( # <<<<<<<<<<<<<<
  29138. * pt1=cython.complex,
  29139. * pt2=cython.complex,
  29140. */
  29141. __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)
  29142. __Pyx_GOTREF(__pyx_t_2);
  29143. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29144. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29145. #endif
  29146. 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)
  29147. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29148. /* "fontTools/misc/bezierTools.py":668
  29149. *
  29150. *
  29151. * @cython.returns(cython.complex) # <<<<<<<<<<<<<<
  29152. * @cython.locals(
  29153. * t=cython.double,
  29154. */
  29155. __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)
  29156. __Pyx_GOTREF(__pyx_t_2);
  29157. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29158. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29159. #endif
  29160. 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)
  29161. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29162. /* "fontTools/misc/bezierTools.py":708
  29163. *
  29164. *
  29165. * def _splitQuadraticAtT(a, b, c, *ts): # <<<<<<<<<<<<<<
  29166. * ts = list(ts)
  29167. * segments = []
  29168. */
  29169. __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)
  29170. __Pyx_GOTREF(__pyx_t_2);
  29171. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29172. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29173. #endif
  29174. 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)
  29175. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29176. /* "fontTools/misc/bezierTools.py":735
  29177. *
  29178. *
  29179. * def _splitCubicAtT(a, b, c, d, *ts): # <<<<<<<<<<<<<<
  29180. * ts = list(ts)
  29181. * ts.insert(0, 0.0)
  29182. */
  29183. __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)
  29184. __Pyx_GOTREF(__pyx_t_2);
  29185. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29186. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29187. #endif
  29188. 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)
  29189. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29190. /* "fontTools/misc/bezierTools.py":770
  29191. *
  29192. *
  29193. * @cython.locals( # <<<<<<<<<<<<<<
  29194. * a=cython.complex,
  29195. * b=cython.complex,
  29196. */
  29197. __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)
  29198. __Pyx_GOTREF(__pyx_t_2);
  29199. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29200. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29201. #endif
  29202. 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)
  29203. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29204. /* "fontTools/misc/bezierTools.py":812
  29205. * #
  29206. *
  29207. * from math import sqrt, acos, cos, pi # <<<<<<<<<<<<<<
  29208. *
  29209. *
  29210. */
  29211. {
  29212. 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};
  29213. __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)
  29214. }
  29215. __pyx_t_2 = __pyx_t_6;
  29216. __Pyx_GOTREF(__pyx_t_2);
  29217. {
  29218. 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};
  29219. for (__pyx_t_3=0; __pyx_t_3 < 4; __pyx_t_3++) {
  29220. __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)
  29221. __Pyx_GOTREF(__pyx_t_7);
  29222. 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)
  29223. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  29224. }
  29225. }
  29226. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29227. /* "fontTools/misc/bezierTools.py":815
  29228. *
  29229. *
  29230. * def solveQuadratic(a, b, c, sqrt=sqrt): # <<<<<<<<<<<<<<
  29231. * """Solve a quadratic equation.
  29232. *
  29233. */
  29234. __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)
  29235. __Pyx_GOTREF(__pyx_t_2);
  29236. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29237. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29238. #endif
  29239. if (!__Pyx_CyFunction_InitDefaults(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_9fontTools_4misc_11bezierTools___pyx_defaults)) __PYX_ERR(0, 815, __pyx_L1_error)
  29240. __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_mstate_global->__pyx_n_u_sqrt); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 815, __pyx_L1_error)
  29241. __Pyx_GOTREF(__pyx_t_7);
  29242. __Pyx_CyFunction_Defaults(struct __pyx_defaults, __pyx_t_2)->arg0 = __pyx_t_7;
  29243. __Pyx_GIVEREF(__pyx_t_7);
  29244. __pyx_t_7 = 0;
  29245. __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_2, __pyx_pf_9fontTools_4misc_11bezierTools_96__defaults__);
  29246. 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)
  29247. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29248. /* "fontTools/misc/bezierTools.py":848
  29249. *
  29250. *
  29251. * def solveCubic(a, b, c, d): # <<<<<<<<<<<<<<
  29252. * """Solve a cubic equation.
  29253. *
  29254. */
  29255. __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)
  29256. __Pyx_GOTREF(__pyx_t_2);
  29257. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29258. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29259. #endif
  29260. 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)
  29261. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29262. /* "fontTools/misc/bezierTools.py":945
  29263. *
  29264. *
  29265. * def calcQuadraticParameters(pt1, pt2, pt3): # <<<<<<<<<<<<<<
  29266. * x2, y2 = pt2
  29267. * x3, y3 = pt3
  29268. */
  29269. __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)
  29270. __Pyx_GOTREF(__pyx_t_2);
  29271. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29272. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29273. #endif
  29274. 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)
  29275. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29276. /* "fontTools/misc/bezierTools.py":956
  29277. *
  29278. *
  29279. * def calcCubicParameters(pt1, pt2, pt3, pt4): # <<<<<<<<<<<<<<
  29280. * x2, y2 = pt2
  29281. * x3, y3 = pt3
  29282. */
  29283. __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)
  29284. __Pyx_GOTREF(__pyx_t_2);
  29285. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29286. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29287. #endif
  29288. 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)
  29289. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29290. /* "fontTools/misc/bezierTools.py":988
  29291. *
  29292. *
  29293. * def calcQuadraticPoints(a, b, c): # <<<<<<<<<<<<<<
  29294. * ax, ay = a
  29295. * bx, by = b
  29296. */
  29297. __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)
  29298. __Pyx_GOTREF(__pyx_t_2);
  29299. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29300. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29301. #endif
  29302. 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)
  29303. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29304. /* "fontTools/misc/bezierTools.py":1001
  29305. *
  29306. *
  29307. * def calcCubicPoints(a, b, c, d): # <<<<<<<<<<<<<<
  29308. * ax, ay = a
  29309. * bx, by = b
  29310. */
  29311. __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)
  29312. __Pyx_GOTREF(__pyx_t_2);
  29313. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29314. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29315. #endif
  29316. 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)
  29317. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29318. /* "fontTools/misc/bezierTools.py":1040
  29319. *
  29320. *
  29321. * def linePointAtT(pt1, pt2, t): # <<<<<<<<<<<<<<
  29322. * """Finds the point at time `t` on a line.
  29323. *
  29324. */
  29325. __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)
  29326. __Pyx_GOTREF(__pyx_t_2);
  29327. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29328. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29329. #endif
  29330. 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)
  29331. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29332. /* "fontTools/misc/bezierTools.py":1053
  29333. *
  29334. *
  29335. * def quadraticPointAtT(pt1, pt2, pt3, t): # <<<<<<<<<<<<<<
  29336. * """Finds the point at time `t` on a quadratic curve.
  29337. *
  29338. */
  29339. __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)
  29340. __Pyx_GOTREF(__pyx_t_2);
  29341. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29342. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29343. #endif
  29344. 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)
  29345. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29346. /* "fontTools/misc/bezierTools.py":1068
  29347. *
  29348. *
  29349. * def cubicPointAtT(pt1, pt2, pt3, pt4, t): # <<<<<<<<<<<<<<
  29350. * """Finds the point at time `t` on a cubic curve.
  29351. *
  29352. */
  29353. __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)
  29354. __Pyx_GOTREF(__pyx_t_2);
  29355. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29356. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29357. #endif
  29358. 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)
  29359. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29360. /* "fontTools/misc/bezierTools.py":1094
  29361. *
  29362. *
  29363. * @cython.returns(cython.complex) # <<<<<<<<<<<<<<
  29364. * @cython.locals(
  29365. * t=cython.double,
  29366. */
  29367. __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)
  29368. __Pyx_GOTREF(__pyx_t_2);
  29369. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29370. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29371. #endif
  29372. 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)
  29373. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29374. /* "fontTools/misc/bezierTools.py":1119
  29375. *
  29376. *
  29377. * def segmentPointAtT(seg, t): # <<<<<<<<<<<<<<
  29378. * if len(seg) == 2:
  29379. * return linePointAtT(*seg, t)
  29380. */
  29381. __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)
  29382. __Pyx_GOTREF(__pyx_t_2);
  29383. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29384. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29385. #endif
  29386. 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)
  29387. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29388. /* "fontTools/misc/bezierTools.py":1134
  29389. *
  29390. *
  29391. * def _line_t_of_pt(s, e, pt): # <<<<<<<<<<<<<<
  29392. * sx, sy = s
  29393. * ex, ey = e
  29394. */
  29395. __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)
  29396. __Pyx_GOTREF(__pyx_t_2);
  29397. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29398. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29399. #endif
  29400. 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)
  29401. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29402. /* "fontTools/misc/bezierTools.py":1148
  29403. *
  29404. *
  29405. * def _both_points_are_on_same_side_of_origin(a, b, origin): # <<<<<<<<<<<<<<
  29406. * xDiff = (a[0] - origin[0]) * (b[0] - origin[0])
  29407. * yDiff = (a[1] - origin[1]) * (b[1] - origin[1])
  29408. */
  29409. __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)
  29410. __Pyx_GOTREF(__pyx_t_2);
  29411. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29412. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29413. #endif
  29414. 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)
  29415. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29416. /* "fontTools/misc/bezierTools.py":1154
  29417. *
  29418. *
  29419. * def lineLineIntersections(s1, e1, s2, e2): # <<<<<<<<<<<<<<
  29420. * """Finds intersections between two line segments.
  29421. *
  29422. */
  29423. __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)
  29424. __Pyx_GOTREF(__pyx_t_2);
  29425. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29426. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29427. #endif
  29428. 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)
  29429. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29430. /* "fontTools/misc/bezierTools.py":1232
  29431. *
  29432. *
  29433. * def _alignment_transformation(segment): # <<<<<<<<<<<<<<
  29434. * # Returns a transformation which aligns a segment horizontally at the
  29435. * # origin. Apply this transformation to curves and root-find to find
  29436. */
  29437. __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)
  29438. __Pyx_GOTREF(__pyx_t_2);
  29439. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29440. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29441. #endif
  29442. 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)
  29443. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29444. /* "fontTools/misc/bezierTools.py":1242
  29445. *
  29446. *
  29447. * def _curve_line_intersections_t(curve, line): # <<<<<<<<<<<<<<
  29448. * aligned_curve = _alignment_transformation(line).transformPoints(curve)
  29449. * if len(curve) == 3:
  29450. */
  29451. __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)
  29452. __Pyx_GOTREF(__pyx_t_2);
  29453. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29454. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29455. #endif
  29456. 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)
  29457. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29458. /* "fontTools/misc/bezierTools.py":1255
  29459. *
  29460. *
  29461. * def curveLineIntersections(curve, line): # <<<<<<<<<<<<<<
  29462. * """Finds intersections between a curve and a line.
  29463. *
  29464. */
  29465. __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)
  29466. __Pyx_GOTREF(__pyx_t_2);
  29467. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29468. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29469. #endif
  29470. 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)
  29471. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29472. /* "fontTools/misc/bezierTools.py":1293
  29473. *
  29474. *
  29475. * def _curve_bounds(c): # <<<<<<<<<<<<<<
  29476. * if len(c) == 3:
  29477. * return calcQuadraticBounds(*c)
  29478. */
  29479. __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)
  29480. __Pyx_GOTREF(__pyx_t_2);
  29481. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29482. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29483. #endif
  29484. 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)
  29485. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29486. /* "fontTools/misc/bezierTools.py":1301
  29487. *
  29488. *
  29489. * def _split_segment_at_t(c, t): # <<<<<<<<<<<<<<
  29490. * if len(c) == 2:
  29491. * s, e = c
  29492. */
  29493. __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)
  29494. __Pyx_GOTREF(__pyx_t_2);
  29495. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29496. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29497. #endif
  29498. 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)
  29499. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29500. /* "fontTools/misc/bezierTools.py":1313
  29501. *
  29502. *
  29503. * def _curve_curve_intersections_t( # <<<<<<<<<<<<<<
  29504. * curve1, curve2, precision=1e-3, range1=None, range2=None
  29505. * ):
  29506. */
  29507. __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)
  29508. __Pyx_GOTREF(__pyx_t_2);
  29509. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29510. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29511. #endif
  29512. __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_mstate_global->__pyx_tuple[3]);
  29513. 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)
  29514. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29515. /* "fontTools/misc/bezierTools.py":1380
  29516. *
  29517. *
  29518. * def _is_linelike(segment): # <<<<<<<<<<<<<<
  29519. * maybeline = _alignment_transformation(segment).transformPoints(segment)
  29520. * return all(math.isclose(p[1], 0.0) for p in maybeline)
  29521. */
  29522. __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)
  29523. __Pyx_GOTREF(__pyx_t_2);
  29524. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29525. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29526. #endif
  29527. 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)
  29528. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29529. /* "fontTools/misc/bezierTools.py":1385
  29530. *
  29531. *
  29532. * def curveCurveIntersections(curve1, curve2): # <<<<<<<<<<<<<<
  29533. * """Finds intersections between a curve and a curve.
  29534. *
  29535. */
  29536. __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)
  29537. __Pyx_GOTREF(__pyx_t_2);
  29538. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29539. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29540. #endif
  29541. 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)
  29542. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29543. /* "fontTools/misc/bezierTools.py":1427
  29544. *
  29545. *
  29546. * def segmentSegmentIntersections(seg1, seg2): # <<<<<<<<<<<<<<
  29547. * """Finds intersections between two segments.
  29548. *
  29549. */
  29550. __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)
  29551. __Pyx_GOTREF(__pyx_t_2);
  29552. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29553. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29554. #endif
  29555. 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)
  29556. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29557. /* "fontTools/misc/bezierTools.py":1475
  29558. *
  29559. *
  29560. * def _segmentrepr(obj): # <<<<<<<<<<<<<<
  29561. * """
  29562. * >>> _segmentrepr([1, [2, 3], [], [[2, [3, 4], [0.1, 2.2]]]])
  29563. */
  29564. __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)
  29565. __Pyx_GOTREF(__pyx_t_2);
  29566. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29567. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29568. #endif
  29569. 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)
  29570. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29571. /* "fontTools/misc/bezierTools.py":1488
  29572. *
  29573. *
  29574. * def printSegments(segments): # <<<<<<<<<<<<<<
  29575. * """Helper for the doctests, displaying each segment in a list of
  29576. * segments on a single line as a tuple.
  29577. */
  29578. __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)
  29579. __Pyx_GOTREF(__pyx_t_2);
  29580. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030E0000
  29581. PyUnstable_Object_EnableDeferredRefcount(__pyx_t_2);
  29582. #endif
  29583. 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)
  29584. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29585. /* "fontTools/misc/bezierTools.py":1496
  29586. *
  29587. *
  29588. * if __name__ == "__main__": # <<<<<<<<<<<<<<
  29589. * import sys
  29590. * import doctest
  29591. */
  29592. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1496, __pyx_L1_error)
  29593. __Pyx_GOTREF(__pyx_t_2);
  29594. __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)
  29595. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29596. if (__pyx_t_10) {
  29597. /* "fontTools/misc/bezierTools.py":1497
  29598. *
  29599. * if __name__ == "__main__":
  29600. * import sys # <<<<<<<<<<<<<<
  29601. * import doctest
  29602. *
  29603. */
  29604. __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)
  29605. __pyx_t_2 = __pyx_t_6;
  29606. __Pyx_GOTREF(__pyx_t_2);
  29607. 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)
  29608. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29609. /* "fontTools/misc/bezierTools.py":1498
  29610. * if __name__ == "__main__":
  29611. * import sys
  29612. * import doctest # <<<<<<<<<<<<<<
  29613. *
  29614. * sys.exit(doctest.testmod().failed)
  29615. */
  29616. __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)
  29617. __pyx_t_2 = __pyx_t_6;
  29618. __Pyx_GOTREF(__pyx_t_2);
  29619. 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)
  29620. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29621. /* "fontTools/misc/bezierTools.py":1500
  29622. * import doctest
  29623. *
  29624. * sys.exit(doctest.testmod().failed) # <<<<<<<<<<<<<<
  29625. */
  29626. __pyx_t_7 = NULL;
  29627. __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_mstate_global->__pyx_n_u_sys); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1500, __pyx_L1_error)
  29628. __Pyx_GOTREF(__pyx_t_8);
  29629. __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)
  29630. __Pyx_GOTREF(__pyx_t_4);
  29631. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  29632. __pyx_t_11 = NULL;
  29633. __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_mstate_global->__pyx_n_u_doctest); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1500, __pyx_L1_error)
  29634. __Pyx_GOTREF(__pyx_t_12);
  29635. __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)
  29636. __Pyx_GOTREF(__pyx_t_13);
  29637. __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  29638. __pyx_t_9 = 1;
  29639. {
  29640. PyObject *__pyx_callargs[2] = {__pyx_t_11, NULL};
  29641. __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));
  29642. __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
  29643. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  29644. if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1500, __pyx_L1_error)
  29645. __Pyx_GOTREF(__pyx_t_8);
  29646. }
  29647. __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)
  29648. __Pyx_GOTREF(__pyx_t_13);
  29649. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  29650. __pyx_t_9 = 1;
  29651. {
  29652. PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_13};
  29653. __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));
  29654. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  29655. __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  29656. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  29657. if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1500, __pyx_L1_error)
  29658. __Pyx_GOTREF(__pyx_t_2);
  29659. }
  29660. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29661. /* "fontTools/misc/bezierTools.py":1496
  29662. *
  29663. *
  29664. * if __name__ == "__main__": # <<<<<<<<<<<<<<
  29665. * import sys
  29666. * import doctest
  29667. */
  29668. }
  29669. /* "fontTools/misc/bezierTools.py":1
  29670. * # -*- coding: utf-8 -*- # <<<<<<<<<<<<<<
  29671. * """fontTools.misc.bezierTools.py -- tools for working with Bezier path segments.
  29672. * """
  29673. */
  29674. __pyx_t_2 = __Pyx_PyDict_NewPresized(15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  29675. __Pyx_GOTREF(__pyx_t_2);
  29676. 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)
  29677. 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)
  29678. 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)
  29679. 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)
  29680. 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)
  29681. 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)
  29682. 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)
  29683. 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)
  29684. 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)
  29685. 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)
  29686. 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)
  29687. 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)
  29688. 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)
  29689. 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)
  29690. 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)
  29691. 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)
  29692. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  29693. /*--- Wrapped vars code ---*/
  29694. goto __pyx_L0;
  29695. __pyx_L1_error:;
  29696. __Pyx_XDECREF(__pyx_t_2);
  29697. __Pyx_XDECREF(__pyx_t_4);
  29698. __Pyx_XDECREF(__pyx_t_7);
  29699. __Pyx_XDECREF(__pyx_t_8);
  29700. __Pyx_XDECREF(__pyx_t_11);
  29701. __Pyx_XDECREF(__pyx_t_12);
  29702. __Pyx_XDECREF(__pyx_t_13);
  29703. if (__pyx_m) {
  29704. if (__pyx_mstate->__pyx_d && stringtab_initialized) {
  29705. __Pyx_AddTraceback("init fontTools.misc.bezierTools", __pyx_clineno, __pyx_lineno, __pyx_filename);
  29706. }
  29707. #if !CYTHON_USE_MODULE_STATE
  29708. Py_CLEAR(__pyx_m);
  29709. #else
  29710. Py_DECREF(__pyx_m);
  29711. if (pystate_addmodule_run) {
  29712. PyObject *tp, *value, *tb;
  29713. PyErr_Fetch(&tp, &value, &tb);
  29714. PyState_RemoveModule(&__pyx_moduledef);
  29715. PyErr_Restore(tp, value, tb);
  29716. }
  29717. #endif
  29718. } else if (!PyErr_Occurred()) {
  29719. PyErr_SetString(PyExc_ImportError, "init fontTools.misc.bezierTools");
  29720. }
  29721. __pyx_L0:;
  29722. __Pyx_RefNannyFinishContext();
  29723. #if CYTHON_PEP489_MULTI_PHASE_INIT
  29724. return (__pyx_m != NULL) ? 0 : -1;
  29725. #else
  29726. return __pyx_m;
  29727. #endif
  29728. }
  29729. /* #### Code section: pystring_table ### */
  29730. /* #### Code section: cached_builtins ### */
  29731. static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) {
  29732. CYTHON_UNUSED_VAR(__pyx_mstate);
  29733. __pyx_builtin_round = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_round); if (!__pyx_builtin_round) __PYX_ERR(0, 906, __pyx_L1_error)
  29734. __pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_print); if (!__pyx_builtin_print) __PYX_ERR(0, 1493, __pyx_L1_error)
  29735. /* Cached unbound methods */
  29736. __pyx_mstate->__pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type;
  29737. __pyx_mstate->__pyx_umethod_PyDict_Type_items.method_name = &__pyx_mstate->__pyx_n_u_items;
  29738. __pyx_mstate->__pyx_umethod_PyDict_Type_pop.type = (PyObject*)&PyDict_Type;
  29739. __pyx_mstate->__pyx_umethod_PyDict_Type_pop.method_name = &__pyx_mstate->__pyx_n_u_pop;
  29740. __pyx_mstate->__pyx_umethod_PyDict_Type_values.type = (PyObject*)&PyDict_Type;
  29741. __pyx_mstate->__pyx_umethod_PyDict_Type_values.method_name = &__pyx_mstate->__pyx_n_u_values;
  29742. return 0;
  29743. __pyx_L1_error:;
  29744. return -1;
  29745. }
  29746. /* #### Code section: cached_constants ### */
  29747. static int __Pyx_InitCachedConstants(__pyx_mstatetype *__pyx_mstate) {
  29748. __Pyx_RefNannyDeclarations
  29749. CYTHON_UNUSED_VAR(__pyx_mstate);
  29750. __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
  29751. /* "fontTools/misc/bezierTools.py":639
  29752. * # segment should always start at pt1 and the last segment should end at pt4,
  29753. * # so we set those values directly before returning.
  29754. * split[0] = (pt1, *split[0][1:]) # <<<<<<<<<<<<<<
  29755. * split[-1] = (*split[-1][:-1], pt4)
  29756. * return split
  29757. */
  29758. __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)
  29759. __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[0]);
  29760. __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]);
  29761. /* "fontTools/misc/bezierTools.py":640
  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. */
  29768. __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)
  29769. __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[1]);
  29770. __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[1]);
  29771. /* "fontTools/misc/bezierTools.py":711
  29772. * ts = list(ts)
  29773. * segments = []
  29774. * ts.insert(0, 0.0) # <<<<<<<<<<<<<<
  29775. * ts.append(1.0)
  29776. * ax, ay = a
  29777. */
  29778. __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)
  29779. __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]);
  29780. __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]);
  29781. /* "fontTools/misc/bezierTools.py":1320
  29782. *
  29783. * if not range1:
  29784. * range1 = (0.0, 1.0) # <<<<<<<<<<<<<<
  29785. * if not range2:
  29786. * range2 = (0.0, 1.0)
  29787. */
  29788. __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)
  29789. __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]);
  29790. __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]);
  29791. /* "fontTools/misc/bezierTools.py":56
  29792. *
  29793. *
  29794. * def calcCubicArcLength(pt1, pt2, pt3, pt4, tolerance=0.005): # <<<<<<<<<<<<<<
  29795. * """Calculates the arc length for a cubic Bezier segment.
  29796. *
  29797. */
  29798. __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)
  29799. __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]);
  29800. __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]);
  29801. /* "fontTools/misc/bezierTools.py":1313
  29802. *
  29803. *
  29804. * def _curve_curve_intersections_t( # <<<<<<<<<<<<<<
  29805. * curve1, curve2, precision=1e-3, range1=None, range2=None
  29806. * ):
  29807. */
  29808. __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)
  29809. __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]);
  29810. __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]);
  29811. #if CYTHON_IMMORTAL_CONSTANTS
  29812. {
  29813. PyObject **table = __pyx_mstate->__pyx_tuple;
  29814. for (Py_ssize_t i=0; i<4; ++i) {
  29815. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  29816. Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
  29817. #else
  29818. Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
  29819. #endif
  29820. }
  29821. }
  29822. #endif
  29823. #if CYTHON_IMMORTAL_CONSTANTS
  29824. {
  29825. PyObject **table = __pyx_mstate->__pyx_slice;
  29826. for (Py_ssize_t i=0; i<2; ++i) {
  29827. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  29828. Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
  29829. #else
  29830. Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
  29831. #endif
  29832. }
  29833. }
  29834. #endif
  29835. __Pyx_RefNannyFinishContext();
  29836. return 0;
  29837. __pyx_L1_error:;
  29838. __Pyx_RefNannyFinishContext();
  29839. return -1;
  29840. }
  29841. /* #### Code section: init_constants ### */
  29842. static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) {
  29843. CYTHON_UNUSED_VAR(__pyx_mstate);
  29844. {
  29845. 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}};
  29846. #if (CYTHON_COMPRESS_STRINGS) == 2 /* compression: bz2 (6697 bytes) */
  29847. 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";
  29848. PyObject *data = __Pyx_DecompressString(cstring, 6697, 2);
  29849. if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
  29850. const char* const bytes = __Pyx_PyBytes_AsString(data);
  29851. #if !CYTHON_ASSUME_SAFE_MACROS
  29852. if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
  29853. #endif
  29854. #elif (CYTHON_COMPRESS_STRINGS) != 0 /* compression: zlib (6885 bytes) */
  29855. 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";
  29856. PyObject *data = __Pyx_DecompressString(cstring, 6885, 1);
  29857. if (unlikely(!data)) __PYX_ERR(0, 1, __pyx_L1_error)
  29858. const char* const bytes = __Pyx_PyBytes_AsString(data);
  29859. #if !CYTHON_ASSUME_SAFE_MACROS
  29860. if (likely(bytes)); else { Py_DECREF(data); __PYX_ERR(0, 1, __pyx_L1_error) }
  29861. #endif
  29862. #else /* compression: none (22843 bytes) */
  29863. 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";
  29864. PyObject *data = NULL;
  29865. CYTHON_UNUSED_VAR(__Pyx_DecompressString);
  29866. #endif
  29867. PyObject **stringtab = __pyx_mstate->__pyx_string_tab;
  29868. Py_ssize_t pos = 0;
  29869. for (int i = 0; i < 335; i++) {
  29870. Py_ssize_t bytes_length = index[i].length;
  29871. PyObject *string = PyUnicode_DecodeUTF8(bytes + pos, bytes_length, NULL);
  29872. if (likely(string) && i >= 42) PyUnicode_InternInPlace(&string);
  29873. if (unlikely(!string)) {
  29874. Py_XDECREF(data);
  29875. __PYX_ERR(0, 1, __pyx_L1_error)
  29876. }
  29877. stringtab[i] = string;
  29878. pos += bytes_length;
  29879. }
  29880. for (int i = 335; i < 387; i++) {
  29881. Py_ssize_t bytes_length = index[i].length;
  29882. PyObject *string = PyBytes_FromStringAndSize(bytes + pos, bytes_length);
  29883. stringtab[i] = string;
  29884. pos += bytes_length;
  29885. if (unlikely(!string)) {
  29886. Py_XDECREF(data);
  29887. __PYX_ERR(0, 1, __pyx_L1_error)
  29888. }
  29889. }
  29890. Py_XDECREF(data);
  29891. for (Py_ssize_t i = 0; i < 387; i++) {
  29892. if (unlikely(PyObject_Hash(stringtab[i]) == -1)) {
  29893. __PYX_ERR(0, 1, __pyx_L1_error)
  29894. }
  29895. }
  29896. #if CYTHON_IMMORTAL_CONSTANTS
  29897. {
  29898. PyObject **table = stringtab + 335;
  29899. for (Py_ssize_t i=0; i<52; ++i) {
  29900. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  29901. Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
  29902. #else
  29903. Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
  29904. #endif
  29905. }
  29906. }
  29907. #endif
  29908. }
  29909. {
  29910. PyObject **numbertab = __pyx_mstate->__pyx_number_tab;
  29911. 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};
  29912. for (int i = 0; i < 15; i++) {
  29913. numbertab[i] = PyFloat_FromDouble(c_constants[i]);
  29914. if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error)
  29915. }
  29916. }
  29917. {
  29918. PyObject **numbertab = __pyx_mstate->__pyx_number_tab + 15;
  29919. int8_t const cint_constants_1[] = {0,-1,1,2,3,6};
  29920. for (int i = 0; i < 6; i++) {
  29921. numbertab[i] = PyLong_FromLong(cint_constants_1[i - 0]);
  29922. if (unlikely(!numbertab[i])) __PYX_ERR(0, 1, __pyx_L1_error)
  29923. }
  29924. }
  29925. #if CYTHON_IMMORTAL_CONSTANTS
  29926. {
  29927. PyObject **table = __pyx_mstate->__pyx_number_tab;
  29928. for (Py_ssize_t i=0; i<21; ++i) {
  29929. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  29930. Py_SET_REFCNT(table[i], _Py_IMMORTAL_REFCNT_LOCAL);
  29931. #else
  29932. Py_SET_REFCNT(table[i], _Py_IMMORTAL_INITIAL_REFCNT);
  29933. #endif
  29934. }
  29935. }
  29936. #endif
  29937. return 0;
  29938. __pyx_L1_error:;
  29939. return -1;
  29940. }
  29941. /* #### Code section: init_codeobjects ### */
  29942. typedef struct {
  29943. unsigned int argcount : 3;
  29944. unsigned int num_posonly_args : 1;
  29945. unsigned int num_kwonly_args : 1;
  29946. unsigned int nlocals : 6;
  29947. unsigned int flags : 10;
  29948. unsigned int first_line : 11;
  29949. } __Pyx_PyCode_New_function_description;
  29950. /* NewCodeObj.proto */
  29951. static PyObject* __Pyx_PyCode_New(
  29952. const __Pyx_PyCode_New_function_description descr,
  29953. PyObject * const *varnames,
  29954. PyObject *filename,
  29955. PyObject *funcname,
  29956. PyObject *line_table,
  29957. PyObject *tuple_dedup_map
  29958. );
  29959. static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) {
  29960. PyObject* tuple_dedup_map = PyDict_New();
  29961. if (unlikely(!tuple_dedup_map)) return -1;
  29962. {
  29963. const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 546};
  29964. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_t};
  29965. __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;
  29966. }
  29967. {
  29968. const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 583};
  29969. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_t};
  29970. __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;
  29971. }
  29972. {
  29973. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_GENERATOR), 644};
  29974. 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};
  29975. __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;
  29976. }
  29977. {
  29978. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 21, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_GENERATOR), 770};
  29979. 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};
  29980. __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;
  29981. }
  29982. {
  29983. const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1252};
  29984. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_i};
  29985. __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;
  29986. }
  29987. {
  29988. const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1329};
  29989. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_r};
  29990. __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;
  29991. }
  29992. {
  29993. const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1366};
  29994. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_ts};
  29995. __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;
  29996. }
  29997. {
  29998. const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1382};
  29999. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_p};
  30000. __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;
  30001. }
  30002. {
  30003. const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1485};
  30004. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_x};
  30005. __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;
  30006. }
  30007. {
  30008. const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 56};
  30009. 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};
  30010. __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;
  30011. }
  30012. {
  30013. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 75};
  30014. 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};
  30015. __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;
  30016. }
  30017. {
  30018. const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 84};
  30019. 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};
  30020. __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;
  30021. }
  30022. {
  30023. const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 104};
  30024. 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};
  30025. __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;
  30026. }
  30027. {
  30028. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 151};
  30029. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3};
  30030. __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;
  30031. }
  30032. {
  30033. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 14, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 186};
  30034. 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};
  30035. __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;
  30036. }
  30037. {
  30038. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 237};
  30039. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_pt3};
  30040. __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;
  30041. }
  30042. {
  30043. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 254};
  30044. 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};
  30045. __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;
  30046. }
  30047. {
  30048. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 14, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 298};
  30049. 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};
  30050. __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;
  30051. }
  30052. {
  30053. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 332};
  30054. 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};
  30055. __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;
  30056. }
  30057. {
  30058. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 362};
  30059. 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};
  30060. __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;
  30061. }
  30062. {
  30063. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 23, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 412};
  30064. 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};
  30065. __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;
  30066. }
  30067. {
  30068. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 15, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 450};
  30069. 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};
  30070. __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;
  30071. }
  30072. {
  30073. const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 11, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 507};
  30074. 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};
  30075. __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;
  30076. }
  30077. {
  30078. const __Pyx_PyCode_New_function_description descr = {6, 0, 0, 13, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 552};
  30079. 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};
  30080. __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;
  30081. }
  30082. {
  30083. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 589};
  30084. 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};
  30085. __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;
  30086. }
  30087. {
  30088. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 613};
  30089. 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};
  30090. __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;
  30091. }
  30092. {
  30093. const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 12, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 668};
  30094. 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};
  30095. __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;
  30096. }
  30097. {
  30098. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 26, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 708};
  30099. 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};
  30100. __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;
  30101. }
  30102. {
  30103. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 34, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 735};
  30104. 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};
  30105. __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;
  30106. }
  30107. {
  30108. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 815};
  30109. 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};
  30110. __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;
  30111. }
  30112. {
  30113. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 19, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 848};
  30114. 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};
  30115. __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;
  30116. }
  30117. {
  30118. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 13, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 945};
  30119. 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};
  30120. __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;
  30121. }
  30122. {
  30123. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 18, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 956};
  30124. 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};
  30125. __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;
  30126. }
  30127. {
  30128. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 15, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 988};
  30129. 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};
  30130. __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;
  30131. }
  30132. {
  30133. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 20, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1001};
  30134. 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};
  30135. __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;
  30136. }
  30137. {
  30138. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1040};
  30139. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pt1, __pyx_mstate->__pyx_n_u_pt2, __pyx_mstate->__pyx_n_u_t};
  30140. __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;
  30141. }
  30142. {
  30143. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1053};
  30144. 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};
  30145. __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;
  30146. }
  30147. {
  30148. const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1068};
  30149. 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};
  30150. __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;
  30151. }
  30152. {
  30153. const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1094};
  30154. 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};
  30155. __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;
  30156. }
  30157. {
  30158. const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1119};
  30159. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_seg, __pyx_mstate->__pyx_n_u_t};
  30160. __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;
  30161. }
  30162. {
  30163. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1134};
  30164. 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};
  30165. __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;
  30166. }
  30167. {
  30168. const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1148};
  30169. 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};
  30170. __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;
  30171. }
  30172. {
  30173. const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 17, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1154};
  30174. 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};
  30175. __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;
  30176. }
  30177. {
  30178. const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1232};
  30179. 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};
  30180. __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;
  30181. }
  30182. {
  30183. const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1242};
  30184. 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};
  30185. __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;
  30186. }
  30187. {
  30188. const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1255};
  30189. 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};
  30190. __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;
  30191. }
  30192. {
  30193. const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1293};
  30194. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_c};
  30195. __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;
  30196. }
  30197. {
  30198. const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1301};
  30199. 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};
  30200. __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;
  30201. }
  30202. {
  30203. const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 25, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1313};
  30204. 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};
  30205. __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;
  30206. }
  30207. {
  30208. const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1380};
  30209. 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};
  30210. __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;
  30211. }
  30212. {
  30213. const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1385};
  30214. 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};
  30215. __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;
  30216. }
  30217. {
  30218. const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1427};
  30219. 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};
  30220. __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;
  30221. }
  30222. {
  30223. const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1475};
  30224. 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};
  30225. __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;
  30226. }
  30227. {
  30228. const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1488};
  30229. PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_segments, __pyx_mstate->__pyx_n_u_segment};
  30230. __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;
  30231. }
  30232. Py_DECREF(tuple_dedup_map);
  30233. return 0;
  30234. bad:
  30235. Py_DECREF(tuple_dedup_map);
  30236. return -1;
  30237. }
  30238. /* #### Code section: init_globals ### */
  30239. static int __Pyx_InitGlobals(void) {
  30240. /* PythonCompatibility.init */
  30241. if (likely(__Pyx_init_co_variables() == 0)); else
  30242. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  30243. /* CommonTypesMetaclass.init */
  30244. if (likely(__pyx_CommonTypesMetaclass_init(__pyx_m) == 0)); else
  30245. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  30246. /* Generator.init */
  30247. if (likely(__pyx_Generator_init(__pyx_m) == 0)); else
  30248. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  30249. /* CachedMethodType.init */
  30250. #if CYTHON_COMPILING_IN_LIMITED_API
  30251. {
  30252. PyObject *typesModule=NULL;
  30253. typesModule = PyImport_ImportModule("types");
  30254. if (typesModule) {
  30255. __pyx_mstate_global->__Pyx_CachedMethodType = PyObject_GetAttrString(typesModule, "MethodType");
  30256. Py_DECREF(typesModule);
  30257. }
  30258. } // error handling follows
  30259. #endif
  30260. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  30261. /* CythonFunctionShared.init */
  30262. if (likely(__pyx_CyFunction_init(__pyx_m) == 0)); else
  30263. if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
  30264. return 0;
  30265. __pyx_L1_error:;
  30266. return -1;
  30267. }
  30268. /* #### Code section: cleanup_globals ### */
  30269. /* #### Code section: cleanup_module ### */
  30270. /* #### Code section: main_method ### */
  30271. /* #### Code section: utility_code_pragmas ### */
  30272. #ifdef _MSC_VER
  30273. #pragma warning( push )
  30274. /* Warning 4127: conditional expression is constant
  30275. * Cython uses constant conditional expressions to allow in inline functions to be optimized at
  30276. * compile-time, so this warning is not useful
  30277. */
  30278. #pragma warning( disable : 4127 )
  30279. #endif
  30280. /* #### Code section: utility_code_def ### */
  30281. /* --- Runtime support code --- */
  30282. /* Refnanny */
  30283. #if CYTHON_REFNANNY
  30284. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
  30285. PyObject *m = NULL, *p = NULL;
  30286. void *r = NULL;
  30287. m = PyImport_ImportModule(modname);
  30288. if (!m) goto end;
  30289. p = PyObject_GetAttrString(m, "RefNannyAPI");
  30290. if (!p) goto end;
  30291. r = PyLong_AsVoidPtr(p);
  30292. end:
  30293. Py_XDECREF(p);
  30294. Py_XDECREF(m);
  30295. return (__Pyx_RefNannyAPIStruct *)r;
  30296. }
  30297. #endif
  30298. /* PyErrExceptionMatches (used by PyObjectGetAttrStrNoError) */
  30299. #if CYTHON_FAST_THREAD_STATE
  30300. static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  30301. Py_ssize_t i, n;
  30302. n = PyTuple_GET_SIZE(tuple);
  30303. for (i=0; i<n; i++) {
  30304. if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  30305. }
  30306. for (i=0; i<n; i++) {
  30307. if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
  30308. }
  30309. return 0;
  30310. }
  30311. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
  30312. int result;
  30313. PyObject *exc_type;
  30314. #if PY_VERSION_HEX >= 0x030C00A6
  30315. PyObject *current_exception = tstate->current_exception;
  30316. if (unlikely(!current_exception)) return 0;
  30317. exc_type = (PyObject*) Py_TYPE(current_exception);
  30318. if (exc_type == err) return 1;
  30319. #else
  30320. exc_type = tstate->curexc_type;
  30321. if (exc_type == err) return 1;
  30322. if (unlikely(!exc_type)) return 0;
  30323. #endif
  30324. #if CYTHON_AVOID_BORROWED_REFS
  30325. Py_INCREF(exc_type);
  30326. #endif
  30327. if (unlikely(PyTuple_Check(err))) {
  30328. result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
  30329. } else {
  30330. result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
  30331. }
  30332. #if CYTHON_AVOID_BORROWED_REFS
  30333. Py_DECREF(exc_type);
  30334. #endif
  30335. return result;
  30336. }
  30337. #endif
  30338. /* PyErrFetchRestore (used by PyObjectGetAttrStrNoError) */
  30339. #if CYTHON_FAST_THREAD_STATE
  30340. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  30341. #if PY_VERSION_HEX >= 0x030C00A6
  30342. PyObject *tmp_value;
  30343. assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value)));
  30344. if (value) {
  30345. #if CYTHON_COMPILING_IN_CPYTHON
  30346. if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
  30347. #endif
  30348. PyException_SetTraceback(value, tb);
  30349. }
  30350. tmp_value = tstate->current_exception;
  30351. tstate->current_exception = value;
  30352. Py_XDECREF(tmp_value);
  30353. Py_XDECREF(type);
  30354. Py_XDECREF(tb);
  30355. #else
  30356. PyObject *tmp_type, *tmp_value, *tmp_tb;
  30357. tmp_type = tstate->curexc_type;
  30358. tmp_value = tstate->curexc_value;
  30359. tmp_tb = tstate->curexc_traceback;
  30360. tstate->curexc_type = type;
  30361. tstate->curexc_value = value;
  30362. tstate->curexc_traceback = tb;
  30363. Py_XDECREF(tmp_type);
  30364. Py_XDECREF(tmp_value);
  30365. Py_XDECREF(tmp_tb);
  30366. #endif
  30367. }
  30368. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  30369. #if PY_VERSION_HEX >= 0x030C00A6
  30370. PyObject* exc_value;
  30371. exc_value = tstate->current_exception;
  30372. tstate->current_exception = 0;
  30373. *value = exc_value;
  30374. *type = NULL;
  30375. *tb = NULL;
  30376. if (exc_value) {
  30377. *type = (PyObject*) Py_TYPE(exc_value);
  30378. Py_INCREF(*type);
  30379. #if CYTHON_COMPILING_IN_CPYTHON
  30380. *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
  30381. Py_XINCREF(*tb);
  30382. #else
  30383. *tb = PyException_GetTraceback(exc_value);
  30384. #endif
  30385. }
  30386. #else
  30387. *type = tstate->curexc_type;
  30388. *value = tstate->curexc_value;
  30389. *tb = tstate->curexc_traceback;
  30390. tstate->curexc_type = 0;
  30391. tstate->curexc_value = 0;
  30392. tstate->curexc_traceback = 0;
  30393. #endif
  30394. }
  30395. #endif
  30396. /* PyObjectGetAttrStr (used by PyObjectGetAttrStrNoError) */
  30397. #if CYTHON_USE_TYPE_SLOTS
  30398. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
  30399. PyTypeObject* tp = Py_TYPE(obj);
  30400. if (likely(tp->tp_getattro))
  30401. return tp->tp_getattro(obj, attr_name);
  30402. return PyObject_GetAttr(obj, attr_name);
  30403. }
  30404. #endif
  30405. /* PyObjectGetAttrStrNoError (used by GetBuiltinName) */
  30406. #if __PYX_LIMITED_VERSION_HEX < 0x030d0000
  30407. static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
  30408. __Pyx_PyThreadState_declare
  30409. __Pyx_PyThreadState_assign
  30410. if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
  30411. __Pyx_PyErr_Clear();
  30412. }
  30413. #endif
  30414. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
  30415. PyObject *result;
  30416. #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  30417. (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
  30418. return result;
  30419. #else
  30420. #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS
  30421. PyTypeObject* tp = Py_TYPE(obj);
  30422. if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
  30423. return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
  30424. }
  30425. #endif
  30426. result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
  30427. if (unlikely(!result)) {
  30428. __Pyx_PyObject_GetAttrStr_ClearAttributeError();
  30429. }
  30430. return result;
  30431. #endif
  30432. }
  30433. /* GetBuiltinName */
  30434. static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
  30435. PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_b, name);
  30436. if (unlikely(!result) && !PyErr_Occurred()) {
  30437. PyErr_Format(PyExc_NameError,
  30438. "name '%U' is not defined", name);
  30439. }
  30440. return result;
  30441. }
  30442. /* TupleAndListFromArray (used by fastcall) */
  30443. #if !CYTHON_COMPILING_IN_CPYTHON && CYTHON_METH_FASTCALL
  30444. static CYTHON_INLINE PyObject *
  30445. __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
  30446. {
  30447. PyObject *res;
  30448. Py_ssize_t i;
  30449. if (n <= 0) {
  30450. return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple);
  30451. }
  30452. res = PyTuple_New(n);
  30453. if (unlikely(res == NULL)) return NULL;
  30454. for (i = 0; i < n; i++) {
  30455. if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < (0))) {
  30456. Py_DECREF(res);
  30457. return NULL;
  30458. }
  30459. Py_INCREF(src[i]);
  30460. }
  30461. return res;
  30462. }
  30463. #elif CYTHON_COMPILING_IN_CPYTHON
  30464. static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
  30465. PyObject *v;
  30466. Py_ssize_t i;
  30467. for (i = 0; i < length; i++) {
  30468. v = dest[i] = src[i];
  30469. Py_INCREF(v);
  30470. }
  30471. }
  30472. static CYTHON_INLINE PyObject *
  30473. __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
  30474. {
  30475. PyObject *res;
  30476. if (n <= 0) {
  30477. return __Pyx_NewRef(__pyx_mstate_global->__pyx_empty_tuple);
  30478. }
  30479. res = PyTuple_New(n);
  30480. if (unlikely(res == NULL)) return NULL;
  30481. __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n);
  30482. return res;
  30483. }
  30484. static CYTHON_INLINE PyObject *
  30485. __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n)
  30486. {
  30487. PyObject *res;
  30488. if (n <= 0) {
  30489. return PyList_New(0);
  30490. }
  30491. res = PyList_New(n);
  30492. if (unlikely(res == NULL)) return NULL;
  30493. __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n);
  30494. return res;
  30495. }
  30496. #endif
  30497. /* BytesEquals (used by UnicodeEquals) */
  30498. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
  30499. #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL ||\
  30500. !(CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS)
  30501. return PyObject_RichCompareBool(s1, s2, equals);
  30502. #else
  30503. if (s1 == s2) {
  30504. return (equals == Py_EQ);
  30505. } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
  30506. const char *ps1, *ps2;
  30507. Py_ssize_t length = PyBytes_GET_SIZE(s1);
  30508. if (length != PyBytes_GET_SIZE(s2))
  30509. return (equals == Py_NE);
  30510. ps1 = PyBytes_AS_STRING(s1);
  30511. ps2 = PyBytes_AS_STRING(s2);
  30512. if (ps1[0] != ps2[0]) {
  30513. return (equals == Py_NE);
  30514. } else if (length == 1) {
  30515. return (equals == Py_EQ);
  30516. } else {
  30517. int result;
  30518. #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
  30519. Py_hash_t hash1, hash2;
  30520. hash1 = ((PyBytesObject*)s1)->ob_shash;
  30521. hash2 = ((PyBytesObject*)s2)->ob_shash;
  30522. if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
  30523. return (equals == Py_NE);
  30524. }
  30525. #endif
  30526. result = memcmp(ps1, ps2, (size_t)length);
  30527. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  30528. }
  30529. } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
  30530. return (equals == Py_NE);
  30531. } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
  30532. return (equals == Py_NE);
  30533. } else {
  30534. int result;
  30535. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  30536. if (!py_result)
  30537. return -1;
  30538. result = __Pyx_PyObject_IsTrue(py_result);
  30539. Py_DECREF(py_result);
  30540. return result;
  30541. }
  30542. #endif
  30543. }
  30544. /* UnicodeEquals (used by fastcall) */
  30545. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
  30546. #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL
  30547. return PyObject_RichCompareBool(s1, s2, equals);
  30548. #else
  30549. int s1_is_unicode, s2_is_unicode;
  30550. if (s1 == s2) {
  30551. goto return_eq;
  30552. }
  30553. s1_is_unicode = PyUnicode_CheckExact(s1);
  30554. s2_is_unicode = PyUnicode_CheckExact(s2);
  30555. if (s1_is_unicode & s2_is_unicode) {
  30556. Py_ssize_t length, length2;
  30557. int kind;
  30558. void *data1, *data2;
  30559. #if !CYTHON_COMPILING_IN_LIMITED_API
  30560. if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
  30561. return -1;
  30562. #endif
  30563. length = __Pyx_PyUnicode_GET_LENGTH(s1);
  30564. #if !CYTHON_ASSUME_SAFE_SIZE
  30565. if (unlikely(length < 0)) return -1;
  30566. #endif
  30567. length2 = __Pyx_PyUnicode_GET_LENGTH(s2);
  30568. #if !CYTHON_ASSUME_SAFE_SIZE
  30569. if (unlikely(length2 < 0)) return -1;
  30570. #endif
  30571. if (length != length2) {
  30572. goto return_ne;
  30573. }
  30574. #if CYTHON_USE_UNICODE_INTERNALS
  30575. {
  30576. Py_hash_t hash1, hash2;
  30577. hash1 = ((PyASCIIObject*)s1)->hash;
  30578. hash2 = ((PyASCIIObject*)s2)->hash;
  30579. if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
  30580. goto return_ne;
  30581. }
  30582. }
  30583. #endif
  30584. kind = __Pyx_PyUnicode_KIND(s1);
  30585. if (kind != __Pyx_PyUnicode_KIND(s2)) {
  30586. goto return_ne;
  30587. }
  30588. data1 = __Pyx_PyUnicode_DATA(s1);
  30589. data2 = __Pyx_PyUnicode_DATA(s2);
  30590. if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
  30591. goto return_ne;
  30592. } else if (length == 1) {
  30593. goto return_eq;
  30594. } else {
  30595. int result = memcmp(data1, data2, (size_t)(length * kind));
  30596. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  30597. }
  30598. } else if ((s1 == Py_None) & s2_is_unicode) {
  30599. goto return_ne;
  30600. } else if ((s2 == Py_None) & s1_is_unicode) {
  30601. goto return_ne;
  30602. } else {
  30603. int result;
  30604. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  30605. if (!py_result)
  30606. return -1;
  30607. result = __Pyx_PyObject_IsTrue(py_result);
  30608. Py_DECREF(py_result);
  30609. return result;
  30610. }
  30611. return_eq:
  30612. return (equals == Py_EQ);
  30613. return_ne:
  30614. return (equals == Py_NE);
  30615. #endif
  30616. }
  30617. /* fastcall */
  30618. #if CYTHON_METH_FASTCALL
  30619. static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s)
  30620. {
  30621. Py_ssize_t i, n = __Pyx_PyTuple_GET_SIZE(kwnames);
  30622. #if !CYTHON_ASSUME_SAFE_SIZE
  30623. if (unlikely(n == -1)) return NULL;
  30624. #endif
  30625. for (i = 0; i < n; i++)
  30626. {
  30627. PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i);
  30628. #if !CYTHON_ASSUME_SAFE_MACROS
  30629. if (unlikely(!namei)) return NULL;
  30630. #endif
  30631. if (s == namei) return kwvalues[i];
  30632. }
  30633. for (i = 0; i < n; i++)
  30634. {
  30635. PyObject *namei = __Pyx_PyTuple_GET_ITEM(kwnames, i);
  30636. #if !CYTHON_ASSUME_SAFE_MACROS
  30637. if (unlikely(!namei)) return NULL;
  30638. #endif
  30639. int eq = __Pyx_PyUnicode_Equals(s, namei, Py_EQ);
  30640. if (unlikely(eq != 0)) {
  30641. if (unlikely(eq < 0)) return NULL;
  30642. return kwvalues[i];
  30643. }
  30644. }
  30645. return NULL;
  30646. }
  30647. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000 || CYTHON_COMPILING_IN_LIMITED_API
  30648. CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) {
  30649. Py_ssize_t i, nkwargs;
  30650. PyObject *dict;
  30651. #if !CYTHON_ASSUME_SAFE_SIZE
  30652. nkwargs = PyTuple_Size(kwnames);
  30653. if (unlikely(nkwargs < 0)) return NULL;
  30654. #else
  30655. nkwargs = PyTuple_GET_SIZE(kwnames);
  30656. #endif
  30657. dict = PyDict_New();
  30658. if (unlikely(!dict))
  30659. return NULL;
  30660. for (i=0; i<nkwargs; i++) {
  30661. #if !CYTHON_ASSUME_SAFE_MACROS
  30662. PyObject *key = PyTuple_GetItem(kwnames, i);
  30663. if (!key) goto bad;
  30664. #else
  30665. PyObject *key = PyTuple_GET_ITEM(kwnames, i);
  30666. #endif
  30667. if (unlikely(PyDict_SetItem(dict, key, kwvalues[i]) < 0))
  30668. goto bad;
  30669. }
  30670. return dict;
  30671. bad:
  30672. Py_DECREF(dict);
  30673. return NULL;
  30674. }
  30675. #endif
  30676. #endif
  30677. /* PyObjectCall (used by PyObjectFastCall) */
  30678. #if CYTHON_COMPILING_IN_CPYTHON
  30679. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  30680. PyObject *result;
  30681. ternaryfunc call = Py_TYPE(func)->tp_call;
  30682. if (unlikely(!call))
  30683. return PyObject_Call(func, arg, kw);
  30684. if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
  30685. return NULL;
  30686. result = (*call)(func, arg, kw);
  30687. Py_LeaveRecursiveCall();
  30688. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  30689. PyErr_SetString(
  30690. PyExc_SystemError,
  30691. "NULL result without error in PyObject_Call");
  30692. }
  30693. return result;
  30694. }
  30695. #endif
  30696. /* PyObjectCallMethO (used by PyObjectFastCall) */
  30697. #if CYTHON_COMPILING_IN_CPYTHON
  30698. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
  30699. PyObject *self, *result;
  30700. PyCFunction cfunc;
  30701. cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func);
  30702. self = __Pyx_CyOrPyCFunction_GET_SELF(func);
  30703. if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
  30704. return NULL;
  30705. result = cfunc(self, arg);
  30706. Py_LeaveRecursiveCall();
  30707. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  30708. PyErr_SetString(
  30709. PyExc_SystemError,
  30710. "NULL result without error in PyObject_Call");
  30711. }
  30712. return result;
  30713. }
  30714. #endif
  30715. /* PyObjectFastCall (used by PyObjectCallOneArg) */
  30716. #if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API
  30717. static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject * const*args, size_t nargs, PyObject *kwargs) {
  30718. PyObject *argstuple;
  30719. PyObject *result = 0;
  30720. size_t i;
  30721. argstuple = PyTuple_New((Py_ssize_t)nargs);
  30722. if (unlikely(!argstuple)) return NULL;
  30723. for (i = 0; i < nargs; i++) {
  30724. Py_INCREF(args[i]);
  30725. if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) != (0)) goto bad;
  30726. }
  30727. result = __Pyx_PyObject_Call(func, argstuple, kwargs);
  30728. bad:
  30729. Py_DECREF(argstuple);
  30730. return result;
  30731. }
  30732. #endif
  30733. #if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API
  30734. #if PY_VERSION_HEX < 0x03090000
  30735. #define __Pyx_PyVectorcall_Function(callable) _PyVectorcall_Function(callable)
  30736. #elif CYTHON_COMPILING_IN_CPYTHON
  30737. static CYTHON_INLINE vectorcallfunc __Pyx_PyVectorcall_Function(PyObject *callable) {
  30738. PyTypeObject *tp = Py_TYPE(callable);
  30739. #if defined(__Pyx_CyFunction_USED)
  30740. if (__Pyx_CyFunction_CheckExact(callable)) {
  30741. return __Pyx_CyFunction_func_vectorcall(callable);
  30742. }
  30743. #endif
  30744. if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_VECTORCALL)) {
  30745. return NULL;
  30746. }
  30747. assert(PyCallable_Check(callable));
  30748. Py_ssize_t offset = tp->tp_vectorcall_offset;
  30749. assert(offset > 0);
  30750. vectorcallfunc ptr;
  30751. memcpy(&ptr, (char *) callable + offset, sizeof(ptr));
  30752. return ptr;
  30753. }
  30754. #else
  30755. #define __Pyx_PyVectorcall_Function(callable) PyVectorcall_Function(callable)
  30756. #endif
  30757. #endif
  30758. static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject *const *args, size_t _nargs, PyObject *kwargs) {
  30759. Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
  30760. #if CYTHON_COMPILING_IN_CPYTHON
  30761. if (nargs == 0 && kwargs == NULL) {
  30762. if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS))
  30763. return __Pyx_PyObject_CallMethO(func, NULL);
  30764. }
  30765. else if (nargs == 1 && kwargs == NULL) {
  30766. if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O))
  30767. return __Pyx_PyObject_CallMethO(func, args[0]);
  30768. }
  30769. #endif
  30770. if (kwargs == NULL) {
  30771. #if CYTHON_VECTORCALL
  30772. #if CYTHON_COMPILING_IN_LIMITED_API
  30773. return PyObject_Vectorcall(func, args, _nargs, NULL);
  30774. #else
  30775. vectorcallfunc f = __Pyx_PyVectorcall_Function(func);
  30776. if (f) {
  30777. return f(func, args, _nargs, NULL);
  30778. }
  30779. #endif
  30780. #endif
  30781. }
  30782. if (nargs == 0) {
  30783. return __Pyx_PyObject_Call(func, __pyx_mstate_global->__pyx_empty_tuple, kwargs);
  30784. }
  30785. #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API
  30786. return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs);
  30787. #else
  30788. return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
  30789. #endif
  30790. }
  30791. /* PyObjectCallOneArg (used by CallUnboundCMethod0) */
  30792. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  30793. PyObject *args[2] = {NULL, arg};
  30794. return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  30795. }
  30796. /* UnpackUnboundCMethod (used by CallUnboundCMethod0) */
  30797. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000
  30798. static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *kwargs) {
  30799. PyObject *result;
  30800. PyObject *selfless_args = PyTuple_GetSlice(args, 1, PyTuple_Size(args));
  30801. if (unlikely(!selfless_args)) return NULL;
  30802. result = PyObject_Call(method, selfless_args, kwargs);
  30803. Py_DECREF(selfless_args);
  30804. return result;
  30805. }
  30806. #elif CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03090000
  30807. static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) {
  30808. return _PyObject_Vectorcall
  30809. (method, args ? args+1 : NULL, nargs ? nargs-1 : 0, kwnames);
  30810. }
  30811. #else
  30812. static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) {
  30813. return
  30814. #if PY_VERSION_HEX < 0x03090000
  30815. _PyObject_Vectorcall
  30816. #else
  30817. PyObject_Vectorcall
  30818. #endif
  30819. (method, args ? args+1 : NULL, nargs ? (size_t) nargs-1 : 0, kwnames);
  30820. }
  30821. #endif
  30822. static PyMethodDef __Pyx_UnboundCMethod_Def = {
  30823. "CythonUnboundCMethod",
  30824. __PYX_REINTERPRET_FUNCION(PyCFunction, __Pyx_SelflessCall),
  30825. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030C0000
  30826. METH_VARARGS | METH_KEYWORDS,
  30827. #else
  30828. METH_FASTCALL | METH_KEYWORDS,
  30829. #endif
  30830. NULL
  30831. };
  30832. static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
  30833. PyObject *method, *result=NULL;
  30834. method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
  30835. if (unlikely(!method))
  30836. return -1;
  30837. result = method;
  30838. #if CYTHON_COMPILING_IN_CPYTHON
  30839. if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
  30840. {
  30841. PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
  30842. target->func = descr->d_method->ml_meth;
  30843. target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
  30844. } else
  30845. #endif
  30846. #if CYTHON_COMPILING_IN_PYPY
  30847. #else
  30848. if (PyCFunction_Check(method))
  30849. #endif
  30850. {
  30851. PyObject *self;
  30852. int self_found;
  30853. #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
  30854. self = PyObject_GetAttrString(method, "__self__");
  30855. if (!self) {
  30856. PyErr_Clear();
  30857. }
  30858. #else
  30859. self = PyCFunction_GET_SELF(method);
  30860. #endif
  30861. self_found = (self && self != Py_None);
  30862. #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
  30863. Py_XDECREF(self);
  30864. #endif
  30865. if (self_found) {
  30866. PyObject *unbound_method = PyCFunction_New(&__Pyx_UnboundCMethod_Def, method);
  30867. if (unlikely(!unbound_method)) return -1;
  30868. Py_DECREF(method);
  30869. result = unbound_method;
  30870. }
  30871. }
  30872. #if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  30873. if (unlikely(target->method)) {
  30874. Py_DECREF(result);
  30875. } else
  30876. #endif
  30877. target->method = result;
  30878. return 0;
  30879. }
  30880. /* CallUnboundCMethod0 */
  30881. #if CYTHON_COMPILING_IN_CPYTHON
  30882. static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
  30883. int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
  30884. if (likely(was_initialized == 2 && cfunc->func)) {
  30885. if (likely(cfunc->flag == METH_NOARGS))
  30886. return __Pyx_CallCFunction(cfunc, self, NULL);
  30887. if (likely(cfunc->flag == METH_FASTCALL))
  30888. return __Pyx_CallCFunctionFast(cfunc, self, NULL, 0);
  30889. if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
  30890. return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, NULL, 0, NULL);
  30891. if (likely(cfunc->flag == (METH_VARARGS | METH_KEYWORDS)))
  30892. return __Pyx_CallCFunctionWithKeywords(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  30893. if (cfunc->flag == METH_VARARGS)
  30894. return __Pyx_CallCFunction(cfunc, self, __pyx_mstate_global->__pyx_empty_tuple);
  30895. return __Pyx__CallUnboundCMethod0(cfunc, self);
  30896. }
  30897. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  30898. else if (unlikely(was_initialized == 1)) {
  30899. __Pyx_CachedCFunction tmp_cfunc = {
  30900. #ifndef __cplusplus
  30901. 0
  30902. #endif
  30903. };
  30904. tmp_cfunc.type = cfunc->type;
  30905. tmp_cfunc.method_name = cfunc->method_name;
  30906. return __Pyx__CallUnboundCMethod0(&tmp_cfunc, self);
  30907. }
  30908. #endif
  30909. PyObject *result = __Pyx__CallUnboundCMethod0(cfunc, self);
  30910. __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
  30911. return result;
  30912. }
  30913. #endif
  30914. static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
  30915. PyObject *result;
  30916. if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
  30917. result = __Pyx_PyObject_CallOneArg(cfunc->method, self);
  30918. return result;
  30919. }
  30920. /* py_dict_items (used by OwnedDictNext) */
  30921. static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
  30922. return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_items, d);
  30923. }
  30924. /* py_dict_values (used by OwnedDictNext) */
  30925. static CYTHON_INLINE PyObject* __Pyx_PyDict_Values(PyObject* d) {
  30926. return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_values, d);
  30927. }
  30928. /* OwnedDictNext (used by ParseKeywordsImpl) */
  30929. #if CYTHON_AVOID_BORROWED_REFS
  30930. static int __Pyx_PyDict_NextRef(PyObject *p, PyObject **ppos, PyObject **pkey, PyObject **pvalue) {
  30931. PyObject *next = NULL;
  30932. if (!*ppos) {
  30933. if (pvalue) {
  30934. PyObject *dictview = pkey ? __Pyx_PyDict_Items(p) : __Pyx_PyDict_Values(p);
  30935. if (unlikely(!dictview)) goto bad;
  30936. *ppos = PyObject_GetIter(dictview);
  30937. Py_DECREF(dictview);
  30938. } else {
  30939. *ppos = PyObject_GetIter(p);
  30940. }
  30941. if (unlikely(!*ppos)) goto bad;
  30942. }
  30943. next = PyIter_Next(*ppos);
  30944. if (!next) {
  30945. if (PyErr_Occurred()) goto bad;
  30946. return 0;
  30947. }
  30948. if (pkey && pvalue) {
  30949. *pkey = __Pyx_PySequence_ITEM(next, 0);
  30950. if (unlikely(*pkey)) goto bad;
  30951. *pvalue = __Pyx_PySequence_ITEM(next, 1);
  30952. if (unlikely(*pvalue)) goto bad;
  30953. Py_DECREF(next);
  30954. } else if (pkey) {
  30955. *pkey = next;
  30956. } else {
  30957. assert(pvalue);
  30958. *pvalue = next;
  30959. }
  30960. return 1;
  30961. bad:
  30962. Py_XDECREF(next);
  30963. #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000
  30964. PyErr_FormatUnraisable("Exception ignored in __Pyx_PyDict_NextRef");
  30965. #else
  30966. PyErr_WriteUnraisable(__pyx_mstate_global->__pyx_n_u_Pyx_PyDict_NextRef);
  30967. #endif
  30968. if (pkey) *pkey = NULL;
  30969. if (pvalue) *pvalue = NULL;
  30970. return 0;
  30971. }
  30972. #else // !CYTHON_AVOID_BORROWED_REFS
  30973. static int __Pyx_PyDict_NextRef(PyObject *p, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) {
  30974. int result = PyDict_Next(p, ppos, pkey, pvalue);
  30975. if (likely(result == 1)) {
  30976. if (pkey) Py_INCREF(*pkey);
  30977. if (pvalue) Py_INCREF(*pvalue);
  30978. }
  30979. return result;
  30980. }
  30981. #endif
  30982. /* RaiseDoubleKeywords (used by ParseKeywordsImpl) */
  30983. static void __Pyx_RaiseDoubleKeywordsError(
  30984. const char* func_name,
  30985. PyObject* kw_name)
  30986. {
  30987. PyErr_Format(PyExc_TypeError,
  30988. "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
  30989. }
  30990. /* CallUnboundCMethod2 */
  30991. #if CYTHON_COMPILING_IN_CPYTHON
  30992. static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
  30993. int was_initialized = __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
  30994. if (likely(was_initialized == 2 && cfunc->func)) {
  30995. PyObject *args[2] = {arg1, arg2};
  30996. if (cfunc->flag == METH_FASTCALL) {
  30997. return __Pyx_CallCFunctionFast(cfunc, self, args, 2);
  30998. }
  30999. if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
  31000. return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, args, 2, NULL);
  31001. }
  31002. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  31003. else if (unlikely(was_initialized == 1)) {
  31004. __Pyx_CachedCFunction tmp_cfunc = {
  31005. #ifndef __cplusplus
  31006. 0
  31007. #endif
  31008. };
  31009. tmp_cfunc.type = cfunc->type;
  31010. tmp_cfunc.method_name = cfunc->method_name;
  31011. return __Pyx__CallUnboundCMethod2(&tmp_cfunc, self, arg1, arg2);
  31012. }
  31013. #endif
  31014. PyObject *result = __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
  31015. __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
  31016. return result;
  31017. }
  31018. #endif
  31019. static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
  31020. if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
  31021. #if CYTHON_COMPILING_IN_CPYTHON
  31022. if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
  31023. PyObject *result = NULL;
  31024. PyObject *args = PyTuple_New(2);
  31025. if (unlikely(!args)) return NULL;
  31026. Py_INCREF(arg1);
  31027. PyTuple_SET_ITEM(args, 0, arg1);
  31028. Py_INCREF(arg2);
  31029. PyTuple_SET_ITEM(args, 1, arg2);
  31030. if (cfunc->flag & METH_KEYWORDS)
  31031. result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL);
  31032. else
  31033. result = __Pyx_CallCFunction(cfunc, self, args);
  31034. Py_DECREF(args);
  31035. return result;
  31036. }
  31037. #endif
  31038. {
  31039. PyObject *args[4] = {NULL, self, arg1, arg2};
  31040. return __Pyx_PyObject_FastCall(cfunc->method, args+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  31041. }
  31042. }
  31043. /* ParseKeywordsImpl (used by ParseKeywords) */
  31044. static int __Pyx_ValidateDuplicatePosArgs(
  31045. PyObject *kwds,
  31046. PyObject ** const argnames[],
  31047. PyObject ** const *first_kw_arg,
  31048. const char* function_name)
  31049. {
  31050. PyObject ** const *name = argnames;
  31051. while (name != first_kw_arg) {
  31052. PyObject *key = **name;
  31053. int found = PyDict_Contains(kwds, key);
  31054. if (unlikely(found)) {
  31055. if (found == 1) __Pyx_RaiseDoubleKeywordsError(function_name, key);
  31056. goto bad;
  31057. }
  31058. name++;
  31059. }
  31060. return 0;
  31061. bad:
  31062. return -1;
  31063. }
  31064. #if CYTHON_USE_UNICODE_INTERNALS
  31065. static CYTHON_INLINE int __Pyx_UnicodeKeywordsEqual(PyObject *s1, PyObject *s2) {
  31066. int kind;
  31067. Py_ssize_t len = PyUnicode_GET_LENGTH(s1);
  31068. if (len != PyUnicode_GET_LENGTH(s2)) return 0;
  31069. kind = PyUnicode_KIND(s1);
  31070. if (kind != PyUnicode_KIND(s2)) return 0;
  31071. const void *data1 = PyUnicode_DATA(s1);
  31072. const void *data2 = PyUnicode_DATA(s2);
  31073. return (memcmp(data1, data2, (size_t) len * (size_t) kind) == 0);
  31074. }
  31075. #endif
  31076. static int __Pyx_MatchKeywordArg_str(
  31077. PyObject *key,
  31078. PyObject ** const argnames[],
  31079. PyObject ** const *first_kw_arg,
  31080. size_t *index_found,
  31081. const char *function_name)
  31082. {
  31083. PyObject ** const *name;
  31084. #if CYTHON_USE_UNICODE_INTERNALS
  31085. Py_hash_t key_hash = ((PyASCIIObject*)key)->hash;
  31086. if (unlikely(key_hash == -1)) {
  31087. key_hash = PyObject_Hash(key);
  31088. if (unlikely(key_hash == -1))
  31089. goto bad;
  31090. }
  31091. #endif
  31092. name = first_kw_arg;
  31093. while (*name) {
  31094. PyObject *name_str = **name;
  31095. #if CYTHON_USE_UNICODE_INTERNALS
  31096. if (key_hash == ((PyASCIIObject*)name_str)->hash && __Pyx_UnicodeKeywordsEqual(name_str, key)) {
  31097. *index_found = (size_t) (name - argnames);
  31098. return 1;
  31099. }
  31100. #else
  31101. #if CYTHON_ASSUME_SAFE_SIZE
  31102. if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key))
  31103. #endif
  31104. {
  31105. int cmp = PyUnicode_Compare(name_str, key);
  31106. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  31107. if (cmp == 0) {
  31108. *index_found = (size_t) (name - argnames);
  31109. return 1;
  31110. }
  31111. }
  31112. #endif
  31113. name++;
  31114. }
  31115. name = argnames;
  31116. while (name != first_kw_arg) {
  31117. PyObject *name_str = **name;
  31118. #if CYTHON_USE_UNICODE_INTERNALS
  31119. if (unlikely(key_hash == ((PyASCIIObject*)name_str)->hash)) {
  31120. if (__Pyx_UnicodeKeywordsEqual(name_str, key))
  31121. goto arg_passed_twice;
  31122. }
  31123. #else
  31124. #if CYTHON_ASSUME_SAFE_SIZE
  31125. if (PyUnicode_GET_LENGTH(name_str) == PyUnicode_GET_LENGTH(key))
  31126. #endif
  31127. {
  31128. if (unlikely(name_str == key)) goto arg_passed_twice;
  31129. int cmp = PyUnicode_Compare(name_str, key);
  31130. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  31131. if (cmp == 0) goto arg_passed_twice;
  31132. }
  31133. #endif
  31134. name++;
  31135. }
  31136. return 0;
  31137. arg_passed_twice:
  31138. __Pyx_RaiseDoubleKeywordsError(function_name, key);
  31139. goto bad;
  31140. bad:
  31141. return -1;
  31142. }
  31143. static int __Pyx_MatchKeywordArg_nostr(
  31144. PyObject *key,
  31145. PyObject ** const argnames[],
  31146. PyObject ** const *first_kw_arg,
  31147. size_t *index_found,
  31148. const char *function_name)
  31149. {
  31150. PyObject ** const *name;
  31151. if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type;
  31152. name = first_kw_arg;
  31153. while (*name) {
  31154. int cmp = PyObject_RichCompareBool(**name, key, Py_EQ);
  31155. if (cmp == 1) {
  31156. *index_found = (size_t) (name - argnames);
  31157. return 1;
  31158. }
  31159. if (unlikely(cmp == -1)) goto bad;
  31160. name++;
  31161. }
  31162. name = argnames;
  31163. while (name != first_kw_arg) {
  31164. int cmp = PyObject_RichCompareBool(**name, key, Py_EQ);
  31165. if (unlikely(cmp != 0)) {
  31166. if (cmp == 1) goto arg_passed_twice;
  31167. else goto bad;
  31168. }
  31169. name++;
  31170. }
  31171. return 0;
  31172. arg_passed_twice:
  31173. __Pyx_RaiseDoubleKeywordsError(function_name, key);
  31174. goto bad;
  31175. invalid_keyword_type:
  31176. PyErr_Format(PyExc_TypeError,
  31177. "%.200s() keywords must be strings", function_name);
  31178. goto bad;
  31179. bad:
  31180. return -1;
  31181. }
  31182. static CYTHON_INLINE int __Pyx_MatchKeywordArg(
  31183. PyObject *key,
  31184. PyObject ** const argnames[],
  31185. PyObject ** const *first_kw_arg,
  31186. size_t *index_found,
  31187. const char *function_name)
  31188. {
  31189. return likely(PyUnicode_CheckExact(key)) ?
  31190. __Pyx_MatchKeywordArg_str(key, argnames, first_kw_arg, index_found, function_name) :
  31191. __Pyx_MatchKeywordArg_nostr(key, argnames, first_kw_arg, index_found, function_name);
  31192. }
  31193. static void __Pyx_RejectUnknownKeyword(
  31194. PyObject *kwds,
  31195. PyObject ** const argnames[],
  31196. PyObject ** const *first_kw_arg,
  31197. const char *function_name)
  31198. {
  31199. #if CYTHON_AVOID_BORROWED_REFS
  31200. PyObject *pos = NULL;
  31201. #else
  31202. Py_ssize_t pos = 0;
  31203. #endif
  31204. PyObject *key = NULL;
  31205. __Pyx_BEGIN_CRITICAL_SECTION(kwds);
  31206. while (
  31207. #if CYTHON_AVOID_BORROWED_REFS
  31208. __Pyx_PyDict_NextRef(kwds, &pos, &key, NULL)
  31209. #else
  31210. PyDict_Next(kwds, &pos, &key, NULL)
  31211. #endif
  31212. ) {
  31213. PyObject** const *name = first_kw_arg;
  31214. while (*name && (**name != key)) name++;
  31215. if (!*name) {
  31216. size_t index_found = 0;
  31217. int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name);
  31218. if (cmp != 1) {
  31219. if (cmp == 0) {
  31220. PyErr_Format(PyExc_TypeError,
  31221. "%s() got an unexpected keyword argument '%U'",
  31222. function_name, key);
  31223. }
  31224. #if CYTHON_AVOID_BORROWED_REFS
  31225. Py_DECREF(key);
  31226. #endif
  31227. break;
  31228. }
  31229. }
  31230. #if CYTHON_AVOID_BORROWED_REFS
  31231. Py_DECREF(key);
  31232. #endif
  31233. }
  31234. __Pyx_END_CRITICAL_SECTION();
  31235. #if CYTHON_AVOID_BORROWED_REFS
  31236. Py_XDECREF(pos);
  31237. #endif
  31238. assert(PyErr_Occurred());
  31239. }
  31240. static int __Pyx_ParseKeywordDict(
  31241. PyObject *kwds,
  31242. PyObject ** const argnames[],
  31243. PyObject *values[],
  31244. Py_ssize_t num_pos_args,
  31245. Py_ssize_t num_kwargs,
  31246. const char* function_name,
  31247. int ignore_unknown_kwargs)
  31248. {
  31249. PyObject** const *name;
  31250. PyObject** const *first_kw_arg = argnames + num_pos_args;
  31251. Py_ssize_t extracted = 0;
  31252. #if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
  31253. if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1;
  31254. #endif
  31255. name = first_kw_arg;
  31256. while (*name && num_kwargs > extracted) {
  31257. PyObject * key = **name;
  31258. PyObject *value;
  31259. int found = 0;
  31260. #if __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  31261. found = PyDict_GetItemRef(kwds, key, &value);
  31262. #else
  31263. value = PyDict_GetItemWithError(kwds, key);
  31264. if (value) {
  31265. Py_INCREF(value);
  31266. found = 1;
  31267. } else {
  31268. if (unlikely(PyErr_Occurred())) goto bad;
  31269. }
  31270. #endif
  31271. if (found) {
  31272. if (unlikely(found < 0)) goto bad;
  31273. values[name-argnames] = value;
  31274. extracted++;
  31275. }
  31276. name++;
  31277. }
  31278. if (num_kwargs > extracted) {
  31279. if (ignore_unknown_kwargs) {
  31280. if (unlikely(__Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name) == -1))
  31281. goto bad;
  31282. } else {
  31283. __Pyx_RejectUnknownKeyword(kwds, argnames, first_kw_arg, function_name);
  31284. goto bad;
  31285. }
  31286. }
  31287. return 0;
  31288. bad:
  31289. return -1;
  31290. }
  31291. static int __Pyx_ParseKeywordDictToDict(
  31292. PyObject *kwds,
  31293. PyObject ** const argnames[],
  31294. PyObject *kwds2,
  31295. PyObject *values[],
  31296. Py_ssize_t num_pos_args,
  31297. const char* function_name)
  31298. {
  31299. PyObject** const *name;
  31300. PyObject** const *first_kw_arg = argnames + num_pos_args;
  31301. Py_ssize_t len;
  31302. #if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
  31303. if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1;
  31304. #endif
  31305. if (PyDict_Update(kwds2, kwds) < 0) goto bad;
  31306. name = first_kw_arg;
  31307. while (*name) {
  31308. PyObject *key = **name;
  31309. PyObject *value;
  31310. #if !CYTHON_COMPILING_IN_LIMITED_API && (PY_VERSION_HEX >= 0x030d00A2 || defined(PyDict_Pop))
  31311. int found = PyDict_Pop(kwds2, key, &value);
  31312. if (found) {
  31313. if (unlikely(found < 0)) goto bad;
  31314. values[name-argnames] = value;
  31315. }
  31316. #elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  31317. int found = PyDict_GetItemRef(kwds2, key, &value);
  31318. if (found) {
  31319. if (unlikely(found < 0)) goto bad;
  31320. values[name-argnames] = value;
  31321. if (unlikely(PyDict_DelItem(kwds2, key) < 0)) goto bad;
  31322. }
  31323. #else
  31324. #if CYTHON_COMPILING_IN_CPYTHON
  31325. value = _PyDict_Pop(kwds2, key, kwds2);
  31326. #else
  31327. value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, kwds2, key, kwds2);
  31328. #endif
  31329. if (value == kwds2) {
  31330. Py_DECREF(value);
  31331. } else {
  31332. if (unlikely(!value)) goto bad;
  31333. values[name-argnames] = value;
  31334. }
  31335. #endif
  31336. name++;
  31337. }
  31338. len = PyDict_Size(kwds2);
  31339. if (len > 0) {
  31340. return __Pyx_ValidateDuplicatePosArgs(kwds, argnames, first_kw_arg, function_name);
  31341. } else if (unlikely(len == -1)) {
  31342. goto bad;
  31343. }
  31344. return 0;
  31345. bad:
  31346. return -1;
  31347. }
  31348. static int __Pyx_ParseKeywordsTuple(
  31349. PyObject *kwds,
  31350. PyObject * const *kwvalues,
  31351. PyObject ** const argnames[],
  31352. PyObject *kwds2,
  31353. PyObject *values[],
  31354. Py_ssize_t num_pos_args,
  31355. Py_ssize_t num_kwargs,
  31356. const char* function_name,
  31357. int ignore_unknown_kwargs)
  31358. {
  31359. PyObject *key = NULL;
  31360. PyObject** const * name;
  31361. PyObject** const *first_kw_arg = argnames + num_pos_args;
  31362. for (Py_ssize_t pos = 0; pos < num_kwargs; pos++) {
  31363. #if CYTHON_AVOID_BORROWED_REFS
  31364. key = __Pyx_PySequence_ITEM(kwds, pos);
  31365. #else
  31366. key = __Pyx_PyTuple_GET_ITEM(kwds, pos);
  31367. #endif
  31368. #if !CYTHON_ASSUME_SAFE_MACROS
  31369. if (unlikely(!key)) goto bad;
  31370. #endif
  31371. name = first_kw_arg;
  31372. while (*name && (**name != key)) name++;
  31373. if (*name) {
  31374. PyObject *value = kwvalues[pos];
  31375. values[name-argnames] = __Pyx_NewRef(value);
  31376. } else {
  31377. size_t index_found = 0;
  31378. int cmp = __Pyx_MatchKeywordArg(key, argnames, first_kw_arg, &index_found, function_name);
  31379. if (cmp == 1) {
  31380. PyObject *value = kwvalues[pos];
  31381. values[index_found] = __Pyx_NewRef(value);
  31382. } else {
  31383. if (unlikely(cmp == -1)) goto bad;
  31384. if (kwds2) {
  31385. PyObject *value = kwvalues[pos];
  31386. if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
  31387. } else if (!ignore_unknown_kwargs) {
  31388. goto invalid_keyword;
  31389. }
  31390. }
  31391. }
  31392. #if CYTHON_AVOID_BORROWED_REFS
  31393. Py_DECREF(key);
  31394. key = NULL;
  31395. #endif
  31396. }
  31397. return 0;
  31398. invalid_keyword:
  31399. PyErr_Format(PyExc_TypeError,
  31400. "%s() got an unexpected keyword argument '%U'",
  31401. function_name, key);
  31402. goto bad;
  31403. bad:
  31404. #if CYTHON_AVOID_BORROWED_REFS
  31405. Py_XDECREF(key);
  31406. #endif
  31407. return -1;
  31408. }
  31409. /* ParseKeywords */
  31410. static int __Pyx_ParseKeywords(
  31411. PyObject *kwds,
  31412. PyObject * const *kwvalues,
  31413. PyObject ** const argnames[],
  31414. PyObject *kwds2,
  31415. PyObject *values[],
  31416. Py_ssize_t num_pos_args,
  31417. Py_ssize_t num_kwargs,
  31418. const char* function_name,
  31419. int ignore_unknown_kwargs)
  31420. {
  31421. if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)))
  31422. return __Pyx_ParseKeywordsTuple(kwds, kwvalues, argnames, kwds2, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs);
  31423. else if (kwds2)
  31424. return __Pyx_ParseKeywordDictToDict(kwds, argnames, kwds2, values, num_pos_args, function_name);
  31425. else
  31426. return __Pyx_ParseKeywordDict(kwds, argnames, values, num_pos_args, num_kwargs, function_name, ignore_unknown_kwargs);
  31427. }
  31428. /* RaiseArgTupleInvalid */
  31429. static void __Pyx_RaiseArgtupleInvalid(
  31430. const char* func_name,
  31431. int exact,
  31432. Py_ssize_t num_min,
  31433. Py_ssize_t num_max,
  31434. Py_ssize_t num_found)
  31435. {
  31436. Py_ssize_t num_expected;
  31437. const char *more_or_less;
  31438. if (num_found < num_min) {
  31439. num_expected = num_min;
  31440. more_or_less = "at least";
  31441. } else {
  31442. num_expected = num_max;
  31443. more_or_less = "at most";
  31444. }
  31445. if (exact) {
  31446. more_or_less = "exactly";
  31447. }
  31448. PyErr_Format(PyExc_TypeError,
  31449. "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  31450. func_name, more_or_less, num_expected,
  31451. (num_expected == 1) ? "" : "s", num_found);
  31452. }
  31453. /* PyDictVersioning (used by GetModuleGlobalName) */
  31454. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
  31455. static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
  31456. PyObject *dict = Py_TYPE(obj)->tp_dict;
  31457. return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
  31458. }
  31459. static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
  31460. PyObject **dictptr = NULL;
  31461. Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
  31462. if (offset) {
  31463. #if CYTHON_COMPILING_IN_CPYTHON
  31464. dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
  31465. #else
  31466. dictptr = _PyObject_GetDictPtr(obj);
  31467. #endif
  31468. }
  31469. return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
  31470. }
  31471. static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
  31472. PyObject *dict = Py_TYPE(obj)->tp_dict;
  31473. if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
  31474. return 0;
  31475. return obj_dict_version == __Pyx_get_object_dict_version(obj);
  31476. }
  31477. #endif
  31478. /* GetModuleGlobalName */
  31479. #if CYTHON_USE_DICT_VERSIONS
  31480. static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
  31481. #else
  31482. static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
  31483. #endif
  31484. {
  31485. PyObject *result;
  31486. #if CYTHON_COMPILING_IN_LIMITED_API
  31487. if (unlikely(!__pyx_m)) {
  31488. if (!PyErr_Occurred())
  31489. PyErr_SetNone(PyExc_NameError);
  31490. return NULL;
  31491. }
  31492. result = PyObject_GetAttr(__pyx_m, name);
  31493. if (likely(result)) {
  31494. return result;
  31495. }
  31496. PyErr_Clear();
  31497. #elif CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
  31498. if (unlikely(__Pyx_PyDict_GetItemRef(__pyx_mstate_global->__pyx_d, name, &result) == -1)) PyErr_Clear();
  31499. __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version)
  31500. if (likely(result)) {
  31501. return result;
  31502. }
  31503. #else
  31504. result = _PyDict_GetItem_KnownHash(__pyx_mstate_global->__pyx_d, name, ((PyASCIIObject *) name)->hash);
  31505. __PYX_UPDATE_DICT_CACHE(__pyx_mstate_global->__pyx_d, result, *dict_cached_value, *dict_version)
  31506. if (likely(result)) {
  31507. return __Pyx_NewRef(result);
  31508. }
  31509. PyErr_Clear();
  31510. #endif
  31511. return __Pyx_GetBuiltinName(name);
  31512. }
  31513. /* PyLongBinop */
  31514. #if !CYTHON_COMPILING_IN_PYPY
  31515. static PyObject* __Pyx_Fallback___Pyx_PyLong_MultiplyCObj(PyObject *op1, PyObject *op2, int inplace) {
  31516. return (inplace ? PyNumber_InPlaceMultiply : PyNumber_Multiply)(op1, op2);
  31517. }
  31518. #if CYTHON_USE_PYLONG_INTERNALS
  31519. static PyObject* __Pyx_Unpacked___Pyx_PyLong_MultiplyCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  31520. CYTHON_MAYBE_UNUSED_VAR(inplace);
  31521. CYTHON_UNUSED_VAR(zerodivision_check);
  31522. const long a = intval;
  31523. long b;
  31524. const PY_LONG_LONG lla = intval;
  31525. PY_LONG_LONG llb;
  31526. if (unlikely(__Pyx_PyLong_IsZero(op2))) {
  31527. return __Pyx_NewRef(op2);
  31528. }
  31529. const int is_positive = __Pyx_PyLong_IsPos(op2);
  31530. const digit* digits = __Pyx_PyLong_Digits(op2);
  31531. const Py_ssize_t size = __Pyx_PyLong_DigitCount(op2);
  31532. if (likely(size == 1)) {
  31533. b = (long) digits[0];
  31534. if (!is_positive) b *= -1;
  31535. } else {
  31536. switch (size) {
  31537. case 2:
  31538. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT+30) {
  31539. b = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  31540. if (!is_positive) b *= -1;
  31541. goto calculate_long;
  31542. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT+30) {
  31543. llb = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  31544. if (!is_positive) llb *= -1;
  31545. goto calculate_long_long;
  31546. }
  31547. break;
  31548. case 3:
  31549. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT+30) {
  31550. b = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  31551. if (!is_positive) b *= -1;
  31552. goto calculate_long;
  31553. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT+30) {
  31554. 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]));
  31555. if (!is_positive) llb *= -1;
  31556. goto calculate_long_long;
  31557. }
  31558. break;
  31559. case 4:
  31560. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT+30) {
  31561. b = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  31562. if (!is_positive) b *= -1;
  31563. goto calculate_long;
  31564. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT+30) {
  31565. 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]));
  31566. if (!is_positive) llb *= -1;
  31567. goto calculate_long_long;
  31568. }
  31569. break;
  31570. }
  31571. return PyLong_Type.tp_as_number->nb_multiply(op1, op2);
  31572. }
  31573. calculate_long:
  31574. CYTHON_UNUSED_VAR(a);
  31575. CYTHON_UNUSED_VAR(b);
  31576. llb = b;
  31577. goto calculate_long_long;
  31578. calculate_long_long:
  31579. {
  31580. PY_LONG_LONG llx;
  31581. llx = lla * llb;
  31582. return PyLong_FromLongLong(llx);
  31583. }
  31584. }
  31585. #endif
  31586. static PyObject* __Pyx_Float___Pyx_PyLong_MultiplyCObj(PyObject *float_val, long intval, int zerodivision_check) {
  31587. CYTHON_UNUSED_VAR(zerodivision_check);
  31588. const long a = intval;
  31589. double b = __Pyx_PyFloat_AS_DOUBLE(float_val);
  31590. double result;
  31591. result = ((double)a) * (double)b;
  31592. return PyFloat_FromDouble(result);
  31593. }
  31594. static CYTHON_INLINE PyObject* __Pyx_PyLong_MultiplyCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  31595. CYTHON_MAYBE_UNUSED_VAR(intval);
  31596. CYTHON_UNUSED_VAR(zerodivision_check);
  31597. #if CYTHON_USE_PYLONG_INTERNALS
  31598. if (likely(PyLong_CheckExact(op2))) {
  31599. return __Pyx_Unpacked___Pyx_PyLong_MultiplyCObj(op1, op2, intval, inplace, zerodivision_check);
  31600. }
  31601. #endif
  31602. if (PyFloat_CheckExact(op2)) {
  31603. return __Pyx_Float___Pyx_PyLong_MultiplyCObj(op2, intval, zerodivision_check);
  31604. }
  31605. return __Pyx_Fallback___Pyx_PyLong_MultiplyCObj(op1, op2, inplace);
  31606. }
  31607. #endif
  31608. /* RaiseTooManyValuesToUnpack */
  31609. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
  31610. PyErr_Format(PyExc_ValueError,
  31611. "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
  31612. }
  31613. /* RaiseNeedMoreValuesToUnpack */
  31614. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
  31615. PyErr_Format(PyExc_ValueError,
  31616. "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
  31617. index, (index == 1) ? "" : "s");
  31618. }
  31619. /* IterFinish */
  31620. static CYTHON_INLINE int __Pyx_IterFinish(void) {
  31621. PyObject* exc_type;
  31622. __Pyx_PyThreadState_declare
  31623. __Pyx_PyThreadState_assign
  31624. exc_type = __Pyx_PyErr_CurrentExceptionType();
  31625. if (unlikely(exc_type)) {
  31626. if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
  31627. return -1;
  31628. __Pyx_PyErr_Clear();
  31629. return 0;
  31630. }
  31631. return 0;
  31632. }
  31633. /* UnpackItemEndCheck */
  31634. static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
  31635. if (unlikely(retval)) {
  31636. Py_DECREF(retval);
  31637. __Pyx_RaiseTooManyValuesError(expected);
  31638. return -1;
  31639. }
  31640. return __Pyx_IterFinish();
  31641. }
  31642. /* PyLongBinop */
  31643. #if !CYTHON_COMPILING_IN_PYPY
  31644. static PyObject* __Pyx_Fallback___Pyx_PyLong_TrueDivideObjC(PyObject *op1, PyObject *op2, int inplace) {
  31645. return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2);
  31646. }
  31647. #if CYTHON_USE_PYLONG_INTERNALS
  31648. static PyObject* __Pyx_Unpacked___Pyx_PyLong_TrueDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  31649. CYTHON_MAYBE_UNUSED_VAR(inplace);
  31650. CYTHON_UNUSED_VAR(zerodivision_check);
  31651. const long b = intval;
  31652. long a;
  31653. if (unlikely(__Pyx_PyLong_IsZero(op1))) {
  31654. }
  31655. const int is_positive = __Pyx_PyLong_IsPos(op1);
  31656. const digit* digits = __Pyx_PyLong_Digits(op1);
  31657. const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
  31658. if (likely(size == 1)) {
  31659. a = (long) digits[0];
  31660. if (!is_positive) a *= -1;
  31661. } else {
  31662. switch (size) {
  31663. case 2:
  31664. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT && 1 * PyLong_SHIFT < 53) {
  31665. a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  31666. if (!is_positive) a *= -1;
  31667. goto calculate_long;
  31668. }
  31669. break;
  31670. case 3:
  31671. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT && 2 * PyLong_SHIFT < 53) {
  31672. a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  31673. if (!is_positive) a *= -1;
  31674. goto calculate_long;
  31675. }
  31676. break;
  31677. case 4:
  31678. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT && 3 * PyLong_SHIFT < 53) {
  31679. a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  31680. if (!is_positive) a *= -1;
  31681. goto calculate_long;
  31682. }
  31683. break;
  31684. }
  31685. return PyLong_Type.tp_as_number->nb_true_divide(op1, op2);
  31686. }
  31687. calculate_long:
  31688. if ((8 * sizeof(long) <= 53 || likely(labs(a) <= ((PY_LONG_LONG)1 << 53)))
  31689. || __Pyx_PyLong_DigitCount(op1) <= 52 / PyLong_SHIFT) {
  31690. return PyFloat_FromDouble((double)a / (double)b);
  31691. }
  31692. return PyLong_Type.tp_as_number->nb_true_divide(op1, op2);
  31693. }
  31694. #endif
  31695. static PyObject* __Pyx_Float___Pyx_PyLong_TrueDivideObjC(PyObject *float_val, long intval, int zerodivision_check) {
  31696. CYTHON_UNUSED_VAR(zerodivision_check);
  31697. const long b = intval;
  31698. double a = __Pyx_PyFloat_AS_DOUBLE(float_val);
  31699. double result;
  31700. result = ((double)a) / (double)b;
  31701. return PyFloat_FromDouble(result);
  31702. }
  31703. static CYTHON_INLINE PyObject* __Pyx_PyLong_TrueDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  31704. CYTHON_MAYBE_UNUSED_VAR(intval);
  31705. CYTHON_UNUSED_VAR(zerodivision_check);
  31706. #if CYTHON_USE_PYLONG_INTERNALS
  31707. if (likely(PyLong_CheckExact(op1))) {
  31708. return __Pyx_Unpacked___Pyx_PyLong_TrueDivideObjC(op1, op2, intval, inplace, zerodivision_check);
  31709. }
  31710. #endif
  31711. if (PyFloat_CheckExact(op1)) {
  31712. return __Pyx_Float___Pyx_PyLong_TrueDivideObjC(op1, intval, zerodivision_check);
  31713. }
  31714. return __Pyx_Fallback___Pyx_PyLong_TrueDivideObjC(op1, op2, inplace);
  31715. }
  31716. #endif
  31717. /* PyLongCompare */
  31718. static CYTHON_INLINE int __Pyx_PyLong_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
  31719. CYTHON_MAYBE_UNUSED_VAR(intval);
  31720. CYTHON_UNUSED_VAR(inplace);
  31721. if (op1 == op2) {
  31722. return 0;
  31723. }
  31724. #if CYTHON_USE_PYLONG_INTERNALS
  31725. if (likely(PyLong_CheckExact(op1))) {
  31726. int unequal;
  31727. unsigned long uintval;
  31728. Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
  31729. const digit* digits = __Pyx_PyLong_Digits(op1);
  31730. if (intval == 0) {
  31731. return (__Pyx_PyLong_IsZero(op1) != 1);
  31732. } else if (intval < 0) {
  31733. if (__Pyx_PyLong_IsNonNeg(op1))
  31734. return 1;
  31735. intval = -intval;
  31736. } else {
  31737. if (__Pyx_PyLong_IsNeg(op1))
  31738. return 1;
  31739. }
  31740. uintval = (unsigned long) intval;
  31741. #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
  31742. if (uintval >> (PyLong_SHIFT * 4)) {
  31743. unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  31744. | (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));
  31745. } else
  31746. #endif
  31747. #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
  31748. if (uintval >> (PyLong_SHIFT * 3)) {
  31749. unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  31750. | (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));
  31751. } else
  31752. #endif
  31753. #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
  31754. if (uintval >> (PyLong_SHIFT * 2)) {
  31755. unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  31756. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  31757. } else
  31758. #endif
  31759. #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
  31760. if (uintval >> (PyLong_SHIFT * 1)) {
  31761. unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  31762. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  31763. } else
  31764. #endif
  31765. unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
  31766. return (unequal != 0);
  31767. }
  31768. #endif
  31769. if (PyFloat_CheckExact(op1)) {
  31770. const long b = intval;
  31771. double a = __Pyx_PyFloat_AS_DOUBLE(op1);
  31772. return ((double)a != (double)b);
  31773. }
  31774. return __Pyx_PyObject_IsTrueAndDecref(
  31775. PyObject_RichCompare(op1, op2, Py_NE));
  31776. }
  31777. /* GetItemInt */
  31778. static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
  31779. PyObject *r;
  31780. if (unlikely(!j)) return NULL;
  31781. r = PyObject_GetItem(o, j);
  31782. Py_DECREF(j);
  31783. return r;
  31784. }
  31785. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  31786. int wraparound, int boundscheck, int unsafe_shared) {
  31787. CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
  31788. #if CYTHON_ASSUME_SAFE_SIZE
  31789. Py_ssize_t wrapped_i = i;
  31790. if (wraparound & unlikely(i < 0)) {
  31791. wrapped_i += PyList_GET_SIZE(o);
  31792. }
  31793. if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS || !CYTHON_ASSUME_SAFE_MACROS)) {
  31794. return __Pyx_PyList_GetItemRefFast(o, wrapped_i, unsafe_shared);
  31795. } else
  31796. if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
  31797. return __Pyx_NewRef(PyList_GET_ITEM(o, wrapped_i));
  31798. }
  31799. return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
  31800. #else
  31801. (void)wraparound;
  31802. (void)boundscheck;
  31803. return PySequence_GetItem(o, i);
  31804. #endif
  31805. }
  31806. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  31807. int wraparound, int boundscheck, int unsafe_shared) {
  31808. CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
  31809. #if CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  31810. Py_ssize_t wrapped_i = i;
  31811. if (wraparound & unlikely(i < 0)) {
  31812. wrapped_i += PyTuple_GET_SIZE(o);
  31813. }
  31814. if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
  31815. return __Pyx_NewRef(PyTuple_GET_ITEM(o, wrapped_i));
  31816. }
  31817. return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
  31818. #else
  31819. (void)wraparound;
  31820. (void)boundscheck;
  31821. return PySequence_GetItem(o, i);
  31822. #endif
  31823. }
  31824. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
  31825. int wraparound, int boundscheck, int unsafe_shared) {
  31826. CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
  31827. #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
  31828. if (is_list || PyList_CheckExact(o)) {
  31829. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
  31830. if ((CYTHON_AVOID_BORROWED_REFS || CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS)) {
  31831. return __Pyx_PyList_GetItemRefFast(o, n, unsafe_shared);
  31832. } else if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
  31833. return __Pyx_NewRef(PyList_GET_ITEM(o, n));
  31834. }
  31835. } else
  31836. #if !CYTHON_AVOID_BORROWED_REFS
  31837. if (PyTuple_CheckExact(o)) {
  31838. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
  31839. if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
  31840. return __Pyx_NewRef(PyTuple_GET_ITEM(o, n));
  31841. }
  31842. } else
  31843. #endif
  31844. #endif
  31845. #if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
  31846. {
  31847. PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
  31848. PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
  31849. if (!is_list && mm && mm->mp_subscript) {
  31850. PyObject *r, *key = PyLong_FromSsize_t(i);
  31851. if (unlikely(!key)) return NULL;
  31852. r = mm->mp_subscript(o, key);
  31853. Py_DECREF(key);
  31854. return r;
  31855. }
  31856. if (is_list || likely(sm && sm->sq_item)) {
  31857. if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
  31858. Py_ssize_t l = sm->sq_length(o);
  31859. if (likely(l >= 0)) {
  31860. i += l;
  31861. } else {
  31862. if (!PyErr_ExceptionMatches(PyExc_OverflowError))
  31863. return NULL;
  31864. PyErr_Clear();
  31865. }
  31866. }
  31867. return sm->sq_item(o, i);
  31868. }
  31869. }
  31870. #else
  31871. if (is_list || !PyMapping_Check(o)) {
  31872. return PySequence_GetItem(o, i);
  31873. }
  31874. #endif
  31875. (void)wraparound;
  31876. (void)boundscheck;
  31877. return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
  31878. }
  31879. /* ObjectGetItem */
  31880. #if CYTHON_USE_TYPE_SLOTS
  31881. static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) {
  31882. PyObject *runerr = NULL;
  31883. Py_ssize_t key_value;
  31884. key_value = __Pyx_PyIndex_AsSsize_t(index);
  31885. if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
  31886. return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1, 1);
  31887. }
  31888. if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
  31889. __Pyx_TypeName index_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(index));
  31890. PyErr_Clear();
  31891. PyErr_Format(PyExc_IndexError,
  31892. "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name);
  31893. __Pyx_DECREF_TypeName(index_type_name);
  31894. }
  31895. return NULL;
  31896. }
  31897. static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) {
  31898. __Pyx_TypeName obj_type_name;
  31899. if (likely(PyType_Check(obj))) {
  31900. PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_mstate_global->__pyx_n_u_class_getitem);
  31901. if (!meth) {
  31902. PyErr_Clear();
  31903. } else {
  31904. PyObject *result = __Pyx_PyObject_CallOneArg(meth, key);
  31905. Py_DECREF(meth);
  31906. return result;
  31907. }
  31908. }
  31909. obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
  31910. PyErr_Format(PyExc_TypeError,
  31911. "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name);
  31912. __Pyx_DECREF_TypeName(obj_type_name);
  31913. return NULL;
  31914. }
  31915. static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) {
  31916. PyTypeObject *tp = Py_TYPE(obj);
  31917. PyMappingMethods *mm = tp->tp_as_mapping;
  31918. PySequenceMethods *sm = tp->tp_as_sequence;
  31919. if (likely(mm && mm->mp_subscript)) {
  31920. return mm->mp_subscript(obj, key);
  31921. }
  31922. if (likely(sm && sm->sq_item)) {
  31923. return __Pyx_PyObject_GetIndex(obj, key);
  31924. }
  31925. return __Pyx_PyObject_GetItem_Slow(obj, key);
  31926. }
  31927. #endif
  31928. /* PyLongCompare */
  31929. static CYTHON_INLINE int __Pyx_PyLong_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
  31930. CYTHON_MAYBE_UNUSED_VAR(intval);
  31931. CYTHON_UNUSED_VAR(inplace);
  31932. if (op1 == op2) {
  31933. return 1;
  31934. }
  31935. #if CYTHON_USE_PYLONG_INTERNALS
  31936. if (likely(PyLong_CheckExact(op1))) {
  31937. int unequal;
  31938. unsigned long uintval;
  31939. Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
  31940. const digit* digits = __Pyx_PyLong_Digits(op1);
  31941. if (intval == 0) {
  31942. return (__Pyx_PyLong_IsZero(op1) == 1);
  31943. } else if (intval < 0) {
  31944. if (__Pyx_PyLong_IsNonNeg(op1))
  31945. return 0;
  31946. intval = -intval;
  31947. } else {
  31948. if (__Pyx_PyLong_IsNeg(op1))
  31949. return 0;
  31950. }
  31951. uintval = (unsigned long) intval;
  31952. #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
  31953. if (uintval >> (PyLong_SHIFT * 4)) {
  31954. unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  31955. | (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));
  31956. } else
  31957. #endif
  31958. #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
  31959. if (uintval >> (PyLong_SHIFT * 3)) {
  31960. unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  31961. | (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));
  31962. } else
  31963. #endif
  31964. #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
  31965. if (uintval >> (PyLong_SHIFT * 2)) {
  31966. unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  31967. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  31968. } else
  31969. #endif
  31970. #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
  31971. if (uintval >> (PyLong_SHIFT * 1)) {
  31972. unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
  31973. | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
  31974. } else
  31975. #endif
  31976. unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
  31977. return (unequal == 0);
  31978. }
  31979. #endif
  31980. if (PyFloat_CheckExact(op1)) {
  31981. const long b = intval;
  31982. double a = __Pyx_PyFloat_AS_DOUBLE(op1);
  31983. return ((double)a == (double)b);
  31984. }
  31985. return __Pyx_PyObject_IsTrueAndDecref(
  31986. PyObject_RichCompare(op1, op2, Py_EQ));
  31987. }
  31988. /* RaiseUnboundLocalError */
  31989. static void __Pyx_RaiseUnboundLocalError(const char *varname) {
  31990. PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
  31991. }
  31992. /* GetException (used by pep479) */
  31993. #if CYTHON_FAST_THREAD_STATE
  31994. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
  31995. #else
  31996. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
  31997. #endif
  31998. {
  31999. PyObject *local_type = NULL, *local_value, *local_tb = NULL;
  32000. #if CYTHON_FAST_THREAD_STATE
  32001. PyObject *tmp_type, *tmp_value, *tmp_tb;
  32002. #if PY_VERSION_HEX >= 0x030C0000
  32003. local_value = tstate->current_exception;
  32004. tstate->current_exception = 0;
  32005. #else
  32006. local_type = tstate->curexc_type;
  32007. local_value = tstate->curexc_value;
  32008. local_tb = tstate->curexc_traceback;
  32009. tstate->curexc_type = 0;
  32010. tstate->curexc_value = 0;
  32011. tstate->curexc_traceback = 0;
  32012. #endif
  32013. #elif __PYX_LIMITED_VERSION_HEX > 0x030C0000
  32014. local_value = PyErr_GetRaisedException();
  32015. #else
  32016. PyErr_Fetch(&local_type, &local_value, &local_tb);
  32017. #endif
  32018. #if __PYX_LIMITED_VERSION_HEX > 0x030C0000
  32019. if (likely(local_value)) {
  32020. local_type = (PyObject*) Py_TYPE(local_value);
  32021. Py_INCREF(local_type);
  32022. local_tb = PyException_GetTraceback(local_value);
  32023. }
  32024. #else
  32025. PyErr_NormalizeException(&local_type, &local_value, &local_tb);
  32026. #if CYTHON_FAST_THREAD_STATE
  32027. if (unlikely(tstate->curexc_type))
  32028. #else
  32029. if (unlikely(PyErr_Occurred()))
  32030. #endif
  32031. goto bad;
  32032. if (local_tb) {
  32033. if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
  32034. goto bad;
  32035. }
  32036. #endif // __PYX_LIMITED_VERSION_HEX > 0x030C0000
  32037. Py_XINCREF(local_tb);
  32038. Py_XINCREF(local_type);
  32039. Py_XINCREF(local_value);
  32040. *type = local_type;
  32041. *value = local_value;
  32042. *tb = local_tb;
  32043. #if CYTHON_FAST_THREAD_STATE
  32044. #if CYTHON_USE_EXC_INFO_STACK
  32045. {
  32046. _PyErr_StackItem *exc_info = tstate->exc_info;
  32047. #if PY_VERSION_HEX >= 0x030B00a4
  32048. tmp_value = exc_info->exc_value;
  32049. exc_info->exc_value = local_value;
  32050. tmp_type = NULL;
  32051. tmp_tb = NULL;
  32052. Py_XDECREF(local_type);
  32053. Py_XDECREF(local_tb);
  32054. #else
  32055. tmp_type = exc_info->exc_type;
  32056. tmp_value = exc_info->exc_value;
  32057. tmp_tb = exc_info->exc_traceback;
  32058. exc_info->exc_type = local_type;
  32059. exc_info->exc_value = local_value;
  32060. exc_info->exc_traceback = local_tb;
  32061. #endif
  32062. }
  32063. #else
  32064. tmp_type = tstate->exc_type;
  32065. tmp_value = tstate->exc_value;
  32066. tmp_tb = tstate->exc_traceback;
  32067. tstate->exc_type = local_type;
  32068. tstate->exc_value = local_value;
  32069. tstate->exc_traceback = local_tb;
  32070. #endif
  32071. Py_XDECREF(tmp_type);
  32072. Py_XDECREF(tmp_value);
  32073. Py_XDECREF(tmp_tb);
  32074. #elif __PYX_LIMITED_VERSION_HEX >= 0x030b0000
  32075. PyErr_SetHandledException(local_value);
  32076. Py_XDECREF(local_value);
  32077. Py_XDECREF(local_type);
  32078. Py_XDECREF(local_tb);
  32079. #else
  32080. PyErr_SetExcInfo(local_type, local_value, local_tb);
  32081. #endif
  32082. return 0;
  32083. #if __PYX_LIMITED_VERSION_HEX <= 0x030C0000
  32084. bad:
  32085. *type = 0;
  32086. *value = 0;
  32087. *tb = 0;
  32088. Py_XDECREF(local_type);
  32089. Py_XDECREF(local_value);
  32090. Py_XDECREF(local_tb);
  32091. return -1;
  32092. #endif
  32093. }
  32094. /* pep479 */
  32095. static void __Pyx_Generator_Replace_StopIteration(int in_async_gen) {
  32096. PyObject *exc, *val, *tb, *cur_exc, *new_exc;
  32097. __Pyx_PyThreadState_declare
  32098. int is_async_stopiteration = 0;
  32099. CYTHON_MAYBE_UNUSED_VAR(in_async_gen);
  32100. __Pyx_PyThreadState_assign
  32101. cur_exc = __Pyx_PyErr_CurrentExceptionType();
  32102. if (likely(!__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopIteration))) {
  32103. if (in_async_gen && unlikely(__Pyx_PyErr_GivenExceptionMatches(cur_exc, PyExc_StopAsyncIteration))) {
  32104. is_async_stopiteration = 1;
  32105. } else {
  32106. return;
  32107. }
  32108. }
  32109. __Pyx_GetException(&exc, &val, &tb);
  32110. Py_XDECREF(exc);
  32111. Py_XDECREF(tb);
  32112. new_exc = PyObject_CallFunction(PyExc_RuntimeError, "s",
  32113. is_async_stopiteration ? "async generator raised StopAsyncIteration" :
  32114. in_async_gen ? "async generator raised StopIteration" :
  32115. "generator raised StopIteration");
  32116. if (!new_exc) {
  32117. Py_XDECREF(val);
  32118. return;
  32119. }
  32120. PyException_SetCause(new_exc, val); // steals ref to val
  32121. PyErr_SetObject(PyExc_RuntimeError, new_exc);
  32122. }
  32123. /* SliceObject */
  32124. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
  32125. Py_ssize_t cstart, Py_ssize_t cstop,
  32126. PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
  32127. int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
  32128. __Pyx_TypeName obj_type_name;
  32129. #if CYTHON_USE_TYPE_SLOTS
  32130. PyMappingMethods* mp = Py_TYPE(obj)->tp_as_mapping;
  32131. if (likely(mp && mp->mp_subscript))
  32132. #endif
  32133. {
  32134. PyObject* result;
  32135. PyObject *py_slice, *py_start, *py_stop;
  32136. if (_py_slice) {
  32137. py_slice = *_py_slice;
  32138. } else {
  32139. PyObject* owned_start = NULL;
  32140. PyObject* owned_stop = NULL;
  32141. if (_py_start) {
  32142. py_start = *_py_start;
  32143. } else {
  32144. if (has_cstart) {
  32145. owned_start = py_start = PyLong_FromSsize_t(cstart);
  32146. if (unlikely(!py_start)) goto bad;
  32147. } else
  32148. py_start = Py_None;
  32149. }
  32150. if (_py_stop) {
  32151. py_stop = *_py_stop;
  32152. } else {
  32153. if (has_cstop) {
  32154. owned_stop = py_stop = PyLong_FromSsize_t(cstop);
  32155. if (unlikely(!py_stop)) {
  32156. Py_XDECREF(owned_start);
  32157. goto bad;
  32158. }
  32159. } else
  32160. py_stop = Py_None;
  32161. }
  32162. py_slice = PySlice_New(py_start, py_stop, Py_None);
  32163. Py_XDECREF(owned_start);
  32164. Py_XDECREF(owned_stop);
  32165. if (unlikely(!py_slice)) goto bad;
  32166. }
  32167. #if CYTHON_USE_TYPE_SLOTS
  32168. result = mp->mp_subscript(obj, py_slice);
  32169. #else
  32170. result = PyObject_GetItem(obj, py_slice);
  32171. #endif
  32172. if (!_py_slice) {
  32173. Py_DECREF(py_slice);
  32174. }
  32175. return result;
  32176. }
  32177. obj_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(obj));
  32178. PyErr_Format(PyExc_TypeError,
  32179. "'" __Pyx_FMT_TYPENAME "' object is unsliceable", obj_type_name);
  32180. __Pyx_DECREF_TypeName(obj_type_name);
  32181. bad:
  32182. return NULL;
  32183. }
  32184. /* SetItemInt */
  32185. static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
  32186. int r;
  32187. if (unlikely(!j)) return -1;
  32188. r = PyObject_SetItem(o, j, v);
  32189. Py_DECREF(j);
  32190. return r;
  32191. }
  32192. static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
  32193. int wraparound, int boundscheck, int unsafe_shared) {
  32194. CYTHON_MAYBE_UNUSED_VAR(unsafe_shared);
  32195. #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS
  32196. if (is_list || PyList_CheckExact(o)) {
  32197. Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
  32198. if ((CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS && !__Pyx_IS_UNIQUELY_REFERENCED(o, unsafe_shared))) {
  32199. Py_INCREF(v);
  32200. return PyList_SetItem(o, n, v);
  32201. } else if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
  32202. PyObject* old;
  32203. Py_INCREF(v);
  32204. old = PyList_GET_ITEM(o, n);
  32205. PyList_SET_ITEM(o, n, v);
  32206. Py_DECREF(old);
  32207. return 0;
  32208. }
  32209. } else
  32210. #endif
  32211. #if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
  32212. {
  32213. PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
  32214. PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
  32215. if (!is_list && mm && mm->mp_ass_subscript) {
  32216. int r;
  32217. PyObject *key = PyLong_FromSsize_t(i);
  32218. if (unlikely(!key)) return -1;
  32219. r = mm->mp_ass_subscript(o, key, v);
  32220. Py_DECREF(key);
  32221. return r;
  32222. }
  32223. if (is_list || likely(sm && sm->sq_ass_item)) {
  32224. if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
  32225. Py_ssize_t l = sm->sq_length(o);
  32226. if (likely(l >= 0)) {
  32227. i += l;
  32228. } else {
  32229. if (!PyErr_ExceptionMatches(PyExc_OverflowError))
  32230. return -1;
  32231. PyErr_Clear();
  32232. }
  32233. }
  32234. return sm->sq_ass_item(o, i, v);
  32235. }
  32236. }
  32237. #else
  32238. if (is_list || !PyMapping_Check(o)) {
  32239. return PySequence_SetItem(o, i, v);
  32240. }
  32241. #endif
  32242. (void)wraparound;
  32243. (void)boundscheck;
  32244. return __Pyx_SetItemInt_Generic(o, PyLong_FromSsize_t(i), v);
  32245. }
  32246. /* CoroutineSetYieldFrom (used by GeneratorYieldFrom) */
  32247. static void
  32248. __Pyx_Coroutine_Set_Owned_Yield_From(__pyx_CoroutineObject *gen, PyObject *yf) {
  32249. assert (!gen->yieldfrom);
  32250. #if CYTHON_USE_AM_SEND
  32251. assert (!gen->yieldfrom_am_send);
  32252. #if PY_VERSION_HEX < 0x030A00F0
  32253. if (__Pyx_PyType_HasFeature(Py_TYPE(yf), __Pyx_TPFLAGS_HAVE_AM_SEND))
  32254. #endif
  32255. {
  32256. __Pyx_pyiter_sendfunc am_send;
  32257. #if __PYX_LIMITED_VERSION_HEX >= 0x030A0000
  32258. am_send = __Pyx_PyObject_TryGetSubSlot(yf, tp_as_async, am_send, __Pyx_pyiter_sendfunc);
  32259. #else
  32260. __Pyx_PyAsyncMethodsStruct* tp_as_async = (__Pyx_PyAsyncMethodsStruct*) Py_TYPE(yf)->tp_as_async;
  32261. am_send = tp_as_async ? tp_as_async->am_send : NULL;
  32262. #endif
  32263. if (likely(am_send)) {
  32264. gen->yieldfrom_am_send = am_send;
  32265. }
  32266. }
  32267. #endif
  32268. gen->yieldfrom = yf;
  32269. }
  32270. /* dict_setdefault (used by FetchCommonType) */
  32271. static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value) {
  32272. PyObject* value;
  32273. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x030C0000
  32274. PyObject *args[] = {d, key, default_value};
  32275. value = PyObject_VectorcallMethod(__pyx_mstate_global->__pyx_n_u_setdefault, args, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
  32276. #elif CYTHON_COMPILING_IN_LIMITED_API
  32277. value = PyObject_CallMethodObjArgs(d, __pyx_mstate_global->__pyx_n_u_setdefault, key, default_value, NULL);
  32278. #elif PY_VERSION_HEX >= 0x030d0000
  32279. PyDict_SetDefaultRef(d, key, default_value, &value);
  32280. #else
  32281. value = PyDict_SetDefault(d, key, default_value);
  32282. if (unlikely(!value)) return NULL;
  32283. Py_INCREF(value);
  32284. #endif
  32285. return value;
  32286. }
  32287. /* LimitedApiGetTypeDict (used by SetItemOnTypeDict) */
  32288. #if CYTHON_COMPILING_IN_LIMITED_API
  32289. static Py_ssize_t __Pyx_GetTypeDictOffset(void) {
  32290. PyObject *tp_dictoffset_o;
  32291. Py_ssize_t tp_dictoffset;
  32292. tp_dictoffset_o = PyObject_GetAttrString((PyObject*)(&PyType_Type), "__dictoffset__");
  32293. if (unlikely(!tp_dictoffset_o)) return -1;
  32294. tp_dictoffset = PyLong_AsSsize_t(tp_dictoffset_o);
  32295. Py_DECREF(tp_dictoffset_o);
  32296. if (unlikely(tp_dictoffset == 0)) {
  32297. PyErr_SetString(
  32298. PyExc_TypeError,
  32299. "'type' doesn't have a dictoffset");
  32300. return -1;
  32301. } else if (unlikely(tp_dictoffset < 0)) {
  32302. PyErr_SetString(
  32303. PyExc_TypeError,
  32304. "'type' has an unexpected negative dictoffset. "
  32305. "Please report this as Cython bug");
  32306. return -1;
  32307. }
  32308. return tp_dictoffset;
  32309. }
  32310. static PyObject *__Pyx_GetTypeDict(PyTypeObject *tp) {
  32311. static Py_ssize_t tp_dictoffset = 0;
  32312. if (unlikely(tp_dictoffset == 0)) {
  32313. tp_dictoffset = __Pyx_GetTypeDictOffset();
  32314. if (unlikely(tp_dictoffset == -1 && PyErr_Occurred())) {
  32315. tp_dictoffset = 0; // try again next time?
  32316. return NULL;
  32317. }
  32318. }
  32319. return *(PyObject**)((char*)tp + tp_dictoffset);
  32320. }
  32321. #endif
  32322. /* SetItemOnTypeDict (used by FixUpExtensionType) */
  32323. static int __Pyx__SetItemOnTypeDict(PyTypeObject *tp, PyObject *k, PyObject *v) {
  32324. int result;
  32325. PyObject *tp_dict;
  32326. #if CYTHON_COMPILING_IN_LIMITED_API
  32327. tp_dict = __Pyx_GetTypeDict(tp);
  32328. if (unlikely(!tp_dict)) return -1;
  32329. #else
  32330. tp_dict = tp->tp_dict;
  32331. #endif
  32332. result = PyDict_SetItem(tp_dict, k, v);
  32333. if (likely(!result)) {
  32334. PyType_Modified(tp);
  32335. if (unlikely(PyObject_HasAttr(v, __pyx_mstate_global->__pyx_n_u_set_name))) {
  32336. PyObject *setNameResult = PyObject_CallMethodObjArgs(v, __pyx_mstate_global->__pyx_n_u_set_name, (PyObject *) tp, k, NULL);
  32337. if (!setNameResult) return -1;
  32338. Py_DECREF(setNameResult);
  32339. }
  32340. }
  32341. return result;
  32342. }
  32343. /* FixUpExtensionType (used by FetchCommonType) */
  32344. static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) {
  32345. #if __PYX_LIMITED_VERSION_HEX > 0x030900B1
  32346. CYTHON_UNUSED_VAR(spec);
  32347. CYTHON_UNUSED_VAR(type);
  32348. CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
  32349. #else
  32350. const PyType_Slot *slot = spec->slots;
  32351. int changed = 0;
  32352. #if !CYTHON_COMPILING_IN_LIMITED_API
  32353. while (slot && slot->slot && slot->slot != Py_tp_members)
  32354. slot++;
  32355. if (slot && slot->slot == Py_tp_members) {
  32356. #if !CYTHON_COMPILING_IN_CPYTHON
  32357. const
  32358. #endif // !CYTHON_COMPILING_IN_CPYTHON)
  32359. PyMemberDef *memb = (PyMemberDef*) slot->pfunc;
  32360. while (memb && memb->name) {
  32361. if (memb->name[0] == '_' && memb->name[1] == '_') {
  32362. if (strcmp(memb->name, "__weaklistoffset__") == 0) {
  32363. assert(memb->type == T_PYSSIZET);
  32364. assert(memb->flags == READONLY);
  32365. type->tp_weaklistoffset = memb->offset;
  32366. changed = 1;
  32367. }
  32368. else if (strcmp(memb->name, "__dictoffset__") == 0) {
  32369. assert(memb->type == T_PYSSIZET);
  32370. assert(memb->flags == READONLY);
  32371. type->tp_dictoffset = memb->offset;
  32372. changed = 1;
  32373. }
  32374. #if CYTHON_METH_FASTCALL
  32375. else if (strcmp(memb->name, "__vectorcalloffset__") == 0) {
  32376. assert(memb->type == T_PYSSIZET);
  32377. assert(memb->flags == READONLY);
  32378. type->tp_vectorcall_offset = memb->offset;
  32379. changed = 1;
  32380. }
  32381. #endif // CYTHON_METH_FASTCALL
  32382. #if !CYTHON_COMPILING_IN_PYPY
  32383. else if (strcmp(memb->name, "__module__") == 0) {
  32384. PyObject *descr;
  32385. assert(memb->type == T_OBJECT);
  32386. assert(memb->flags == 0 || memb->flags == READONLY);
  32387. descr = PyDescr_NewMember(type, memb);
  32388. if (unlikely(!descr))
  32389. return -1;
  32390. int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr);
  32391. Py_DECREF(descr);
  32392. if (unlikely(set_item_result < 0)) {
  32393. return -1;
  32394. }
  32395. changed = 1;
  32396. }
  32397. #endif // !CYTHON_COMPILING_IN_PYPY
  32398. }
  32399. memb++;
  32400. }
  32401. }
  32402. #endif // !CYTHON_COMPILING_IN_LIMITED_API
  32403. #if !CYTHON_COMPILING_IN_PYPY
  32404. slot = spec->slots;
  32405. while (slot && slot->slot && slot->slot != Py_tp_getset)
  32406. slot++;
  32407. if (slot && slot->slot == Py_tp_getset) {
  32408. PyGetSetDef *getset = (PyGetSetDef*) slot->pfunc;
  32409. while (getset && getset->name) {
  32410. if (getset->name[0] == '_' && getset->name[1] == '_' && strcmp(getset->name, "__module__") == 0) {
  32411. PyObject *descr = PyDescr_NewGetSet(type, getset);
  32412. if (unlikely(!descr))
  32413. return -1;
  32414. #if CYTHON_COMPILING_IN_LIMITED_API
  32415. PyObject *pyname = PyUnicode_FromString(getset->name);
  32416. if (unlikely(!pyname)) {
  32417. Py_DECREF(descr);
  32418. return -1;
  32419. }
  32420. int set_item_result = __Pyx_SetItemOnTypeDict(type, pyname, descr);
  32421. Py_DECREF(pyname);
  32422. #else
  32423. CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
  32424. int set_item_result = PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr);
  32425. #endif
  32426. Py_DECREF(descr);
  32427. if (unlikely(set_item_result < 0)) {
  32428. return -1;
  32429. }
  32430. changed = 1;
  32431. }
  32432. ++getset;
  32433. }
  32434. }
  32435. #else
  32436. CYTHON_UNUSED_VAR(__Pyx__SetItemOnTypeDict);
  32437. #endif // !CYTHON_COMPILING_IN_PYPY
  32438. if (changed)
  32439. PyType_Modified(type);
  32440. #endif // PY_VERSION_HEX > 0x030900B1
  32441. return 0;
  32442. }
  32443. /* AddModuleRef (used by FetchSharedCythonModule) */
  32444. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  32445. static PyObject *__Pyx_PyImport_AddModuleObjectRef(PyObject *name) {
  32446. PyObject *module_dict = PyImport_GetModuleDict();
  32447. PyObject *m;
  32448. if (PyMapping_GetOptionalItem(module_dict, name, &m) < 0) {
  32449. return NULL;
  32450. }
  32451. if (m != NULL && PyModule_Check(m)) {
  32452. return m;
  32453. }
  32454. Py_XDECREF(m);
  32455. m = PyModule_NewObject(name);
  32456. if (m == NULL)
  32457. return NULL;
  32458. if (PyDict_CheckExact(module_dict)) {
  32459. PyObject *new_m;
  32460. (void)PyDict_SetDefaultRef(module_dict, name, m, &new_m);
  32461. Py_DECREF(m);
  32462. return new_m;
  32463. } else {
  32464. if (PyObject_SetItem(module_dict, name, m) != 0) {
  32465. Py_DECREF(m);
  32466. return NULL;
  32467. }
  32468. return m;
  32469. }
  32470. }
  32471. static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
  32472. PyObject *py_name = PyUnicode_FromString(name);
  32473. if (!py_name) return NULL;
  32474. PyObject *module = __Pyx_PyImport_AddModuleObjectRef(py_name);
  32475. Py_DECREF(py_name);
  32476. return module;
  32477. }
  32478. #elif __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  32479. #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
  32480. #else
  32481. static PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
  32482. PyObject *module = PyImport_AddModule(name);
  32483. Py_XINCREF(module);
  32484. return module;
  32485. }
  32486. #endif
  32487. /* FetchSharedCythonModule (used by FetchCommonType) */
  32488. static PyObject *__Pyx_FetchSharedCythonABIModule(void) {
  32489. return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME);
  32490. }
  32491. /* FetchCommonType (used by CommonTypesMetaclass) */
  32492. #if __PYX_LIMITED_VERSION_HEX < 0x030C0000
  32493. static PyObject* __Pyx_PyType_FromMetaclass(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) {
  32494. PyObject *result = __Pyx_PyType_FromModuleAndSpec(module, spec, bases);
  32495. if (result && metaclass) {
  32496. PyObject *old_tp = (PyObject*)Py_TYPE(result);
  32497. Py_INCREF((PyObject*)metaclass);
  32498. #if __PYX_LIMITED_VERSION_HEX >= 0x03090000
  32499. Py_SET_TYPE(result, metaclass);
  32500. #else
  32501. result->ob_type = metaclass;
  32502. #endif
  32503. Py_DECREF(old_tp);
  32504. }
  32505. return result;
  32506. }
  32507. #else
  32508. #define __Pyx_PyType_FromMetaclass(me, mo, s, b) PyType_FromMetaclass(me, mo, s, b)
  32509. #endif
  32510. static int __Pyx_VerifyCachedType(PyObject *cached_type,
  32511. const char *name,
  32512. Py_ssize_t expected_basicsize) {
  32513. Py_ssize_t basicsize;
  32514. if (!PyType_Check(cached_type)) {
  32515. PyErr_Format(PyExc_TypeError,
  32516. "Shared Cython type %.200s is not a type object", name);
  32517. return -1;
  32518. }
  32519. if (expected_basicsize == 0) {
  32520. return 0; // size is inherited, nothing useful to check
  32521. }
  32522. #if CYTHON_COMPILING_IN_LIMITED_API
  32523. PyObject *py_basicsize;
  32524. py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__");
  32525. if (unlikely(!py_basicsize)) return -1;
  32526. basicsize = PyLong_AsSsize_t(py_basicsize);
  32527. Py_DECREF(py_basicsize);
  32528. py_basicsize = NULL;
  32529. if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) return -1;
  32530. #else
  32531. basicsize = ((PyTypeObject*) cached_type)->tp_basicsize;
  32532. #endif
  32533. if (basicsize != expected_basicsize) {
  32534. PyErr_Format(PyExc_TypeError,
  32535. "Shared Cython type %.200s has the wrong size, try recompiling",
  32536. name);
  32537. return -1;
  32538. }
  32539. return 0;
  32540. }
  32541. static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyTypeObject *metaclass, PyObject *module, PyType_Spec *spec, PyObject *bases) {
  32542. PyObject *abi_module = NULL, *cached_type = NULL, *abi_module_dict, *new_cached_type, *py_object_name;
  32543. int get_item_ref_result;
  32544. const char* object_name = strrchr(spec->name, '.');
  32545. object_name = object_name ? object_name+1 : spec->name;
  32546. py_object_name = PyUnicode_FromString(object_name);
  32547. if (!py_object_name) return NULL;
  32548. abi_module = __Pyx_FetchSharedCythonABIModule();
  32549. if (!abi_module) goto done;
  32550. abi_module_dict = PyModule_GetDict(abi_module);
  32551. if (!abi_module_dict) goto done;
  32552. get_item_ref_result = __Pyx_PyDict_GetItemRef(abi_module_dict, py_object_name, &cached_type);
  32553. if (get_item_ref_result == 1) {
  32554. if (__Pyx_VerifyCachedType(
  32555. cached_type,
  32556. object_name,
  32557. spec->basicsize) < 0) {
  32558. goto bad;
  32559. }
  32560. goto done;
  32561. } else if (unlikely(get_item_ref_result == -1)) {
  32562. goto bad;
  32563. }
  32564. cached_type = __Pyx_PyType_FromMetaclass(
  32565. metaclass,
  32566. CYTHON_USE_MODULE_STATE ? module : abi_module,
  32567. spec, bases);
  32568. if (unlikely(!cached_type)) goto bad;
  32569. if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad;
  32570. new_cached_type = __Pyx_PyDict_SetDefault(abi_module_dict, py_object_name, cached_type);
  32571. if (unlikely(new_cached_type != cached_type)) {
  32572. if (unlikely(!new_cached_type)) goto bad;
  32573. Py_DECREF(cached_type);
  32574. cached_type = new_cached_type;
  32575. if (__Pyx_VerifyCachedType(
  32576. cached_type,
  32577. object_name,
  32578. spec->basicsize) < 0) {
  32579. goto bad;
  32580. }
  32581. goto done;
  32582. } else {
  32583. Py_DECREF(new_cached_type);
  32584. }
  32585. done:
  32586. Py_XDECREF(abi_module);
  32587. Py_DECREF(py_object_name);
  32588. assert(cached_type == NULL || PyType_Check(cached_type));
  32589. return (PyTypeObject *) cached_type;
  32590. bad:
  32591. Py_XDECREF(cached_type);
  32592. cached_type = NULL;
  32593. goto done;
  32594. }
  32595. /* CommonTypesMetaclass (used by CoroutineBase) */
  32596. static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
  32597. return PyUnicode_FromString(__PYX_ABI_MODULE_NAME);
  32598. }
  32599. #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
  32600. static PyObject* __pyx_CommonTypesMetaclass_call(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwds) {
  32601. PyErr_SetString(PyExc_TypeError, "Cannot instantiate Cython internal types");
  32602. return NULL;
  32603. }
  32604. static int __pyx_CommonTypesMetaclass_setattr(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED PyObject *attr, CYTHON_UNUSED PyObject *value) {
  32605. PyErr_SetString(PyExc_TypeError, "Cython internal types are immutable");
  32606. return -1;
  32607. }
  32608. #endif
  32609. static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = {
  32610. {"__module__", __pyx_CommonTypesMetaclass_get_module, NULL, NULL, NULL},
  32611. {0, 0, 0, 0, 0}
  32612. };
  32613. static PyType_Slot __pyx_CommonTypesMetaclass_slots[] = {
  32614. {Py_tp_getset, (void *)__pyx_CommonTypesMetaclass_getset},
  32615. #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
  32616. {Py_tp_call, (void*)__pyx_CommonTypesMetaclass_call},
  32617. {Py_tp_new, (void*)__pyx_CommonTypesMetaclass_call},
  32618. {Py_tp_setattro, (void*)__pyx_CommonTypesMetaclass_setattr},
  32619. #endif
  32620. {0, 0}
  32621. };
  32622. static PyType_Spec __pyx_CommonTypesMetaclass_spec = {
  32623. __PYX_TYPE_MODULE_PREFIX "_common_types_metatype",
  32624. 0,
  32625. 0,
  32626. Py_TPFLAGS_IMMUTABLETYPE |
  32627. Py_TPFLAGS_DISALLOW_INSTANTIATION |
  32628. Py_TPFLAGS_DEFAULT,
  32629. __pyx_CommonTypesMetaclass_slots
  32630. };
  32631. static int __pyx_CommonTypesMetaclass_init(PyObject *module) {
  32632. __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
  32633. PyObject *bases = PyTuple_Pack(1, &PyType_Type);
  32634. if (unlikely(!bases)) {
  32635. return -1;
  32636. }
  32637. mstate->__pyx_CommonTypesMetaclassType = __Pyx_FetchCommonTypeFromSpec(NULL, module, &__pyx_CommonTypesMetaclass_spec, bases);
  32638. Py_DECREF(bases);
  32639. if (unlikely(mstate->__pyx_CommonTypesMetaclassType == NULL)) {
  32640. return -1;
  32641. }
  32642. return 0;
  32643. }
  32644. /* RaiseException (used by CoroutineBase) */
  32645. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
  32646. PyObject* owned_instance = NULL;
  32647. if (tb == Py_None) {
  32648. tb = 0;
  32649. } else if (tb && !PyTraceBack_Check(tb)) {
  32650. PyErr_SetString(PyExc_TypeError,
  32651. "raise: arg 3 must be a traceback or None");
  32652. goto bad;
  32653. }
  32654. if (value == Py_None)
  32655. value = 0;
  32656. if (PyExceptionInstance_Check(type)) {
  32657. if (value) {
  32658. PyErr_SetString(PyExc_TypeError,
  32659. "instance exception may not have a separate value");
  32660. goto bad;
  32661. }
  32662. value = type;
  32663. type = (PyObject*) Py_TYPE(value);
  32664. } else if (PyExceptionClass_Check(type)) {
  32665. PyObject *instance_class = NULL;
  32666. if (value && PyExceptionInstance_Check(value)) {
  32667. instance_class = (PyObject*) Py_TYPE(value);
  32668. if (instance_class != type) {
  32669. int is_subclass = PyObject_IsSubclass(instance_class, type);
  32670. if (!is_subclass) {
  32671. instance_class = NULL;
  32672. } else if (unlikely(is_subclass == -1)) {
  32673. goto bad;
  32674. } else {
  32675. type = instance_class;
  32676. }
  32677. }
  32678. }
  32679. if (!instance_class) {
  32680. PyObject *args;
  32681. if (!value)
  32682. args = PyTuple_New(0);
  32683. else if (PyTuple_Check(value)) {
  32684. Py_INCREF(value);
  32685. args = value;
  32686. } else
  32687. args = PyTuple_Pack(1, value);
  32688. if (!args)
  32689. goto bad;
  32690. owned_instance = PyObject_Call(type, args, NULL);
  32691. Py_DECREF(args);
  32692. if (!owned_instance)
  32693. goto bad;
  32694. value = owned_instance;
  32695. if (!PyExceptionInstance_Check(value)) {
  32696. PyErr_Format(PyExc_TypeError,
  32697. "calling %R should have returned an instance of "
  32698. "BaseException, not %R",
  32699. type, Py_TYPE(value));
  32700. goto bad;
  32701. }
  32702. }
  32703. } else {
  32704. PyErr_SetString(PyExc_TypeError,
  32705. "raise: exception class must be a subclass of BaseException");
  32706. goto bad;
  32707. }
  32708. if (cause) {
  32709. PyObject *fixed_cause;
  32710. if (cause == Py_None) {
  32711. fixed_cause = NULL;
  32712. } else if (PyExceptionClass_Check(cause)) {
  32713. fixed_cause = PyObject_CallObject(cause, NULL);
  32714. if (fixed_cause == NULL)
  32715. goto bad;
  32716. } else if (PyExceptionInstance_Check(cause)) {
  32717. fixed_cause = cause;
  32718. Py_INCREF(fixed_cause);
  32719. } else {
  32720. PyErr_SetString(PyExc_TypeError,
  32721. "exception causes must derive from "
  32722. "BaseException");
  32723. goto bad;
  32724. }
  32725. PyException_SetCause(value, fixed_cause);
  32726. }
  32727. PyErr_SetObject(type, value);
  32728. if (tb) {
  32729. #if PY_VERSION_HEX >= 0x030C00A6
  32730. PyException_SetTraceback(value, tb);
  32731. #elif CYTHON_FAST_THREAD_STATE
  32732. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  32733. PyObject* tmp_tb = tstate->curexc_traceback;
  32734. if (tb != tmp_tb) {
  32735. Py_INCREF(tb);
  32736. tstate->curexc_traceback = tb;
  32737. Py_XDECREF(tmp_tb);
  32738. }
  32739. #else
  32740. PyObject *tmp_type, *tmp_value, *tmp_tb;
  32741. PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
  32742. Py_INCREF(tb);
  32743. PyErr_Restore(tmp_type, tmp_value, tb);
  32744. Py_XDECREF(tmp_tb);
  32745. #endif
  32746. }
  32747. bad:
  32748. Py_XDECREF(owned_instance);
  32749. return;
  32750. }
  32751. /* GetTopmostException (used by SaveResetException) */
  32752. #if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
  32753. static _PyErr_StackItem *
  32754. __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
  32755. {
  32756. _PyErr_StackItem *exc_info = tstate->exc_info;
  32757. while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) &&
  32758. exc_info->previous_item != NULL)
  32759. {
  32760. exc_info = exc_info->previous_item;
  32761. }
  32762. return exc_info;
  32763. }
  32764. #endif
  32765. /* SaveResetException (used by CoroutineBase) */
  32766. #if CYTHON_FAST_THREAD_STATE
  32767. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  32768. #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
  32769. _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
  32770. PyObject *exc_value = exc_info->exc_value;
  32771. if (exc_value == NULL || exc_value == Py_None) {
  32772. *value = NULL;
  32773. *type = NULL;
  32774. *tb = NULL;
  32775. } else {
  32776. *value = exc_value;
  32777. Py_INCREF(*value);
  32778. *type = (PyObject*) Py_TYPE(exc_value);
  32779. Py_INCREF(*type);
  32780. *tb = PyException_GetTraceback(exc_value);
  32781. }
  32782. #elif CYTHON_USE_EXC_INFO_STACK
  32783. _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
  32784. *type = exc_info->exc_type;
  32785. *value = exc_info->exc_value;
  32786. *tb = exc_info->exc_traceback;
  32787. Py_XINCREF(*type);
  32788. Py_XINCREF(*value);
  32789. Py_XINCREF(*tb);
  32790. #else
  32791. *type = tstate->exc_type;
  32792. *value = tstate->exc_value;
  32793. *tb = tstate->exc_traceback;
  32794. Py_XINCREF(*type);
  32795. Py_XINCREF(*value);
  32796. Py_XINCREF(*tb);
  32797. #endif
  32798. }
  32799. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  32800. #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
  32801. _PyErr_StackItem *exc_info = tstate->exc_info;
  32802. PyObject *tmp_value = exc_info->exc_value;
  32803. exc_info->exc_value = value;
  32804. Py_XDECREF(tmp_value);
  32805. Py_XDECREF(type);
  32806. Py_XDECREF(tb);
  32807. #else
  32808. PyObject *tmp_type, *tmp_value, *tmp_tb;
  32809. #if CYTHON_USE_EXC_INFO_STACK
  32810. _PyErr_StackItem *exc_info = tstate->exc_info;
  32811. tmp_type = exc_info->exc_type;
  32812. tmp_value = exc_info->exc_value;
  32813. tmp_tb = exc_info->exc_traceback;
  32814. exc_info->exc_type = type;
  32815. exc_info->exc_value = value;
  32816. exc_info->exc_traceback = tb;
  32817. #else
  32818. tmp_type = tstate->exc_type;
  32819. tmp_value = tstate->exc_value;
  32820. tmp_tb = tstate->exc_traceback;
  32821. tstate->exc_type = type;
  32822. tstate->exc_value = value;
  32823. tstate->exc_traceback = tb;
  32824. #endif
  32825. Py_XDECREF(tmp_type);
  32826. Py_XDECREF(tmp_value);
  32827. Py_XDECREF(tmp_tb);
  32828. #endif
  32829. }
  32830. #endif
  32831. /* SwapException (used by CoroutineBase) */
  32832. #if CYTHON_FAST_THREAD_STATE
  32833. static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  32834. PyObject *tmp_type, *tmp_value, *tmp_tb;
  32835. #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
  32836. _PyErr_StackItem *exc_info = tstate->exc_info;
  32837. tmp_value = exc_info->exc_value;
  32838. exc_info->exc_value = *value;
  32839. if (tmp_value == NULL || tmp_value == Py_None) {
  32840. Py_XDECREF(tmp_value);
  32841. tmp_value = NULL;
  32842. tmp_type = NULL;
  32843. tmp_tb = NULL;
  32844. } else {
  32845. tmp_type = (PyObject*) Py_TYPE(tmp_value);
  32846. Py_INCREF(tmp_type);
  32847. #if CYTHON_COMPILING_IN_CPYTHON
  32848. tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback;
  32849. Py_XINCREF(tmp_tb);
  32850. #else
  32851. tmp_tb = PyException_GetTraceback(tmp_value);
  32852. #endif
  32853. }
  32854. #elif CYTHON_USE_EXC_INFO_STACK
  32855. _PyErr_StackItem *exc_info = tstate->exc_info;
  32856. tmp_type = exc_info->exc_type;
  32857. tmp_value = exc_info->exc_value;
  32858. tmp_tb = exc_info->exc_traceback;
  32859. exc_info->exc_type = *type;
  32860. exc_info->exc_value = *value;
  32861. exc_info->exc_traceback = *tb;
  32862. #else
  32863. tmp_type = tstate->exc_type;
  32864. tmp_value = tstate->exc_value;
  32865. tmp_tb = tstate->exc_traceback;
  32866. tstate->exc_type = *type;
  32867. tstate->exc_value = *value;
  32868. tstate->exc_traceback = *tb;
  32869. #endif
  32870. *type = tmp_type;
  32871. *value = tmp_value;
  32872. *tb = tmp_tb;
  32873. }
  32874. #else
  32875. static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
  32876. PyObject *tmp_type, *tmp_value, *tmp_tb;
  32877. PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
  32878. PyErr_SetExcInfo(*type, *value, *tb);
  32879. *type = tmp_type;
  32880. *value = tmp_value;
  32881. *tb = tmp_tb;
  32882. }
  32883. #endif
  32884. /* CallTypeTraverse (used by CoroutineBase) */
  32885. #if !CYTHON_USE_TYPE_SPECS || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x03090000)
  32886. #else
  32887. static int __Pyx_call_type_traverse(PyObject *o, int always_call, visitproc visit, void *arg) {
  32888. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000
  32889. if (__Pyx_get_runtime_version() < 0x03090000) return 0;
  32890. #endif
  32891. if (!always_call) {
  32892. PyTypeObject *base = __Pyx_PyObject_GetSlot(o, tp_base, PyTypeObject*);
  32893. unsigned long flags = PyType_GetFlags(base);
  32894. if (flags & Py_TPFLAGS_HEAPTYPE) {
  32895. return 0;
  32896. }
  32897. }
  32898. Py_VISIT((PyObject*)Py_TYPE(o));
  32899. return 0;
  32900. }
  32901. #endif
  32902. /* IterNextPlain (used by CoroutineBase) */
  32903. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  32904. static PyObject *__Pyx_GetBuiltinNext_LimitedAPI(void) {
  32905. if (unlikely(!__pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache))
  32906. __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache = __Pyx_GetBuiltinName(__pyx_mstate_global->__pyx_n_u_next);
  32907. return __pyx_mstate_global->__Pyx_GetBuiltinNext_LimitedAPI_cache;
  32908. }
  32909. #endif
  32910. static CYTHON_INLINE PyObject *__Pyx_PyIter_Next_Plain(PyObject *iterator) {
  32911. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  32912. PyObject *result;
  32913. PyObject *next = __Pyx_GetBuiltinNext_LimitedAPI();
  32914. if (unlikely(!next)) return NULL;
  32915. result = PyObject_CallFunctionObjArgs(next, iterator, NULL);
  32916. return result;
  32917. #else
  32918. (void)__Pyx_GetBuiltinName; // only for early limited API
  32919. iternextfunc iternext = __Pyx_PyObject_GetIterNextFunc(iterator);
  32920. assert(iternext);
  32921. return iternext(iterator);
  32922. #endif
  32923. }
  32924. /* PyObjectCall2Args (used by PyObjectCallMethod1) */
  32925. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
  32926. PyObject *args[3] = {NULL, arg1, arg2};
  32927. return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  32928. }
  32929. /* PyObjectGetMethod (used by PyObjectCallMethod1) */
  32930. #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
  32931. static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
  32932. PyObject *attr;
  32933. #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
  32934. __Pyx_TypeName type_name;
  32935. PyTypeObject *tp = Py_TYPE(obj);
  32936. PyObject *descr;
  32937. descrgetfunc f = NULL;
  32938. PyObject **dictptr, *dict;
  32939. int meth_found = 0;
  32940. assert (*method == NULL);
  32941. if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
  32942. attr = __Pyx_PyObject_GetAttrStr(obj, name);
  32943. goto try_unpack;
  32944. }
  32945. if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
  32946. return 0;
  32947. }
  32948. descr = _PyType_Lookup(tp, name);
  32949. if (likely(descr != NULL)) {
  32950. Py_INCREF(descr);
  32951. #if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR
  32952. if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR))
  32953. #else
  32954. #ifdef __Pyx_CyFunction_USED
  32955. if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
  32956. #else
  32957. if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type)))
  32958. #endif
  32959. #endif
  32960. {
  32961. meth_found = 1;
  32962. } else {
  32963. f = Py_TYPE(descr)->tp_descr_get;
  32964. if (f != NULL && PyDescr_IsData(descr)) {
  32965. attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
  32966. Py_DECREF(descr);
  32967. goto try_unpack;
  32968. }
  32969. }
  32970. }
  32971. dictptr = _PyObject_GetDictPtr(obj);
  32972. if (dictptr != NULL && (dict = *dictptr) != NULL) {
  32973. Py_INCREF(dict);
  32974. attr = __Pyx_PyDict_GetItemStr(dict, name);
  32975. if (attr != NULL) {
  32976. Py_INCREF(attr);
  32977. Py_DECREF(dict);
  32978. Py_XDECREF(descr);
  32979. goto try_unpack;
  32980. }
  32981. Py_DECREF(dict);
  32982. }
  32983. if (meth_found) {
  32984. *method = descr;
  32985. return 1;
  32986. }
  32987. if (f != NULL) {
  32988. attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
  32989. Py_DECREF(descr);
  32990. goto try_unpack;
  32991. }
  32992. if (likely(descr != NULL)) {
  32993. *method = descr;
  32994. return 0;
  32995. }
  32996. type_name = __Pyx_PyType_GetFullyQualifiedName(tp);
  32997. PyErr_Format(PyExc_AttributeError,
  32998. "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
  32999. type_name, name);
  33000. __Pyx_DECREF_TypeName(type_name);
  33001. return 0;
  33002. #else
  33003. attr = __Pyx_PyObject_GetAttrStr(obj, name);
  33004. goto try_unpack;
  33005. #endif
  33006. try_unpack:
  33007. #if CYTHON_UNPACK_METHODS
  33008. if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
  33009. PyObject *function = PyMethod_GET_FUNCTION(attr);
  33010. Py_INCREF(function);
  33011. Py_DECREF(attr);
  33012. *method = function;
  33013. return 1;
  33014. }
  33015. #endif
  33016. *method = attr;
  33017. return 0;
  33018. }
  33019. #endif
  33020. /* PyObjectCallMethod1 (used by CoroutineBase) */
  33021. #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
  33022. static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
  33023. PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
  33024. Py_DECREF(method);
  33025. return result;
  33026. }
  33027. #endif
  33028. static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
  33029. #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
  33030. PyObject *args[2] = {obj, arg};
  33031. (void) __Pyx_PyObject_CallOneArg;
  33032. (void) __Pyx_PyObject_Call2Args;
  33033. return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
  33034. #else
  33035. PyObject *method = NULL, *result;
  33036. int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
  33037. if (likely(is_method)) {
  33038. result = __Pyx_PyObject_Call2Args(method, obj, arg);
  33039. Py_DECREF(method);
  33040. return result;
  33041. }
  33042. if (unlikely(!method)) return NULL;
  33043. return __Pyx__PyObject_CallMethod1(method, arg);
  33044. #endif
  33045. }
  33046. /* PyObjectCallNoArg (used by CoroutineBase) */
  33047. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
  33048. PyObject *arg[2] = {NULL, NULL};
  33049. return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  33050. }
  33051. /* ReturnWithStopIteration (used by CoroutineBase) */
  33052. static void __Pyx__ReturnWithStopIteration(PyObject* value, int async);
  33053. static CYTHON_INLINE void __Pyx_ReturnWithStopIteration(PyObject* value, int async, int iternext) {
  33054. if (value == Py_None) {
  33055. if (async || !iternext)
  33056. PyErr_SetNone(async ? PyExc_StopAsyncIteration : PyExc_StopIteration);
  33057. return;
  33058. }
  33059. __Pyx__ReturnWithStopIteration(value, async);
  33060. }
  33061. static void __Pyx__ReturnWithStopIteration(PyObject* value, int async) {
  33062. #if CYTHON_COMPILING_IN_CPYTHON
  33063. __Pyx_PyThreadState_declare
  33064. #endif
  33065. PyObject *exc;
  33066. PyObject *exc_type = async ? PyExc_StopAsyncIteration : PyExc_StopIteration;
  33067. #if CYTHON_COMPILING_IN_CPYTHON
  33068. if ((PY_VERSION_HEX >= (0x030C00A6)) || unlikely(PyTuple_Check(value) || PyExceptionInstance_Check(value))) {
  33069. if (PY_VERSION_HEX >= (0x030e00A1)) {
  33070. exc = __Pyx_PyObject_CallOneArg(exc_type, value);
  33071. } else {
  33072. PyObject *args_tuple = PyTuple_New(1);
  33073. if (unlikely(!args_tuple)) return;
  33074. Py_INCREF(value);
  33075. PyTuple_SET_ITEM(args_tuple, 0, value);
  33076. exc = PyObject_Call(exc_type, args_tuple, NULL);
  33077. Py_DECREF(args_tuple);
  33078. }
  33079. if (unlikely(!exc)) return;
  33080. } else {
  33081. Py_INCREF(value);
  33082. exc = value;
  33083. }
  33084. #if CYTHON_FAST_THREAD_STATE
  33085. __Pyx_PyThreadState_assign
  33086. #if CYTHON_USE_EXC_INFO_STACK
  33087. if (!__pyx_tstate->exc_info->exc_value)
  33088. #else
  33089. if (!__pyx_tstate->exc_type)
  33090. #endif
  33091. {
  33092. Py_INCREF(exc_type);
  33093. __Pyx_ErrRestore(exc_type, exc, NULL);
  33094. return;
  33095. }
  33096. #endif
  33097. #else
  33098. exc = __Pyx_PyObject_CallOneArg(exc_type, value);
  33099. if (unlikely(!exc)) return;
  33100. #endif
  33101. PyErr_SetObject(exc_type, exc);
  33102. Py_DECREF(exc);
  33103. }
  33104. /* CoroutineBase (used by Generator) */
  33105. #if !CYTHON_COMPILING_IN_LIMITED_API
  33106. #include <frameobject.h>
  33107. #if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION)
  33108. #ifndef Py_BUILD_CORE
  33109. #define Py_BUILD_CORE 1
  33110. #endif
  33111. #include "internal/pycore_frame.h"
  33112. #endif
  33113. #endif // CYTHON_COMPILING_IN_LIMITED_API
  33114. static CYTHON_INLINE void
  33115. __Pyx_Coroutine_Undelegate(__pyx_CoroutineObject *gen) {
  33116. #if CYTHON_USE_AM_SEND
  33117. gen->yieldfrom_am_send = NULL;
  33118. #endif
  33119. Py_CLEAR(gen->yieldfrom);
  33120. }
  33121. static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *__pyx_tstate, PyObject **pvalue) {
  33122. PyObject *et, *ev, *tb;
  33123. PyObject *value = NULL;
  33124. CYTHON_UNUSED_VAR(__pyx_tstate);
  33125. __Pyx_ErrFetch(&et, &ev, &tb);
  33126. if (!et) {
  33127. Py_XDECREF(tb);
  33128. Py_XDECREF(ev);
  33129. Py_INCREF(Py_None);
  33130. *pvalue = Py_None;
  33131. return 0;
  33132. }
  33133. if (likely(et == PyExc_StopIteration)) {
  33134. if (!ev) {
  33135. Py_INCREF(Py_None);
  33136. value = Py_None;
  33137. }
  33138. else if (likely(__Pyx_IS_TYPE(ev, (PyTypeObject*)PyExc_StopIteration))) {
  33139. #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL
  33140. value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value);
  33141. if (unlikely(!value)) goto limited_api_failure;
  33142. #else
  33143. value = ((PyStopIterationObject *)ev)->value;
  33144. Py_INCREF(value);
  33145. #endif
  33146. Py_DECREF(ev);
  33147. }
  33148. else if (unlikely(PyTuple_Check(ev))) {
  33149. Py_ssize_t tuple_size = __Pyx_PyTuple_GET_SIZE(ev);
  33150. #if !CYTHON_ASSUME_SAFE_SIZE
  33151. if (unlikely(tuple_size < 0)) {
  33152. Py_XDECREF(tb);
  33153. Py_DECREF(ev);
  33154. Py_DECREF(et);
  33155. return -1;
  33156. }
  33157. #endif
  33158. if (tuple_size >= 1) {
  33159. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  33160. value = PyTuple_GET_ITEM(ev, 0);
  33161. Py_INCREF(value);
  33162. #elif CYTHON_ASSUME_SAFE_MACROS
  33163. value = PySequence_ITEM(ev, 0);
  33164. #else
  33165. value = PySequence_GetItem(ev, 0);
  33166. if (!value) goto limited_api_failure;
  33167. #endif
  33168. } else {
  33169. Py_INCREF(Py_None);
  33170. value = Py_None;
  33171. }
  33172. Py_DECREF(ev);
  33173. }
  33174. else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
  33175. value = ev;
  33176. }
  33177. if (likely(value)) {
  33178. Py_XDECREF(tb);
  33179. Py_DECREF(et);
  33180. *pvalue = value;
  33181. return 0;
  33182. }
  33183. } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
  33184. __Pyx_ErrRestore(et, ev, tb);
  33185. return -1;
  33186. }
  33187. PyErr_NormalizeException(&et, &ev, &tb);
  33188. if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
  33189. __Pyx_ErrRestore(et, ev, tb);
  33190. return -1;
  33191. }
  33192. Py_XDECREF(tb);
  33193. Py_DECREF(et);
  33194. #if CYTHON_COMPILING_IN_LIMITED_API
  33195. value = PyObject_GetAttr(ev, __pyx_mstate_global->__pyx_n_u_value);
  33196. #else
  33197. value = ((PyStopIterationObject *)ev)->value;
  33198. Py_INCREF(value);
  33199. #endif
  33200. Py_DECREF(ev);
  33201. #if CYTHON_COMPILING_IN_LIMITED_API
  33202. if (unlikely(!value)) return -1;
  33203. #endif
  33204. *pvalue = value;
  33205. return 0;
  33206. #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_GRAAL || !CYTHON_ASSUME_SAFE_MACROS
  33207. limited_api_failure:
  33208. Py_XDECREF(et);
  33209. Py_XDECREF(tb);
  33210. Py_XDECREF(ev);
  33211. return -1;
  33212. #endif
  33213. }
  33214. static CYTHON_INLINE
  33215. __Pyx_PySendResult __Pyx_Coroutine_status_from_result(PyObject **retval) {
  33216. if (*retval) {
  33217. return PYGEN_NEXT;
  33218. } else if (likely(__Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, retval) == 0)) {
  33219. return PYGEN_RETURN;
  33220. } else {
  33221. return PYGEN_ERROR;
  33222. }
  33223. }
  33224. static CYTHON_INLINE
  33225. void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
  33226. #if PY_VERSION_HEX >= 0x030B00a4
  33227. Py_CLEAR(exc_state->exc_value);
  33228. #else
  33229. PyObject *t, *v, *tb;
  33230. t = exc_state->exc_type;
  33231. v = exc_state->exc_value;
  33232. tb = exc_state->exc_traceback;
  33233. exc_state->exc_type = NULL;
  33234. exc_state->exc_value = NULL;
  33235. exc_state->exc_traceback = NULL;
  33236. Py_XDECREF(t);
  33237. Py_XDECREF(v);
  33238. Py_XDECREF(tb);
  33239. #endif
  33240. }
  33241. #define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
  33242. static void __Pyx__Coroutine_AlreadyRunningError(__pyx_CoroutineObject *gen) {
  33243. const char *msg;
  33244. CYTHON_MAYBE_UNUSED_VAR(gen);
  33245. if ((0)) {
  33246. #ifdef __Pyx_Coroutine_USED
  33247. } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
  33248. msg = "coroutine already executing";
  33249. #endif
  33250. #ifdef __Pyx_AsyncGen_USED
  33251. } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
  33252. msg = "async generator already executing";
  33253. #endif
  33254. } else {
  33255. msg = "generator already executing";
  33256. }
  33257. PyErr_SetString(PyExc_ValueError, msg);
  33258. }
  33259. static void __Pyx_Coroutine_AlreadyTerminatedError(PyObject *gen, PyObject *value, int closing) {
  33260. CYTHON_MAYBE_UNUSED_VAR(gen);
  33261. CYTHON_MAYBE_UNUSED_VAR(closing);
  33262. #ifdef __Pyx_Coroutine_USED
  33263. if (!closing && __Pyx_Coroutine_Check(gen)) {
  33264. PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
  33265. } else
  33266. #endif
  33267. if (value) {
  33268. #ifdef __Pyx_AsyncGen_USED
  33269. if (__Pyx_AsyncGen_CheckExact(gen))
  33270. PyErr_SetNone(PyExc_StopAsyncIteration);
  33271. else
  33272. #endif
  33273. PyErr_SetNone(PyExc_StopIteration);
  33274. }
  33275. }
  33276. static
  33277. __Pyx_PySendResult __Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, PyObject **result, int closing) {
  33278. __Pyx_PyThreadState_declare
  33279. PyThreadState *tstate;
  33280. __Pyx_ExcInfoStruct *exc_state;
  33281. PyObject *retval;
  33282. assert(__Pyx_Coroutine_get_is_running(self)); // Callers should ensure is_running
  33283. if (unlikely(self->resume_label == -1)) {
  33284. __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
  33285. return PYGEN_ERROR;
  33286. }
  33287. #if CYTHON_FAST_THREAD_STATE
  33288. __Pyx_PyThreadState_assign
  33289. tstate = __pyx_tstate;
  33290. #else
  33291. tstate = __Pyx_PyThreadState_Current;
  33292. #endif
  33293. exc_state = &self->gi_exc_state;
  33294. if (exc_state->exc_value) {
  33295. #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
  33296. #else
  33297. PyObject *exc_tb;
  33298. #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
  33299. exc_tb = PyException_GetTraceback(exc_state->exc_value);
  33300. #elif PY_VERSION_HEX >= 0x030B00a4
  33301. exc_tb = ((PyBaseExceptionObject*) exc_state->exc_value)->traceback;
  33302. #else
  33303. exc_tb = exc_state->exc_traceback;
  33304. #endif
  33305. if (exc_tb) {
  33306. PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
  33307. PyFrameObject *f = tb->tb_frame;
  33308. assert(f->f_back == NULL);
  33309. #if PY_VERSION_HEX >= 0x030B00A1
  33310. f->f_back = PyThreadState_GetFrame(tstate);
  33311. #else
  33312. Py_XINCREF(tstate->frame);
  33313. f->f_back = tstate->frame;
  33314. #endif
  33315. #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_CPYTHON
  33316. Py_DECREF(exc_tb);
  33317. #endif
  33318. }
  33319. #endif
  33320. }
  33321. #if CYTHON_USE_EXC_INFO_STACK
  33322. exc_state->previous_item = tstate->exc_info;
  33323. tstate->exc_info = exc_state;
  33324. #else
  33325. if (exc_state->exc_type) {
  33326. __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
  33327. } else {
  33328. __Pyx_Coroutine_ExceptionClear(exc_state);
  33329. __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
  33330. }
  33331. #endif
  33332. retval = self->body(self, tstate, value);
  33333. #if CYTHON_USE_EXC_INFO_STACK
  33334. exc_state = &self->gi_exc_state;
  33335. tstate->exc_info = exc_state->previous_item;
  33336. exc_state->previous_item = NULL;
  33337. __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
  33338. #endif
  33339. *result = retval;
  33340. if (self->resume_label == -1) {
  33341. return likely(retval) ? PYGEN_RETURN : PYGEN_ERROR;
  33342. }
  33343. return PYGEN_NEXT;
  33344. }
  33345. static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
  33346. #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
  33347. CYTHON_UNUSED_VAR(exc_state);
  33348. #else
  33349. PyObject *exc_tb;
  33350. #if PY_VERSION_HEX >= 0x030B00a4
  33351. if (!exc_state->exc_value) return;
  33352. exc_tb = PyException_GetTraceback(exc_state->exc_value);
  33353. #else
  33354. exc_tb = exc_state->exc_traceback;
  33355. #endif
  33356. if (likely(exc_tb)) {
  33357. PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
  33358. PyFrameObject *f = tb->tb_frame;
  33359. Py_CLEAR(f->f_back);
  33360. #if PY_VERSION_HEX >= 0x030B00a4
  33361. Py_DECREF(exc_tb);
  33362. #endif
  33363. }
  33364. #endif
  33365. }
  33366. #define __Pyx_Coroutine_MethodReturnFromResult(gen, result, retval, iternext)\
  33367. ((result) == PYGEN_NEXT ? (retval) : __Pyx__Coroutine_MethodReturnFromResult(gen, result, retval, iternext))
  33368. static PyObject *
  33369. __Pyx__Coroutine_MethodReturnFromResult(PyObject* gen, __Pyx_PySendResult result, PyObject *retval, int iternext) {
  33370. CYTHON_MAYBE_UNUSED_VAR(gen);
  33371. if (likely(result == PYGEN_RETURN)) {
  33372. int is_async = 0;
  33373. #ifdef __Pyx_AsyncGen_USED
  33374. is_async = __Pyx_AsyncGen_CheckExact(gen);
  33375. #endif
  33376. __Pyx_ReturnWithStopIteration(retval, is_async, iternext);
  33377. Py_XDECREF(retval);
  33378. }
  33379. return NULL;
  33380. }
  33381. #if CYTHON_COMPILING_IN_CPYTHON
  33382. static CYTHON_INLINE
  33383. PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) {
  33384. #if PY_VERSION_HEX <= 0x030A00A1
  33385. return _PyGen_Send(gen, arg);
  33386. #else
  33387. PyObject *result;
  33388. if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) {
  33389. if (PyAsyncGen_CheckExact(gen)) {
  33390. assert(result == Py_None);
  33391. PyErr_SetNone(PyExc_StopAsyncIteration);
  33392. }
  33393. else if (result == Py_None) {
  33394. PyErr_SetNone(PyExc_StopIteration);
  33395. }
  33396. else {
  33397. #if PY_VERSION_HEX < 0x030d00A1
  33398. _PyGen_SetStopIterationValue(result);
  33399. #else
  33400. if (!PyTuple_Check(result) && !PyExceptionInstance_Check(result)) {
  33401. PyErr_SetObject(PyExc_StopIteration, result);
  33402. } else {
  33403. PyObject *exc = __Pyx_PyObject_CallOneArg(PyExc_StopIteration, result);
  33404. if (likely(exc != NULL)) {
  33405. PyErr_SetObject(PyExc_StopIteration, exc);
  33406. Py_DECREF(exc);
  33407. }
  33408. }
  33409. #endif
  33410. }
  33411. Py_DECREF(result);
  33412. result = NULL;
  33413. }
  33414. return result;
  33415. #endif
  33416. }
  33417. #endif
  33418. static CYTHON_INLINE __Pyx_PySendResult
  33419. __Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen, PyObject** retval) {
  33420. __Pyx_PySendResult result;
  33421. PyObject *val = NULL;
  33422. assert(__Pyx_Coroutine_get_is_running(gen));
  33423. __Pyx_Coroutine_Undelegate(gen);
  33424. __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
  33425. result = __Pyx_Coroutine_SendEx(gen, val, retval, 0);
  33426. Py_XDECREF(val);
  33427. return result;
  33428. }
  33429. #if CYTHON_USE_AM_SEND
  33430. static __Pyx_PySendResult
  33431. __Pyx_Coroutine_SendToDelegate(__pyx_CoroutineObject *gen, __Pyx_pyiter_sendfunc gen_am_send, PyObject *value, PyObject **retval) {
  33432. PyObject *ret = NULL;
  33433. __Pyx_PySendResult delegate_result, result;
  33434. assert(__Pyx_Coroutine_get_is_running(gen));
  33435. delegate_result = gen_am_send(gen->yieldfrom, value, &ret);
  33436. if (delegate_result == PYGEN_NEXT) {
  33437. assert (ret != NULL);
  33438. *retval = ret;
  33439. return PYGEN_NEXT;
  33440. }
  33441. assert (delegate_result != PYGEN_ERROR || ret == NULL);
  33442. __Pyx_Coroutine_Undelegate(gen);
  33443. result = __Pyx_Coroutine_SendEx(gen, ret, retval, 0);
  33444. Py_XDECREF(ret);
  33445. return result;
  33446. }
  33447. #endif
  33448. static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
  33449. PyObject *retval = NULL;
  33450. __Pyx_PySendResult result = __Pyx_Coroutine_AmSend(self, value, &retval);
  33451. return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0);
  33452. }
  33453. static __Pyx_PySendResult
  33454. __Pyx_Coroutine_AmSend(PyObject *self, PyObject *value, PyObject **retval) {
  33455. __Pyx_PySendResult result;
  33456. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
  33457. if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
  33458. *retval = __Pyx_Coroutine_AlreadyRunningError(gen);
  33459. return PYGEN_ERROR;
  33460. }
  33461. #if CYTHON_USE_AM_SEND
  33462. if (gen->yieldfrom_am_send) {
  33463. result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, value, retval);
  33464. } else
  33465. #endif
  33466. if (gen->yieldfrom) {
  33467. PyObject *yf = gen->yieldfrom;
  33468. PyObject *ret;
  33469. #if !CYTHON_USE_AM_SEND
  33470. #ifdef __Pyx_Generator_USED
  33471. if (__Pyx_Generator_CheckExact(yf)) {
  33472. ret = __Pyx_Coroutine_Send(yf, value);
  33473. } else
  33474. #endif
  33475. #ifdef __Pyx_Coroutine_USED
  33476. if (__Pyx_Coroutine_Check(yf)) {
  33477. ret = __Pyx_Coroutine_Send(yf, value);
  33478. } else
  33479. #endif
  33480. #ifdef __Pyx_AsyncGen_USED
  33481. if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
  33482. ret = __Pyx_async_gen_asend_send(yf, value);
  33483. } else
  33484. #endif
  33485. #if CYTHON_COMPILING_IN_CPYTHON
  33486. if (PyGen_CheckExact(yf)) {
  33487. ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
  33488. } else
  33489. if (PyCoro_CheckExact(yf)) {
  33490. ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
  33491. } else
  33492. #endif
  33493. #endif
  33494. {
  33495. #if !CYTHON_COMPILING_IN_LIMITED_API || __PYX_LIMITED_VERSION_HEX >= 0x03080000
  33496. if (value == Py_None && PyIter_Check(yf))
  33497. ret = __Pyx_PyIter_Next_Plain(yf);
  33498. else
  33499. #endif
  33500. ret = __Pyx_PyObject_CallMethod1(yf, __pyx_mstate_global->__pyx_n_u_send, value);
  33501. }
  33502. if (likely(ret)) {
  33503. __Pyx_Coroutine_unset_is_running(gen);
  33504. *retval = ret;
  33505. return PYGEN_NEXT;
  33506. }
  33507. result = __Pyx_Coroutine_FinishDelegation(gen, retval);
  33508. } else {
  33509. result = __Pyx_Coroutine_SendEx(gen, value, retval, 0);
  33510. }
  33511. __Pyx_Coroutine_unset_is_running(gen);
  33512. return result;
  33513. }
  33514. static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
  33515. __Pyx_PySendResult result;
  33516. PyObject *retval = NULL;
  33517. CYTHON_UNUSED_VAR(gen);
  33518. assert(__Pyx_Coroutine_get_is_running(gen));
  33519. #ifdef __Pyx_Generator_USED
  33520. if (__Pyx_Generator_CheckExact(yf)) {
  33521. result = __Pyx_Coroutine_Close(yf, &retval);
  33522. } else
  33523. #endif
  33524. #ifdef __Pyx_Coroutine_USED
  33525. if (__Pyx_Coroutine_Check(yf)) {
  33526. result = __Pyx_Coroutine_Close(yf, &retval);
  33527. } else
  33528. if (__Pyx_CoroutineAwait_CheckExact(yf)) {
  33529. result = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf);
  33530. } else
  33531. #endif
  33532. #ifdef __Pyx_AsyncGen_USED
  33533. if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
  33534. retval = __Pyx_async_gen_asend_close(yf, NULL);
  33535. result = PYGEN_RETURN;
  33536. } else
  33537. if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
  33538. retval = __Pyx_async_gen_athrow_close(yf, NULL);
  33539. result = PYGEN_RETURN;
  33540. } else
  33541. #endif
  33542. {
  33543. PyObject *meth;
  33544. result = PYGEN_RETURN;
  33545. meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_close);
  33546. if (unlikely(!meth)) {
  33547. if (unlikely(PyErr_Occurred())) {
  33548. PyErr_WriteUnraisable(yf);
  33549. }
  33550. } else {
  33551. retval = __Pyx_PyObject_CallNoArg(meth);
  33552. Py_DECREF(meth);
  33553. if (unlikely(!retval)) {
  33554. result = PYGEN_ERROR;
  33555. }
  33556. }
  33557. }
  33558. Py_XDECREF(retval);
  33559. return result == PYGEN_ERROR ? -1 : 0;
  33560. }
  33561. static PyObject *__Pyx_Generator_Next(PyObject *self) {
  33562. __Pyx_PySendResult result;
  33563. PyObject *retval = NULL;
  33564. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
  33565. if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
  33566. return __Pyx_Coroutine_AlreadyRunningError(gen);
  33567. }
  33568. #if CYTHON_USE_AM_SEND
  33569. if (gen->yieldfrom_am_send) {
  33570. result = __Pyx_Coroutine_SendToDelegate(gen, gen->yieldfrom_am_send, Py_None, &retval);
  33571. } else
  33572. #endif
  33573. if (gen->yieldfrom) {
  33574. PyObject *yf = gen->yieldfrom;
  33575. PyObject *ret;
  33576. #ifdef __Pyx_Generator_USED
  33577. if (__Pyx_Generator_CheckExact(yf)) {
  33578. ret = __Pyx_Generator_Next(yf);
  33579. } else
  33580. #endif
  33581. #ifdef __Pyx_Coroutine_USED
  33582. if (__Pyx_Coroutine_CheckExact(yf)) {
  33583. ret = __Pyx_Coroutine_Send(yf, Py_None);
  33584. } else
  33585. #endif
  33586. #if CYTHON_COMPILING_IN_CPYTHON && (PY_VERSION_HEX < 0x030A00A3 || !CYTHON_USE_AM_SEND)
  33587. if (PyGen_CheckExact(yf)) {
  33588. ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
  33589. } else
  33590. #endif
  33591. ret = __Pyx_PyIter_Next_Plain(yf);
  33592. if (likely(ret)) {
  33593. __Pyx_Coroutine_unset_is_running(gen);
  33594. return ret;
  33595. }
  33596. result = __Pyx_Coroutine_FinishDelegation(gen, &retval);
  33597. } else {
  33598. result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0);
  33599. }
  33600. __Pyx_Coroutine_unset_is_running(gen);
  33601. return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 1);
  33602. }
  33603. static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, PyObject *arg) {
  33604. PyObject *retval = NULL;
  33605. __Pyx_PySendResult result;
  33606. CYTHON_UNUSED_VAR(arg);
  33607. result = __Pyx_Coroutine_Close(self, &retval);
  33608. if (unlikely(result == PYGEN_ERROR))
  33609. return NULL;
  33610. Py_XDECREF(retval);
  33611. Py_RETURN_NONE;
  33612. }
  33613. static __Pyx_PySendResult
  33614. __Pyx_Coroutine_Close(PyObject *self, PyObject **retval) {
  33615. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  33616. __Pyx_PySendResult result;
  33617. PyObject *yf;
  33618. int err = 0;
  33619. if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
  33620. *retval = __Pyx_Coroutine_AlreadyRunningError(gen);
  33621. return PYGEN_ERROR;
  33622. }
  33623. yf = gen->yieldfrom;
  33624. if (yf) {
  33625. Py_INCREF(yf);
  33626. err = __Pyx_Coroutine_CloseIter(gen, yf);
  33627. __Pyx_Coroutine_Undelegate(gen);
  33628. Py_DECREF(yf);
  33629. }
  33630. if (err == 0)
  33631. PyErr_SetNone(PyExc_GeneratorExit);
  33632. result = __Pyx_Coroutine_SendEx(gen, NULL, retval, 1);
  33633. if (result == PYGEN_ERROR) {
  33634. __Pyx_PyThreadState_declare
  33635. __Pyx_PyThreadState_assign
  33636. __Pyx_Coroutine_unset_is_running(gen);
  33637. if (!__Pyx_PyErr_Occurred()) {
  33638. return PYGEN_RETURN;
  33639. } else if (likely(__Pyx_PyErr_ExceptionMatches2(PyExc_GeneratorExit, PyExc_StopIteration))) {
  33640. __Pyx_PyErr_Clear();
  33641. return PYGEN_RETURN;
  33642. }
  33643. return PYGEN_ERROR;
  33644. } else if (likely(result == PYGEN_RETURN && *retval == Py_None)) {
  33645. __Pyx_Coroutine_unset_is_running(gen);
  33646. return PYGEN_RETURN;
  33647. } else {
  33648. const char *msg;
  33649. Py_DECREF(*retval);
  33650. *retval = NULL;
  33651. if ((0)) {
  33652. #ifdef __Pyx_Coroutine_USED
  33653. } else if (__Pyx_Coroutine_Check(self)) {
  33654. msg = "coroutine ignored GeneratorExit";
  33655. #endif
  33656. #ifdef __Pyx_AsyncGen_USED
  33657. } else if (__Pyx_AsyncGen_CheckExact(self)) {
  33658. msg = "async generator ignored GeneratorExit";
  33659. #endif
  33660. } else {
  33661. msg = "generator ignored GeneratorExit";
  33662. }
  33663. PyErr_SetString(PyExc_RuntimeError, msg);
  33664. __Pyx_Coroutine_unset_is_running(gen);
  33665. return PYGEN_ERROR;
  33666. }
  33667. }
  33668. static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
  33669. PyObject *args, int close_on_genexit) {
  33670. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  33671. PyObject *yf;
  33672. if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen)))
  33673. return __Pyx_Coroutine_AlreadyRunningError(gen);
  33674. yf = gen->yieldfrom;
  33675. if (yf) {
  33676. __Pyx_PySendResult result;
  33677. PyObject *ret;
  33678. Py_INCREF(yf);
  33679. if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
  33680. int err = __Pyx_Coroutine_CloseIter(gen, yf);
  33681. Py_DECREF(yf);
  33682. __Pyx_Coroutine_Undelegate(gen);
  33683. if (err < 0)
  33684. goto propagate_exception;
  33685. goto throw_here;
  33686. }
  33687. if (0
  33688. #ifdef __Pyx_Generator_USED
  33689. || __Pyx_Generator_CheckExact(yf)
  33690. #endif
  33691. #ifdef __Pyx_Coroutine_USED
  33692. || __Pyx_Coroutine_Check(yf)
  33693. #endif
  33694. ) {
  33695. ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
  33696. #ifdef __Pyx_Coroutine_USED
  33697. } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
  33698. ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
  33699. #endif
  33700. } else {
  33701. PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(yf, __pyx_mstate_global->__pyx_n_u_throw);
  33702. if (unlikely(!meth)) {
  33703. Py_DECREF(yf);
  33704. if (unlikely(PyErr_Occurred())) {
  33705. __Pyx_Coroutine_unset_is_running(gen);
  33706. return NULL;
  33707. }
  33708. __Pyx_Coroutine_Undelegate(gen);
  33709. goto throw_here;
  33710. }
  33711. if (likely(args)) {
  33712. ret = __Pyx_PyObject_Call(meth, args, NULL);
  33713. } else {
  33714. PyObject *cargs[4] = {NULL, typ, val, tb};
  33715. ret = __Pyx_PyObject_FastCall(meth, cargs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
  33716. }
  33717. Py_DECREF(meth);
  33718. }
  33719. Py_DECREF(yf);
  33720. if (ret) {
  33721. __Pyx_Coroutine_unset_is_running(gen);
  33722. return ret;
  33723. }
  33724. result = __Pyx_Coroutine_FinishDelegation(gen, &ret);
  33725. __Pyx_Coroutine_unset_is_running(gen);
  33726. return __Pyx_Coroutine_MethodReturnFromResult(self, result, ret, 0);
  33727. }
  33728. throw_here:
  33729. __Pyx_Raise(typ, val, tb, NULL);
  33730. propagate_exception:
  33731. {
  33732. PyObject *retval = NULL;
  33733. __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, NULL, &retval, 0);
  33734. __Pyx_Coroutine_unset_is_running(gen);
  33735. return __Pyx_Coroutine_MethodReturnFromResult(self, result, retval, 0);
  33736. }
  33737. }
  33738. static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
  33739. PyObject *typ;
  33740. PyObject *val = NULL;
  33741. PyObject *tb = NULL;
  33742. if (unlikely(!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb)))
  33743. return NULL;
  33744. return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
  33745. }
  33746. static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
  33747. #if PY_VERSION_HEX >= 0x030B00a4
  33748. Py_VISIT(exc_state->exc_value);
  33749. #else
  33750. Py_VISIT(exc_state->exc_type);
  33751. Py_VISIT(exc_state->exc_value);
  33752. Py_VISIT(exc_state->exc_traceback);
  33753. #endif
  33754. return 0;
  33755. }
  33756. static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
  33757. {
  33758. int e = __Pyx_call_type_traverse((PyObject*)gen, 1, visit, arg);
  33759. if (e) return e;
  33760. }
  33761. Py_VISIT(gen->closure);
  33762. Py_VISIT(gen->classobj);
  33763. Py_VISIT(gen->yieldfrom);
  33764. return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
  33765. }
  33766. static int __Pyx_Coroutine_clear(PyObject *self) {
  33767. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  33768. Py_CLEAR(gen->closure);
  33769. Py_CLEAR(gen->classobj);
  33770. __Pyx_Coroutine_Undelegate(gen);
  33771. __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
  33772. #ifdef __Pyx_AsyncGen_USED
  33773. if (__Pyx_AsyncGen_CheckExact(self)) {
  33774. Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
  33775. }
  33776. #endif
  33777. Py_CLEAR(gen->gi_code);
  33778. Py_CLEAR(gen->gi_frame);
  33779. Py_CLEAR(gen->gi_name);
  33780. Py_CLEAR(gen->gi_qualname);
  33781. Py_CLEAR(gen->gi_modulename);
  33782. return 0;
  33783. }
  33784. static void __Pyx_Coroutine_dealloc(PyObject *self) {
  33785. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  33786. PyObject_GC_UnTrack(gen);
  33787. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  33788. if (gen->gi_weakreflist != NULL)
  33789. #endif
  33790. PyObject_ClearWeakRefs(self);
  33791. if (gen->resume_label >= 0) {
  33792. PyObject_GC_Track(self);
  33793. #if CYTHON_USE_TP_FINALIZE
  33794. if (unlikely(PyObject_CallFinalizerFromDealloc(self)))
  33795. #else
  33796. {
  33797. destructor del = __Pyx_PyObject_GetSlot(gen, tp_del, destructor);
  33798. if (del) del(self);
  33799. }
  33800. if (unlikely(Py_REFCNT(self) > 0))
  33801. #endif
  33802. {
  33803. return;
  33804. }
  33805. PyObject_GC_UnTrack(self);
  33806. }
  33807. #ifdef __Pyx_AsyncGen_USED
  33808. if (__Pyx_AsyncGen_CheckExact(self)) {
  33809. /* We have to handle this case for asynchronous generators
  33810. right here, because this code has to be between UNTRACK
  33811. and GC_Del. */
  33812. Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
  33813. }
  33814. #endif
  33815. __Pyx_Coroutine_clear(self);
  33816. __Pyx_PyHeapTypeObject_GC_Del(gen);
  33817. }
  33818. #if CYTHON_USE_TP_FINALIZE
  33819. static void __Pyx_Coroutine_del(PyObject *self) {
  33820. PyObject *error_type, *error_value, *error_traceback;
  33821. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
  33822. __Pyx_PyThreadState_declare
  33823. if (gen->resume_label < 0) {
  33824. return;
  33825. }
  33826. __Pyx_PyThreadState_assign
  33827. __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
  33828. #ifdef __Pyx_AsyncGen_USED
  33829. if (__Pyx_AsyncGen_CheckExact(self)) {
  33830. __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
  33831. PyObject *finalizer = agen->ag_finalizer;
  33832. if (finalizer && !agen->ag_closed) {
  33833. PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
  33834. if (unlikely(!res)) {
  33835. PyErr_WriteUnraisable(self);
  33836. } else {
  33837. Py_DECREF(res);
  33838. }
  33839. __Pyx_ErrRestore(error_type, error_value, error_traceback);
  33840. return;
  33841. }
  33842. }
  33843. #endif
  33844. if (unlikely(gen->resume_label == 0 && !error_value)) {
  33845. #ifdef __Pyx_Coroutine_USED
  33846. #ifdef __Pyx_Generator_USED
  33847. if (!__Pyx_Generator_CheckExact(self))
  33848. #endif
  33849. {
  33850. PyObject_GC_UnTrack(self);
  33851. if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
  33852. PyErr_WriteUnraisable(self);
  33853. PyObject_GC_Track(self);
  33854. }
  33855. #endif
  33856. } else {
  33857. PyObject *retval = NULL;
  33858. __Pyx_PySendResult result = __Pyx_Coroutine_Close(self, &retval);
  33859. if (result == PYGEN_ERROR) {
  33860. PyErr_WriteUnraisable(self);
  33861. } else {
  33862. Py_XDECREF(retval);
  33863. }
  33864. }
  33865. __Pyx_ErrRestore(error_type, error_value, error_traceback);
  33866. }
  33867. #endif
  33868. static PyObject *
  33869. __Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, void *context)
  33870. {
  33871. PyObject *name = self->gi_name;
  33872. CYTHON_UNUSED_VAR(context);
  33873. if (unlikely(!name)) name = Py_None;
  33874. Py_INCREF(name);
  33875. return name;
  33876. }
  33877. static int
  33878. __Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, void *context)
  33879. {
  33880. CYTHON_UNUSED_VAR(context);
  33881. if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  33882. PyErr_SetString(PyExc_TypeError,
  33883. "__name__ must be set to a string object");
  33884. return -1;
  33885. }
  33886. Py_INCREF(value);
  33887. __Pyx_Py_XDECREF_SET(self->gi_name, value);
  33888. return 0;
  33889. }
  33890. static PyObject *
  33891. __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, void *context)
  33892. {
  33893. PyObject *name = self->gi_qualname;
  33894. CYTHON_UNUSED_VAR(context);
  33895. if (unlikely(!name)) name = Py_None;
  33896. Py_INCREF(name);
  33897. return name;
  33898. }
  33899. static int
  33900. __Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, void *context)
  33901. {
  33902. CYTHON_UNUSED_VAR(context);
  33903. if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  33904. PyErr_SetString(PyExc_TypeError,
  33905. "__qualname__ must be set to a string object");
  33906. return -1;
  33907. }
  33908. Py_INCREF(value);
  33909. __Pyx_Py_XDECREF_SET(self->gi_qualname, value);
  33910. return 0;
  33911. }
  33912. static PyObject *
  33913. __Pyx__Coroutine_get_frame(__pyx_CoroutineObject *self)
  33914. {
  33915. #if !CYTHON_COMPILING_IN_LIMITED_API
  33916. PyObject *frame;
  33917. #if PY_VERSION_HEX >= 0x030d0000
  33918. Py_BEGIN_CRITICAL_SECTION(self);
  33919. #endif
  33920. frame = self->gi_frame;
  33921. if (!frame) {
  33922. if (unlikely(!self->gi_code)) {
  33923. Py_RETURN_NONE;
  33924. }
  33925. PyObject *globals = PyDict_New();
  33926. if (unlikely(!globals)) return NULL;
  33927. frame = (PyObject *) PyFrame_New(
  33928. PyThreadState_Get(), /*PyThreadState *tstate,*/
  33929. (PyCodeObject*) self->gi_code, /*PyCodeObject *code,*/
  33930. globals, /*PyObject *globals,*/
  33931. 0 /*PyObject *locals*/
  33932. );
  33933. Py_DECREF(globals);
  33934. if (unlikely(!frame))
  33935. return NULL;
  33936. if (unlikely(self->gi_frame)) {
  33937. Py_DECREF(frame);
  33938. frame = self->gi_frame;
  33939. } else {
  33940. self->gi_frame = frame;
  33941. }
  33942. }
  33943. Py_INCREF(frame);
  33944. #if PY_VERSION_HEX >= 0x030d0000
  33945. Py_END_CRITICAL_SECTION();
  33946. #endif
  33947. return frame;
  33948. #else
  33949. CYTHON_UNUSED_VAR(self);
  33950. Py_RETURN_NONE;
  33951. #endif
  33952. }
  33953. static PyObject *
  33954. __Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, void *context) {
  33955. CYTHON_UNUSED_VAR(context);
  33956. PyObject *frame = self->gi_frame;
  33957. if (frame)
  33958. return __Pyx_NewRef(frame);
  33959. return __Pyx__Coroutine_get_frame(self);
  33960. }
  33961. static __pyx_CoroutineObject *__Pyx__Coroutine_New(
  33962. PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  33963. PyObject *name, PyObject *qualname, PyObject *module_name) {
  33964. __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
  33965. if (unlikely(!gen))
  33966. return NULL;
  33967. return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
  33968. }
  33969. static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
  33970. __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
  33971. PyObject *name, PyObject *qualname, PyObject *module_name) {
  33972. gen->body = body;
  33973. gen->closure = closure;
  33974. Py_XINCREF(closure);
  33975. gen->is_running = 0;
  33976. gen->resume_label = 0;
  33977. gen->classobj = NULL;
  33978. gen->yieldfrom = NULL;
  33979. gen->yieldfrom_am_send = NULL;
  33980. #if PY_VERSION_HEX >= 0x030B00a4 && !CYTHON_COMPILING_IN_LIMITED_API
  33981. gen->gi_exc_state.exc_value = NULL;
  33982. #else
  33983. gen->gi_exc_state.exc_type = NULL;
  33984. gen->gi_exc_state.exc_value = NULL;
  33985. gen->gi_exc_state.exc_traceback = NULL;
  33986. #endif
  33987. #if CYTHON_USE_EXC_INFO_STACK
  33988. gen->gi_exc_state.previous_item = NULL;
  33989. #endif
  33990. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  33991. gen->gi_weakreflist = NULL;
  33992. #endif
  33993. Py_XINCREF(qualname);
  33994. gen->gi_qualname = qualname;
  33995. Py_XINCREF(name);
  33996. gen->gi_name = name;
  33997. Py_XINCREF(module_name);
  33998. gen->gi_modulename = module_name;
  33999. Py_XINCREF(code);
  34000. gen->gi_code = code;
  34001. gen->gi_frame = NULL;
  34002. PyObject_GC_Track(gen);
  34003. return gen;
  34004. }
  34005. static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen) {
  34006. char result;
  34007. #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
  34008. Py_BEGIN_CRITICAL_SECTION(gen);
  34009. #endif
  34010. result = gen->is_running;
  34011. gen->is_running = 1;
  34012. #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
  34013. Py_END_CRITICAL_SECTION();
  34014. #endif
  34015. return result;
  34016. }
  34017. static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen) {
  34018. #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
  34019. Py_BEGIN_CRITICAL_SECTION(gen);
  34020. #endif
  34021. assert(gen->is_running);
  34022. gen->is_running = 0;
  34023. #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
  34024. Py_END_CRITICAL_SECTION();
  34025. #endif
  34026. }
  34027. static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen) {
  34028. char result;
  34029. #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
  34030. Py_BEGIN_CRITICAL_SECTION(gen);
  34031. #endif
  34032. result = gen->is_running;
  34033. #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
  34034. Py_END_CRITICAL_SECTION();
  34035. #endif
  34036. return result;
  34037. }
  34038. static PyObject *__Pyx_Coroutine_get_is_running_getter(PyObject *gen, void *closure) {
  34039. CYTHON_UNUSED_VAR(closure);
  34040. char result = __Pyx_Coroutine_get_is_running((__pyx_CoroutineObject*)gen);
  34041. if (result) Py_RETURN_TRUE;
  34042. else Py_RETURN_FALSE;
  34043. }
  34044. #if __PYX_HAS_PY_AM_SEND == 2
  34045. static void __Pyx_SetBackportTypeAmSend(PyTypeObject *type, __Pyx_PyAsyncMethodsStruct *static_amsend_methods, __Pyx_pyiter_sendfunc am_send) {
  34046. Py_ssize_t ptr_offset = (char*)(type->tp_as_async) - (char*)type;
  34047. if (ptr_offset < 0 || ptr_offset > type->tp_basicsize) {
  34048. return;
  34049. }
  34050. memcpy((void*)static_amsend_methods, (void*)(type->tp_as_async), sizeof(*type->tp_as_async));
  34051. static_amsend_methods->am_send = am_send;
  34052. type->tp_as_async = __Pyx_SlotTpAsAsync(static_amsend_methods);
  34053. }
  34054. #endif
  34055. static PyObject *__Pyx_Coroutine_fail_reduce_ex(PyObject *self, PyObject *arg) {
  34056. CYTHON_UNUSED_VAR(arg);
  34057. __Pyx_TypeName self_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE((PyObject*)self));
  34058. PyErr_Format(PyExc_TypeError, "cannot pickle '" __Pyx_FMT_TYPENAME "' object",
  34059. self_type_name);
  34060. __Pyx_DECREF_TypeName(self_type_name);
  34061. return NULL;
  34062. }
  34063. /* Generator (used by GeneratorYieldFrom) */
  34064. static PyMethodDef __pyx_Generator_methods[] = {
  34065. {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
  34066. PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
  34067. {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
  34068. PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
  34069. {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
  34070. PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
  34071. {"__reduce_ex__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_O, 0},
  34072. {"__reduce__", (PyCFunction) __Pyx_Coroutine_fail_reduce_ex, METH_NOARGS, 0},
  34073. {0, 0, 0, 0}
  34074. };
  34075. static PyMemberDef __pyx_Generator_memberlist[] = {
  34076. {"gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
  34077. PyDoc_STR("object being iterated by 'yield from', or None")},
  34078. {"gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
  34079. {"__module__", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_modulename), 0, 0},
  34080. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  34081. {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0},
  34082. #endif
  34083. {0, 0, 0, 0, 0}
  34084. };
  34085. static PyGetSetDef __pyx_Generator_getsets[] = {
  34086. {"__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
  34087. PyDoc_STR("name of the generator"), 0},
  34088. {"__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
  34089. PyDoc_STR("qualified name of the generator"), 0},
  34090. {"gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
  34091. PyDoc_STR("Frame of the generator"), 0},
  34092. {"gi_running", __Pyx_Coroutine_get_is_running_getter, NULL, NULL, NULL},
  34093. {0, 0, 0, 0, 0}
  34094. };
  34095. static PyType_Slot __pyx_GeneratorType_slots[] = {
  34096. {Py_tp_dealloc, (void *)__Pyx_Coroutine_dealloc},
  34097. {Py_tp_traverse, (void *)__Pyx_Coroutine_traverse},
  34098. {Py_tp_iter, (void *)PyObject_SelfIter},
  34099. {Py_tp_iternext, (void *)__Pyx_Generator_Next},
  34100. {Py_tp_methods, (void *)__pyx_Generator_methods},
  34101. {Py_tp_members, (void *)__pyx_Generator_memberlist},
  34102. {Py_tp_getset, (void *)__pyx_Generator_getsets},
  34103. {Py_tp_getattro, (void *) PyObject_GenericGetAttr},
  34104. #if CYTHON_USE_TP_FINALIZE
  34105. {Py_tp_finalize, (void *)__Pyx_Coroutine_del},
  34106. #endif
  34107. #if __PYX_HAS_PY_AM_SEND == 1
  34108. {Py_am_send, (void *)__Pyx_Coroutine_AmSend},
  34109. #endif
  34110. {0, 0},
  34111. };
  34112. static PyType_Spec __pyx_GeneratorType_spec = {
  34113. __PYX_TYPE_MODULE_PREFIX "generator",
  34114. sizeof(__pyx_CoroutineObject),
  34115. 0,
  34116. #if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API
  34117. Py_TPFLAGS_MANAGED_WEAKREF |
  34118. #endif
  34119. Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION |
  34120. Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | __Pyx_TPFLAGS_HAVE_AM_SEND,
  34121. __pyx_GeneratorType_slots
  34122. };
  34123. #if __PYX_HAS_PY_AM_SEND == 2
  34124. static __Pyx_PyAsyncMethodsStruct __pyx_Generator_as_async;
  34125. #endif
  34126. static int __pyx_Generator_init(PyObject *module) {
  34127. __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
  34128. mstate->__pyx_GeneratorType = __Pyx_FetchCommonTypeFromSpec(
  34129. mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_GeneratorType_spec, NULL);
  34130. if (unlikely(!mstate->__pyx_GeneratorType)) {
  34131. return -1;
  34132. }
  34133. #if __PYX_HAS_PY_AM_SEND == 2
  34134. __Pyx_SetBackportTypeAmSend(mstate->__pyx_GeneratorType, &__pyx_Generator_as_async, &__Pyx_Coroutine_AmSend);
  34135. #endif
  34136. return 0;
  34137. }
  34138. static PyObject *__Pyx_Generator_GetInlinedResult(PyObject *self) {
  34139. __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
  34140. PyObject *retval = NULL;
  34141. if (unlikely(__Pyx_Coroutine_test_and_set_is_running(gen))) {
  34142. return __Pyx_Coroutine_AlreadyRunningError(gen);
  34143. }
  34144. __Pyx_PySendResult result = __Pyx_Coroutine_SendEx(gen, Py_None, &retval, 0);
  34145. __Pyx_Coroutine_unset_is_running(gen);
  34146. (void) result;
  34147. assert (result == PYGEN_RETURN || result == PYGEN_ERROR);
  34148. assert ((result == PYGEN_RETURN && retval != NULL) || (result == PYGEN_ERROR && retval == NULL));
  34149. return retval;
  34150. }
  34151. /* GeneratorYieldFrom */
  34152. #if CYTHON_USE_TYPE_SLOTS
  34153. static void __Pyx_PyIter_CheckErrorAndDecref(PyObject *source) {
  34154. __Pyx_TypeName source_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(source));
  34155. PyErr_Format(PyExc_TypeError,
  34156. "iter() returned non-iterator of type '" __Pyx_FMT_TYPENAME "'", source_type_name);
  34157. __Pyx_DECREF_TypeName(source_type_name);
  34158. Py_DECREF(source);
  34159. }
  34160. #endif
  34161. static CYTHON_INLINE __Pyx_PySendResult __Pyx_Generator_Yield_From(__pyx_CoroutineObject *gen, PyObject *source, PyObject **retval) {
  34162. PyObject *source_gen;
  34163. __Pyx_PySendResult result;
  34164. #ifdef __Pyx_Coroutine_USED
  34165. if (__Pyx_Coroutine_Check(source)) {
  34166. Py_INCREF(source);
  34167. source_gen = source;
  34168. result = __Pyx_Coroutine_AmSend(source, Py_None, retval);
  34169. } else
  34170. #endif
  34171. {
  34172. #if CYTHON_USE_TYPE_SLOTS
  34173. if (likely(Py_TYPE(source)->tp_iter)) {
  34174. source_gen = Py_TYPE(source)->tp_iter(source);
  34175. if (unlikely(!source_gen)) {
  34176. *retval = NULL;
  34177. return PYGEN_ERROR;
  34178. }
  34179. if (unlikely(!PyIter_Check(source_gen))) {
  34180. __Pyx_PyIter_CheckErrorAndDecref(source_gen);
  34181. *retval = NULL;
  34182. return PYGEN_ERROR;
  34183. }
  34184. } else
  34185. #endif
  34186. {
  34187. source_gen = PyObject_GetIter(source);
  34188. if (unlikely(!source_gen)) {
  34189. *retval = NULL;
  34190. return PYGEN_ERROR;
  34191. }
  34192. }
  34193. *retval = __Pyx_PyIter_Next_Plain(source_gen);
  34194. result = __Pyx_Coroutine_status_from_result(retval);
  34195. }
  34196. if (likely(result == PYGEN_NEXT)) {
  34197. __Pyx_Coroutine_Set_Owned_Yield_From(gen, source_gen);
  34198. return PYGEN_NEXT;
  34199. }
  34200. Py_DECREF(source_gen);
  34201. return result;
  34202. }
  34203. /* append */
  34204. static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
  34205. if (likely(PyList_CheckExact(L))) {
  34206. if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
  34207. } else {
  34208. PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_mstate_global->__pyx_n_u_append, x);
  34209. if (unlikely(!retval))
  34210. return -1;
  34211. Py_DECREF(retval);
  34212. }
  34213. return 0;
  34214. }
  34215. /* PyLongBinop */
  34216. #if !CYTHON_COMPILING_IN_PYPY
  34217. static PyObject* __Pyx_Fallback___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, int inplace) {
  34218. return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
  34219. }
  34220. #if CYTHON_USE_PYLONG_INTERNALS
  34221. static PyObject* __Pyx_Unpacked___Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  34222. CYTHON_MAYBE_UNUSED_VAR(inplace);
  34223. CYTHON_UNUSED_VAR(zerodivision_check);
  34224. const long b = intval;
  34225. long a;
  34226. const PY_LONG_LONG llb = intval;
  34227. PY_LONG_LONG lla;
  34228. if (unlikely(__Pyx_PyLong_IsZero(op1))) {
  34229. return __Pyx_NewRef(op2);
  34230. }
  34231. const int is_positive = __Pyx_PyLong_IsPos(op1);
  34232. const digit* digits = __Pyx_PyLong_Digits(op1);
  34233. const Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
  34234. if (likely(size == 1)) {
  34235. a = (long) digits[0];
  34236. if (!is_positive) a *= -1;
  34237. } else {
  34238. switch (size) {
  34239. case 2:
  34240. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  34241. a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  34242. if (!is_positive) a *= -1;
  34243. goto calculate_long;
  34244. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  34245. lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  34246. if (!is_positive) lla *= -1;
  34247. goto calculate_long_long;
  34248. }
  34249. break;
  34250. case 3:
  34251. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  34252. a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  34253. if (!is_positive) a *= -1;
  34254. goto calculate_long;
  34255. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  34256. 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]));
  34257. if (!is_positive) lla *= -1;
  34258. goto calculate_long_long;
  34259. }
  34260. break;
  34261. case 4:
  34262. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  34263. a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  34264. if (!is_positive) a *= -1;
  34265. goto calculate_long;
  34266. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  34267. 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]));
  34268. if (!is_positive) lla *= -1;
  34269. goto calculate_long_long;
  34270. }
  34271. break;
  34272. }
  34273. return PyLong_Type.tp_as_number->nb_add(op1, op2);
  34274. }
  34275. calculate_long:
  34276. {
  34277. long x;
  34278. x = a + b;
  34279. return PyLong_FromLong(x);
  34280. }
  34281. calculate_long_long:
  34282. {
  34283. PY_LONG_LONG llx;
  34284. llx = lla + llb;
  34285. return PyLong_FromLongLong(llx);
  34286. }
  34287. }
  34288. #endif
  34289. static PyObject* __Pyx_Float___Pyx_PyLong_AddObjC(PyObject *float_val, long intval, int zerodivision_check) {
  34290. CYTHON_UNUSED_VAR(zerodivision_check);
  34291. const long b = intval;
  34292. double a = __Pyx_PyFloat_AS_DOUBLE(float_val);
  34293. double result;
  34294. result = ((double)a) + (double)b;
  34295. return PyFloat_FromDouble(result);
  34296. }
  34297. static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  34298. CYTHON_MAYBE_UNUSED_VAR(intval);
  34299. CYTHON_UNUSED_VAR(zerodivision_check);
  34300. #if CYTHON_USE_PYLONG_INTERNALS
  34301. if (likely(PyLong_CheckExact(op1))) {
  34302. return __Pyx_Unpacked___Pyx_PyLong_AddObjC(op1, op2, intval, inplace, zerodivision_check);
  34303. }
  34304. #endif
  34305. if (PyFloat_CheckExact(op1)) {
  34306. return __Pyx_Float___Pyx_PyLong_AddObjC(op1, intval, zerodivision_check);
  34307. }
  34308. return __Pyx_Fallback___Pyx_PyLong_AddObjC(op1, op2, inplace);
  34309. }
  34310. #endif
  34311. /* py_abs */
  34312. #if CYTHON_USE_PYLONG_INTERNALS
  34313. static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
  34314. #if PY_VERSION_HEX >= 0x030C00A7
  34315. if (likely(__Pyx_PyLong_IsCompact(n))) {
  34316. return PyLong_FromSize_t(__Pyx_PyLong_CompactValueUnsigned(n));
  34317. }
  34318. #else
  34319. if (likely(Py_SIZE(n) == -1)) {
  34320. return PyLong_FromUnsignedLong(__Pyx_PyLong_Digits(n)[0]);
  34321. }
  34322. #endif
  34323. #if CYTHON_COMPILING_IN_CPYTHON
  34324. {
  34325. PyObject *copy = _PyLong_Copy((PyLongObject*)n);
  34326. if (likely(copy)) {
  34327. #if PY_VERSION_HEX >= 0x030C00A7
  34328. ((PyLongObject*)copy)->long_value.lv_tag ^= ((PyLongObject*)copy)->long_value.lv_tag & _PyLong_SIGN_MASK;
  34329. #else
  34330. __Pyx_SET_SIZE(copy, -Py_SIZE(copy));
  34331. #endif
  34332. }
  34333. return copy;
  34334. }
  34335. #else
  34336. return PyNumber_Negative(n);
  34337. #endif
  34338. }
  34339. #endif
  34340. /* PyFloatBinop */
  34341. #if !CYTHON_COMPILING_IN_PYPY
  34342. static PyObject* __Pyx_PyFloat_TrueDivideObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
  34343. const double b = floatval;
  34344. double a, result;
  34345. CYTHON_UNUSED_VAR(inplace);
  34346. CYTHON_UNUSED_VAR(zerodivision_check);
  34347. if (likely(PyFloat_CheckExact(op1))) {
  34348. a = __Pyx_PyFloat_AS_DOUBLE(op1);
  34349. } else
  34350. if (likely(PyLong_CheckExact(op1))) {
  34351. #if CYTHON_USE_PYLONG_INTERNALS
  34352. if (__Pyx_PyLong_IsZero(op1)) {
  34353. a = 0.0;
  34354. } else if (__Pyx_PyLong_IsCompact(op1)) {
  34355. a = (double) __Pyx_PyLong_CompactValue(op1);
  34356. } else {
  34357. const digit* digits = __Pyx_PyLong_Digits(op1);
  34358. const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1);
  34359. switch (size) {
  34360. case -2:
  34361. case 2:
  34362. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
  34363. a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  34364. if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
  34365. if (size == -2)
  34366. a = -a;
  34367. break;
  34368. }
  34369. }
  34370. CYTHON_FALLTHROUGH;
  34371. case -3:
  34372. case 3:
  34373. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
  34374. a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  34375. if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
  34376. if (size == -3)
  34377. a = -a;
  34378. break;
  34379. }
  34380. }
  34381. CYTHON_FALLTHROUGH;
  34382. case -4:
  34383. case 4:
  34384. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
  34385. a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  34386. if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
  34387. if (size == -4)
  34388. a = -a;
  34389. break;
  34390. }
  34391. }
  34392. CYTHON_FALLTHROUGH;
  34393. default:
  34394. #endif
  34395. a = PyLong_AsDouble(op1);
  34396. if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
  34397. #if CYTHON_USE_PYLONG_INTERNALS
  34398. }
  34399. }
  34400. #endif
  34401. } else {
  34402. return (inplace ? PyNumber_InPlaceTrueDivide : PyNumber_TrueDivide)(op1, op2);
  34403. }
  34404. result = a / b;
  34405. return PyFloat_FromDouble(result);
  34406. }
  34407. #endif
  34408. /* pybytes_as_double (used by pynumber_float) */
  34409. static double __Pyx_SlowPyString_AsDouble(PyObject *obj) {
  34410. PyObject *float_value = PyFloat_FromString(obj);
  34411. if (likely(float_value)) {
  34412. double value = __Pyx_PyFloat_AS_DOUBLE(float_value);
  34413. Py_DECREF(float_value);
  34414. return value;
  34415. }
  34416. return (double)-1;
  34417. }
  34418. static const char* __Pyx__PyBytes_AsDouble_Copy(const char* start, char* buffer, Py_ssize_t length) {
  34419. int last_was_punctuation = 1;
  34420. int parse_error_found = 0;
  34421. Py_ssize_t i;
  34422. for (i=0; i < length; i++) {
  34423. char chr = start[i];
  34424. int is_punctuation = (chr == '_') | (chr == '.') | (chr == 'e') | (chr == 'E');
  34425. *buffer = chr;
  34426. buffer += (chr != '_');
  34427. parse_error_found |= last_was_punctuation & is_punctuation;
  34428. last_was_punctuation = is_punctuation;
  34429. }
  34430. parse_error_found |= last_was_punctuation;
  34431. *buffer = '\0';
  34432. return unlikely(parse_error_found) ? NULL : buffer;
  34433. }
  34434. static double __Pyx__PyBytes_AsDouble_inf_nan(const char* start, Py_ssize_t length) {
  34435. int matches = 1;
  34436. char sign = start[0];
  34437. int is_signed = (sign == '+') | (sign == '-');
  34438. start += is_signed;
  34439. length -= is_signed;
  34440. switch (start[0]) {
  34441. #ifdef Py_NAN
  34442. case 'n':
  34443. case 'N':
  34444. if (unlikely(length != 3)) goto parse_failure;
  34445. matches &= (start[1] == 'a' || start[1] == 'A');
  34446. matches &= (start[2] == 'n' || start[2] == 'N');
  34447. if (unlikely(!matches)) goto parse_failure;
  34448. return (sign == '-') ? -Py_NAN : Py_NAN;
  34449. #endif
  34450. case 'i':
  34451. case 'I':
  34452. if (unlikely(length < 3)) goto parse_failure;
  34453. matches &= (start[1] == 'n' || start[1] == 'N');
  34454. matches &= (start[2] == 'f' || start[2] == 'F');
  34455. if (likely(length == 3 && matches))
  34456. return (sign == '-') ? -Py_HUGE_VAL : Py_HUGE_VAL;
  34457. if (unlikely(length != 8)) goto parse_failure;
  34458. matches &= (start[3] == 'i' || start[3] == 'I');
  34459. matches &= (start[4] == 'n' || start[4] == 'N');
  34460. matches &= (start[5] == 'i' || start[5] == 'I');
  34461. matches &= (start[6] == 't' || start[6] == 'T');
  34462. matches &= (start[7] == 'y' || start[7] == 'Y');
  34463. if (unlikely(!matches)) goto parse_failure;
  34464. return (sign == '-') ? -Py_HUGE_VAL : Py_HUGE_VAL;
  34465. case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9':
  34466. break;
  34467. default:
  34468. goto parse_failure;
  34469. }
  34470. return 0.0;
  34471. parse_failure:
  34472. return -1.0;
  34473. }
  34474. static CYTHON_INLINE int __Pyx__PyBytes_AsDouble_IsSpace(char ch) {
  34475. return (ch == 0x20) | !((ch < 0x9) | (ch > 0xd));
  34476. }
  34477. CYTHON_UNUSED static double __Pyx__PyBytes_AsDouble(PyObject *obj, const char* start, Py_ssize_t length) {
  34478. double value;
  34479. Py_ssize_t i, digits;
  34480. const char *last = start + length;
  34481. char *end;
  34482. while (__Pyx__PyBytes_AsDouble_IsSpace(*start))
  34483. start++;
  34484. while (start < last - 1 && __Pyx__PyBytes_AsDouble_IsSpace(last[-1]))
  34485. last--;
  34486. length = last - start;
  34487. if (unlikely(length <= 0)) goto fallback;
  34488. value = __Pyx__PyBytes_AsDouble_inf_nan(start, length);
  34489. if (unlikely(value == -1.0)) goto fallback;
  34490. if (value != 0.0) return value;
  34491. digits = 0;
  34492. for (i=0; i < length; digits += start[i++] != '_');
  34493. if (likely(digits == length)) {
  34494. value = PyOS_string_to_double(start, &end, NULL);
  34495. } else if (digits < 40) {
  34496. char number[40];
  34497. last = __Pyx__PyBytes_AsDouble_Copy(start, number, length);
  34498. if (unlikely(!last)) goto fallback;
  34499. value = PyOS_string_to_double(number, &end, NULL);
  34500. } else {
  34501. char *number = (char*) PyMem_Malloc((digits + 1) * sizeof(char));
  34502. if (unlikely(!number)) goto fallback;
  34503. last = __Pyx__PyBytes_AsDouble_Copy(start, number, length);
  34504. if (unlikely(!last)) {
  34505. PyMem_Free(number);
  34506. goto fallback;
  34507. }
  34508. value = PyOS_string_to_double(number, &end, NULL);
  34509. PyMem_Free(number);
  34510. }
  34511. if (likely(end == last) || (value == (double)-1 && PyErr_Occurred())) {
  34512. return value;
  34513. }
  34514. fallback:
  34515. return __Pyx_SlowPyString_AsDouble(obj);
  34516. }
  34517. /* pynumber_float */
  34518. static CYTHON_INLINE PyObject* __Pyx__PyNumber_Float(PyObject* obj) {
  34519. double val;
  34520. if (PyLong_CheckExact(obj)) {
  34521. #if CYTHON_USE_PYLONG_INTERNALS
  34522. if (likely(__Pyx_PyLong_IsCompact(obj))) {
  34523. val = (double) __Pyx_PyLong_CompactValue(obj);
  34524. goto no_error;
  34525. }
  34526. #endif
  34527. val = PyLong_AsDouble(obj);
  34528. } else if (PyUnicode_CheckExact(obj)) {
  34529. val = __Pyx_PyUnicode_AsDouble(obj);
  34530. } else if (PyBytes_CheckExact(obj)) {
  34531. val = __Pyx_PyBytes_AsDouble(obj);
  34532. } else if (PyByteArray_CheckExact(obj)) {
  34533. val = __Pyx_PyByteArray_AsDouble(obj);
  34534. } else {
  34535. return PyNumber_Float(obj);
  34536. }
  34537. if (unlikely(val == -1 && PyErr_Occurred())) {
  34538. return NULL;
  34539. }
  34540. #if CYTHON_USE_PYLONG_INTERNALS
  34541. no_error:
  34542. #endif
  34543. return PyFloat_FromDouble(val);
  34544. }
  34545. /* PyFloatBinop */
  34546. #if !CYTHON_COMPILING_IN_PYPY
  34547. static int __Pyx_PyFloat_BoolEqObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
  34548. const double b = floatval;
  34549. double a;
  34550. CYTHON_UNUSED_VAR(inplace);
  34551. CYTHON_UNUSED_VAR(zerodivision_check);
  34552. if (op1 == op2) {
  34553. return 1;
  34554. }
  34555. if (likely(PyFloat_CheckExact(op1))) {
  34556. a = __Pyx_PyFloat_AS_DOUBLE(op1);
  34557. } else
  34558. if (likely(PyLong_CheckExact(op1))) {
  34559. #if CYTHON_USE_PYLONG_INTERNALS
  34560. if (__Pyx_PyLong_IsZero(op1)) {
  34561. a = 0.0;
  34562. } else if (__Pyx_PyLong_IsCompact(op1)) {
  34563. a = (double) __Pyx_PyLong_CompactValue(op1);
  34564. } else {
  34565. const digit* digits = __Pyx_PyLong_Digits(op1);
  34566. const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1);
  34567. switch (size) {
  34568. case -2:
  34569. case 2:
  34570. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
  34571. a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  34572. if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
  34573. if (size == -2)
  34574. a = -a;
  34575. break;
  34576. }
  34577. }
  34578. CYTHON_FALLTHROUGH;
  34579. case -3:
  34580. case 3:
  34581. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
  34582. a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  34583. if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
  34584. if (size == -3)
  34585. a = -a;
  34586. break;
  34587. }
  34588. }
  34589. CYTHON_FALLTHROUGH;
  34590. case -4:
  34591. case 4:
  34592. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
  34593. a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  34594. if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
  34595. if (size == -4)
  34596. a = -a;
  34597. break;
  34598. }
  34599. }
  34600. CYTHON_FALLTHROUGH;
  34601. default:
  34602. #endif
  34603. {
  34604. PyObject *res =
  34605. #if CYTHON_USE_TYPE_SLOTS || __PYX_LIMITED_VERSION_HEX >= 0x030A0000
  34606. __Pyx_PyType_GetSlot((&PyFloat_Type), tp_richcompare, richcmpfunc)
  34607. #else
  34608. PyObject_RichCompare
  34609. #endif
  34610. (op2, op1,
  34611. Py_EQ);
  34612. return __Pyx_PyObject_IsTrueAndDecref(
  34613. res);
  34614. }
  34615. #if CYTHON_USE_PYLONG_INTERNALS
  34616. }
  34617. }
  34618. #endif
  34619. } else {
  34620. return __Pyx_PyObject_IsTrueAndDecref(
  34621. PyObject_RichCompare(op1, op2, Py_EQ));
  34622. }
  34623. if (a == b) {
  34624. return 1;
  34625. } else {
  34626. return 0;
  34627. }
  34628. }
  34629. #endif
  34630. /* PyLongBinop */
  34631. #if !CYTHON_COMPILING_IN_PYPY
  34632. static PyObject* __Pyx_Fallback___Pyx_PyLong_SubtractCObj(PyObject *op1, PyObject *op2, int inplace) {
  34633. return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
  34634. }
  34635. #if CYTHON_USE_PYLONG_INTERNALS
  34636. static PyObject* __Pyx_Unpacked___Pyx_PyLong_SubtractCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  34637. CYTHON_MAYBE_UNUSED_VAR(inplace);
  34638. CYTHON_UNUSED_VAR(zerodivision_check);
  34639. const long a = intval;
  34640. long b;
  34641. const PY_LONG_LONG lla = intval;
  34642. PY_LONG_LONG llb;
  34643. if (unlikely(__Pyx_PyLong_IsZero(op2))) {
  34644. return __Pyx_NewRef(op1);
  34645. }
  34646. const int is_positive = __Pyx_PyLong_IsPos(op2);
  34647. const digit* digits = __Pyx_PyLong_Digits(op2);
  34648. const Py_ssize_t size = __Pyx_PyLong_DigitCount(op2);
  34649. if (likely(size == 1)) {
  34650. b = (long) digits[0];
  34651. if (!is_positive) b *= -1;
  34652. } else {
  34653. switch (size) {
  34654. case 2:
  34655. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  34656. b = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  34657. if (!is_positive) b *= -1;
  34658. goto calculate_long;
  34659. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  34660. llb = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  34661. if (!is_positive) llb *= -1;
  34662. goto calculate_long_long;
  34663. }
  34664. break;
  34665. case 3:
  34666. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  34667. b = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  34668. if (!is_positive) b *= -1;
  34669. goto calculate_long;
  34670. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  34671. 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]));
  34672. if (!is_positive) llb *= -1;
  34673. goto calculate_long_long;
  34674. }
  34675. break;
  34676. case 4:
  34677. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  34678. b = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  34679. if (!is_positive) b *= -1;
  34680. goto calculate_long;
  34681. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  34682. 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]));
  34683. if (!is_positive) llb *= -1;
  34684. goto calculate_long_long;
  34685. }
  34686. break;
  34687. }
  34688. return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
  34689. }
  34690. calculate_long:
  34691. {
  34692. long x;
  34693. x = a - b;
  34694. return PyLong_FromLong(x);
  34695. }
  34696. calculate_long_long:
  34697. {
  34698. PY_LONG_LONG llx;
  34699. llx = lla - llb;
  34700. return PyLong_FromLongLong(llx);
  34701. }
  34702. }
  34703. #endif
  34704. static PyObject* __Pyx_Float___Pyx_PyLong_SubtractCObj(PyObject *float_val, long intval, int zerodivision_check) {
  34705. CYTHON_UNUSED_VAR(zerodivision_check);
  34706. const long a = intval;
  34707. double b = __Pyx_PyFloat_AS_DOUBLE(float_val);
  34708. double result;
  34709. result = ((double)a) - (double)b;
  34710. return PyFloat_FromDouble(result);
  34711. }
  34712. static CYTHON_INLINE PyObject* __Pyx_PyLong_SubtractCObj(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
  34713. CYTHON_MAYBE_UNUSED_VAR(intval);
  34714. CYTHON_UNUSED_VAR(zerodivision_check);
  34715. #if CYTHON_USE_PYLONG_INTERNALS
  34716. if (likely(PyLong_CheckExact(op2))) {
  34717. return __Pyx_Unpacked___Pyx_PyLong_SubtractCObj(op1, op2, intval, inplace, zerodivision_check);
  34718. }
  34719. #endif
  34720. if (PyFloat_CheckExact(op2)) {
  34721. return __Pyx_Float___Pyx_PyLong_SubtractCObj(op2, intval, zerodivision_check);
  34722. }
  34723. return __Pyx_Fallback___Pyx_PyLong_SubtractCObj(op1, op2, inplace);
  34724. }
  34725. #endif
  34726. /* PyObjectVectorCallKwBuilder */
  34727. #if CYTHON_VECTORCALL
  34728. static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
  34729. (void)__Pyx_PyObject_FastCallDict;
  34730. if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1;
  34731. Py_INCREF(key);
  34732. args[n] = value;
  34733. return 0;
  34734. }
  34735. CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
  34736. (void)__Pyx_VectorcallBuilder_AddArgStr;
  34737. if (unlikely(!PyUnicode_Check(key))) {
  34738. PyErr_SetString(PyExc_TypeError, "keywords must be strings");
  34739. return -1;
  34740. }
  34741. return __Pyx_VectorcallBuilder_AddArg(key, value, builder, args, n);
  34742. }
  34743. static int __Pyx_VectorcallBuilder_AddArgStr(const char *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
  34744. PyObject *pyKey = PyUnicode_FromString(key);
  34745. if (!pyKey) return -1;
  34746. return __Pyx_VectorcallBuilder_AddArg(pyKey, value, builder, args, n);
  34747. }
  34748. #else // CYTHON_VECTORCALL
  34749. CYTHON_UNUSED static int __Pyx_VectorcallBuilder_AddArg_Check(PyObject *key, PyObject *value, PyObject *builder, CYTHON_UNUSED PyObject **args, CYTHON_UNUSED int n) {
  34750. if (unlikely(!PyUnicode_Check(key))) {
  34751. PyErr_SetString(PyExc_TypeError, "keywords must be strings");
  34752. return -1;
  34753. }
  34754. return PyDict_SetItem(builder, key, value);
  34755. }
  34756. #endif
  34757. /* PyObjectFastCallMethod */
  34758. #if !CYTHON_VECTORCALL || PY_VERSION_HEX < 0x03090000
  34759. static PyObject *__Pyx_PyObject_FastCallMethod(PyObject *name, PyObject *const *args, size_t nargsf) {
  34760. PyObject *result;
  34761. PyObject *attr = PyObject_GetAttr(args[0], name);
  34762. if (unlikely(!attr))
  34763. return NULL;
  34764. result = __Pyx_PyObject_FastCall(attr, args+1, nargsf - 1);
  34765. Py_DECREF(attr);
  34766. return result;
  34767. }
  34768. #endif
  34769. /* RaiseClosureNameError */
  34770. static void __Pyx_RaiseClosureNameError(const char *varname) {
  34771. PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
  34772. }
  34773. /* PyMethodNew (used by CythonFunctionShared) */
  34774. #if CYTHON_COMPILING_IN_LIMITED_API
  34775. static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
  34776. PyObject *result;
  34777. CYTHON_UNUSED_VAR(typ);
  34778. if (!self)
  34779. return __Pyx_NewRef(func);
  34780. #if __PYX_LIMITED_VERSION_HEX >= 0x030C0000
  34781. {
  34782. PyObject *args[] = {func, self};
  34783. result = PyObject_Vectorcall(__pyx_mstate_global->__Pyx_CachedMethodType, args, 2, NULL);
  34784. }
  34785. #else
  34786. result = PyObject_CallFunctionObjArgs(__pyx_mstate_global->__Pyx_CachedMethodType, func, self, NULL);
  34787. #endif
  34788. return result;
  34789. }
  34790. #else
  34791. static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
  34792. CYTHON_UNUSED_VAR(typ);
  34793. if (!self)
  34794. return __Pyx_NewRef(func);
  34795. return PyMethod_New(func, self);
  34796. }
  34797. #endif
  34798. /* PyVectorcallFastCallDict (used by CythonFunctionShared) */
  34799. #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
  34800. static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
  34801. {
  34802. PyObject *res = NULL;
  34803. PyObject *kwnames;
  34804. PyObject **newargs;
  34805. PyObject **kwvalues;
  34806. Py_ssize_t i;
  34807. #if CYTHON_AVOID_BORROWED_REFS
  34808. PyObject *pos;
  34809. #else
  34810. Py_ssize_t pos;
  34811. #endif
  34812. size_t j;
  34813. PyObject *key, *value;
  34814. unsigned long keys_are_strings;
  34815. #if !CYTHON_ASSUME_SAFE_SIZE
  34816. Py_ssize_t nkw = PyDict_Size(kw);
  34817. if (unlikely(nkw == -1)) return NULL;
  34818. #else
  34819. Py_ssize_t nkw = PyDict_GET_SIZE(kw);
  34820. #endif
  34821. newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0]));
  34822. if (unlikely(newargs == NULL)) {
  34823. PyErr_NoMemory();
  34824. return NULL;
  34825. }
  34826. for (j = 0; j < nargs; j++) newargs[j] = args[j];
  34827. kwnames = PyTuple_New(nkw);
  34828. if (unlikely(kwnames == NULL)) {
  34829. PyMem_Free(newargs);
  34830. return NULL;
  34831. }
  34832. kwvalues = newargs + nargs;
  34833. pos = 0;
  34834. i = 0;
  34835. keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS;
  34836. while (__Pyx_PyDict_NextRef(kw, &pos, &key, &value)) {
  34837. keys_are_strings &=
  34838. #if CYTHON_COMPILING_IN_LIMITED_API
  34839. PyType_GetFlags(Py_TYPE(key));
  34840. #else
  34841. Py_TYPE(key)->tp_flags;
  34842. #endif
  34843. #if !CYTHON_ASSUME_SAFE_MACROS
  34844. if (unlikely(PyTuple_SetItem(kwnames, i, key) < 0)) goto cleanup;
  34845. #else
  34846. PyTuple_SET_ITEM(kwnames, i, key);
  34847. #endif
  34848. kwvalues[i] = value;
  34849. i++;
  34850. }
  34851. if (unlikely(!keys_are_strings)) {
  34852. PyErr_SetString(PyExc_TypeError, "keywords must be strings");
  34853. goto cleanup;
  34854. }
  34855. res = vc(func, newargs, nargs, kwnames);
  34856. cleanup:
  34857. #if CYTHON_AVOID_BORROWED_REFS
  34858. Py_DECREF(pos);
  34859. #endif
  34860. Py_DECREF(kwnames);
  34861. for (i = 0; i < nkw; i++)
  34862. Py_DECREF(kwvalues[i]);
  34863. PyMem_Free(newargs);
  34864. return res;
  34865. }
  34866. static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
  34867. {
  34868. Py_ssize_t kw_size =
  34869. likely(kw == NULL) ?
  34870. 0 :
  34871. #if !CYTHON_ASSUME_SAFE_SIZE
  34872. PyDict_Size(kw);
  34873. #else
  34874. PyDict_GET_SIZE(kw);
  34875. #endif
  34876. if (kw_size == 0) {
  34877. return vc(func, args, nargs, NULL);
  34878. }
  34879. #if !CYTHON_ASSUME_SAFE_SIZE
  34880. else if (unlikely(kw_size == -1)) {
  34881. return NULL;
  34882. }
  34883. #endif
  34884. return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw);
  34885. }
  34886. #endif
  34887. /* CythonFunctionShared (used by CythonFunction) */
  34888. #if CYTHON_COMPILING_IN_LIMITED_API
  34889. static CYTHON_INLINE int __Pyx__IsSameCyOrCFunctionNoMethod(PyObject *func, void (*cfunc)(void)) {
  34890. if (__Pyx_CyFunction_Check(func)) {
  34891. return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc;
  34892. } else if (PyCFunction_Check(func)) {
  34893. return PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
  34894. }
  34895. return 0;
  34896. }
  34897. static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) {
  34898. if ((PyObject*)Py_TYPE(func) == __pyx_mstate_global->__Pyx_CachedMethodType) {
  34899. int result;
  34900. PyObject *newFunc = PyObject_GetAttr(func, __pyx_mstate_global->__pyx_n_u_func);
  34901. if (unlikely(!newFunc)) {
  34902. PyErr_Clear(); // It's only an optimization, so don't throw an error
  34903. return 0;
  34904. }
  34905. result = __Pyx__IsSameCyOrCFunctionNoMethod(newFunc, cfunc);
  34906. Py_DECREF(newFunc);
  34907. return result;
  34908. }
  34909. return __Pyx__IsSameCyOrCFunctionNoMethod(func, cfunc);
  34910. }
  34911. #else
  34912. static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void (*cfunc)(void)) {
  34913. if (PyMethod_Check(func)) {
  34914. func = PyMethod_GET_FUNCTION(func);
  34915. }
  34916. return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
  34917. }
  34918. #endif
  34919. static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) {
  34920. #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  34921. __Pyx_Py_XDECREF_SET(
  34922. __Pyx_CyFunction_GetClassObj(f),
  34923. ((classobj) ? __Pyx_NewRef(classobj) : NULL));
  34924. #else
  34925. __Pyx_Py_XDECREF_SET(
  34926. ((PyCMethodObject *) (f))->mm_class,
  34927. (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL));
  34928. #endif
  34929. }
  34930. static PyObject *
  34931. __Pyx_CyFunction_get_doc_locked(__pyx_CyFunctionObject *op)
  34932. {
  34933. if (unlikely(op->func_doc == NULL)) {
  34934. #if CYTHON_COMPILING_IN_LIMITED_API
  34935. op->func_doc = PyObject_GetAttrString(op->func, "__doc__");
  34936. if (unlikely(!op->func_doc)) return NULL;
  34937. #else
  34938. if (((PyCFunctionObject*)op)->m_ml->ml_doc) {
  34939. op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
  34940. if (unlikely(op->func_doc == NULL))
  34941. return NULL;
  34942. } else {
  34943. Py_INCREF(Py_None);
  34944. return Py_None;
  34945. }
  34946. #endif
  34947. }
  34948. Py_INCREF(op->func_doc);
  34949. return op->func_doc;
  34950. }
  34951. static PyObject *
  34952. __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure) {
  34953. PyObject *result;
  34954. CYTHON_UNUSED_VAR(closure);
  34955. __Pyx_BEGIN_CRITICAL_SECTION(op);
  34956. result = __Pyx_CyFunction_get_doc_locked(op);
  34957. __Pyx_END_CRITICAL_SECTION();
  34958. return result;
  34959. }
  34960. static int
  34961. __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context)
  34962. {
  34963. CYTHON_UNUSED_VAR(context);
  34964. if (value == NULL) {
  34965. value = Py_None;
  34966. }
  34967. Py_INCREF(value);
  34968. __Pyx_BEGIN_CRITICAL_SECTION(op);
  34969. __Pyx_Py_XDECREF_SET(op->func_doc, value);
  34970. __Pyx_END_CRITICAL_SECTION();
  34971. return 0;
  34972. }
  34973. static PyObject *
  34974. __Pyx_CyFunction_get_name_locked(__pyx_CyFunctionObject *op)
  34975. {
  34976. if (unlikely(op->func_name == NULL)) {
  34977. #if CYTHON_COMPILING_IN_LIMITED_API
  34978. op->func_name = PyObject_GetAttrString(op->func, "__name__");
  34979. #else
  34980. op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
  34981. #endif
  34982. if (unlikely(op->func_name == NULL))
  34983. return NULL;
  34984. }
  34985. Py_INCREF(op->func_name);
  34986. return op->func_name;
  34987. }
  34988. static PyObject *
  34989. __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context)
  34990. {
  34991. PyObject *result = NULL;
  34992. CYTHON_UNUSED_VAR(context);
  34993. __Pyx_BEGIN_CRITICAL_SECTION(op);
  34994. result = __Pyx_CyFunction_get_name_locked(op);
  34995. __Pyx_END_CRITICAL_SECTION();
  34996. return result;
  34997. }
  34998. static int
  34999. __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context)
  35000. {
  35001. CYTHON_UNUSED_VAR(context);
  35002. if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  35003. PyErr_SetString(PyExc_TypeError,
  35004. "__name__ must be set to a string object");
  35005. return -1;
  35006. }
  35007. Py_INCREF(value);
  35008. __Pyx_BEGIN_CRITICAL_SECTION(op);
  35009. __Pyx_Py_XDECREF_SET(op->func_name, value);
  35010. __Pyx_END_CRITICAL_SECTION();
  35011. return 0;
  35012. }
  35013. static PyObject *
  35014. __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context)
  35015. {
  35016. CYTHON_UNUSED_VAR(context);
  35017. PyObject *result;
  35018. __Pyx_BEGIN_CRITICAL_SECTION(op);
  35019. Py_INCREF(op->func_qualname);
  35020. result = op->func_qualname;
  35021. __Pyx_END_CRITICAL_SECTION();
  35022. return result;
  35023. }
  35024. static int
  35025. __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context)
  35026. {
  35027. CYTHON_UNUSED_VAR(context);
  35028. if (unlikely(value == NULL || !PyUnicode_Check(value))) {
  35029. PyErr_SetString(PyExc_TypeError,
  35030. "__qualname__ must be set to a string object");
  35031. return -1;
  35032. }
  35033. Py_INCREF(value);
  35034. __Pyx_BEGIN_CRITICAL_SECTION(op);
  35035. __Pyx_Py_XDECREF_SET(op->func_qualname, value);
  35036. __Pyx_END_CRITICAL_SECTION();
  35037. return 0;
  35038. }
  35039. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  35040. static PyObject *
  35041. __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context)
  35042. {
  35043. CYTHON_UNUSED_VAR(context);
  35044. if (unlikely(op->func_dict == NULL)) {
  35045. op->func_dict = PyDict_New();
  35046. if (unlikely(op->func_dict == NULL))
  35047. return NULL;
  35048. }
  35049. Py_INCREF(op->func_dict);
  35050. return op->func_dict;
  35051. }
  35052. #endif
  35053. static PyObject *
  35054. __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context)
  35055. {
  35056. CYTHON_UNUSED_VAR(context);
  35057. Py_INCREF(op->func_globals);
  35058. return op->func_globals;
  35059. }
  35060. static PyObject *
  35061. __Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context)
  35062. {
  35063. CYTHON_UNUSED_VAR(op);
  35064. CYTHON_UNUSED_VAR(context);
  35065. Py_INCREF(Py_None);
  35066. return Py_None;
  35067. }
  35068. static PyObject *
  35069. __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context)
  35070. {
  35071. PyObject* result = (op->func_code) ? op->func_code : Py_None;
  35072. CYTHON_UNUSED_VAR(context);
  35073. Py_INCREF(result);
  35074. return result;
  35075. }
  35076. static int
  35077. __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
  35078. int result = 0;
  35079. PyObject *res = op->defaults_getter((PyObject *) op);
  35080. if (unlikely(!res))
  35081. return -1;
  35082. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  35083. op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
  35084. Py_INCREF(op->defaults_tuple);
  35085. op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
  35086. Py_INCREF(op->defaults_kwdict);
  35087. #else
  35088. op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0);
  35089. if (unlikely(!op->defaults_tuple)) result = -1;
  35090. else {
  35091. op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1);
  35092. if (unlikely(!op->defaults_kwdict)) result = -1;
  35093. }
  35094. #endif
  35095. Py_DECREF(res);
  35096. return result;
  35097. }
  35098. static int
  35099. __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
  35100. CYTHON_UNUSED_VAR(context);
  35101. if (!value) {
  35102. value = Py_None;
  35103. } else if (unlikely(value != Py_None && !PyTuple_Check(value))) {
  35104. PyErr_SetString(PyExc_TypeError,
  35105. "__defaults__ must be set to a tuple object");
  35106. return -1;
  35107. }
  35108. PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not "
  35109. "currently affect the values used in function calls", 1);
  35110. Py_INCREF(value);
  35111. __Pyx_BEGIN_CRITICAL_SECTION(op);
  35112. __Pyx_Py_XDECREF_SET(op->defaults_tuple, value);
  35113. __Pyx_END_CRITICAL_SECTION();
  35114. return 0;
  35115. }
  35116. static PyObject *
  35117. __Pyx_CyFunction_get_defaults_locked(__pyx_CyFunctionObject *op) {
  35118. PyObject* result = op->defaults_tuple;
  35119. if (unlikely(!result)) {
  35120. if (op->defaults_getter) {
  35121. if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
  35122. result = op->defaults_tuple;
  35123. } else {
  35124. result = Py_None;
  35125. }
  35126. }
  35127. Py_INCREF(result);
  35128. return result;
  35129. }
  35130. static PyObject *
  35131. __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) {
  35132. PyObject* result = NULL;
  35133. CYTHON_UNUSED_VAR(context);
  35134. __Pyx_BEGIN_CRITICAL_SECTION(op);
  35135. result = __Pyx_CyFunction_get_defaults_locked(op);
  35136. __Pyx_END_CRITICAL_SECTION();
  35137. return result;
  35138. }
  35139. static int
  35140. __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
  35141. CYTHON_UNUSED_VAR(context);
  35142. if (!value) {
  35143. value = Py_None;
  35144. } else if (unlikely(value != Py_None && !PyDict_Check(value))) {
  35145. PyErr_SetString(PyExc_TypeError,
  35146. "__kwdefaults__ must be set to a dict object");
  35147. return -1;
  35148. }
  35149. PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not "
  35150. "currently affect the values used in function calls", 1);
  35151. Py_INCREF(value);
  35152. __Pyx_BEGIN_CRITICAL_SECTION(op);
  35153. __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value);
  35154. __Pyx_END_CRITICAL_SECTION();
  35155. return 0;
  35156. }
  35157. static PyObject *
  35158. __Pyx_CyFunction_get_kwdefaults_locked(__pyx_CyFunctionObject *op) {
  35159. PyObject* result = op->defaults_kwdict;
  35160. if (unlikely(!result)) {
  35161. if (op->defaults_getter) {
  35162. if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
  35163. result = op->defaults_kwdict;
  35164. } else {
  35165. result = Py_None;
  35166. }
  35167. }
  35168. Py_INCREF(result);
  35169. return result;
  35170. }
  35171. static PyObject *
  35172. __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) {
  35173. PyObject* result;
  35174. CYTHON_UNUSED_VAR(context);
  35175. __Pyx_BEGIN_CRITICAL_SECTION(op);
  35176. result = __Pyx_CyFunction_get_kwdefaults_locked(op);
  35177. __Pyx_END_CRITICAL_SECTION();
  35178. return result;
  35179. }
  35180. static int
  35181. __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
  35182. CYTHON_UNUSED_VAR(context);
  35183. if (!value || value == Py_None) {
  35184. value = NULL;
  35185. } else if (unlikely(!PyDict_Check(value))) {
  35186. PyErr_SetString(PyExc_TypeError,
  35187. "__annotations__ must be set to a dict object");
  35188. return -1;
  35189. }
  35190. Py_XINCREF(value);
  35191. __Pyx_BEGIN_CRITICAL_SECTION(op);
  35192. __Pyx_Py_XDECREF_SET(op->func_annotations, value);
  35193. __Pyx_END_CRITICAL_SECTION();
  35194. return 0;
  35195. }
  35196. static PyObject *
  35197. __Pyx_CyFunction_get_annotations_locked(__pyx_CyFunctionObject *op) {
  35198. PyObject* result = op->func_annotations;
  35199. if (unlikely(!result)) {
  35200. result = PyDict_New();
  35201. if (unlikely(!result)) return NULL;
  35202. op->func_annotations = result;
  35203. }
  35204. Py_INCREF(result);
  35205. return result;
  35206. }
  35207. static PyObject *
  35208. __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) {
  35209. PyObject *result;
  35210. CYTHON_UNUSED_VAR(context);
  35211. __Pyx_BEGIN_CRITICAL_SECTION(op);
  35212. result = __Pyx_CyFunction_get_annotations_locked(op);
  35213. __Pyx_END_CRITICAL_SECTION();
  35214. return result;
  35215. }
  35216. static PyObject *
  35217. __Pyx_CyFunction_get_is_coroutine_value(__pyx_CyFunctionObject *op) {
  35218. int is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE;
  35219. if (is_coroutine) {
  35220. PyObject *is_coroutine_value, *module, *fromlist, *marker = __pyx_mstate_global->__pyx_n_u_is_coroutine;
  35221. fromlist = PyList_New(1);
  35222. if (unlikely(!fromlist)) return NULL;
  35223. Py_INCREF(marker);
  35224. #if CYTHON_ASSUME_SAFE_MACROS
  35225. PyList_SET_ITEM(fromlist, 0, marker);
  35226. #else
  35227. if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) {
  35228. Py_DECREF(marker);
  35229. Py_DECREF(fromlist);
  35230. return NULL;
  35231. }
  35232. #endif
  35233. module = PyImport_ImportModuleLevelObject(__pyx_mstate_global->__pyx_n_u_asyncio_coroutines, NULL, NULL, fromlist, 0);
  35234. Py_DECREF(fromlist);
  35235. if (unlikely(!module)) goto ignore;
  35236. is_coroutine_value = __Pyx_PyObject_GetAttrStr(module, marker);
  35237. Py_DECREF(module);
  35238. if (likely(is_coroutine_value)) {
  35239. return is_coroutine_value;
  35240. }
  35241. ignore:
  35242. PyErr_Clear();
  35243. }
  35244. return __Pyx_PyBool_FromLong(is_coroutine);
  35245. }
  35246. static PyObject *
  35247. __Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) {
  35248. PyObject *result;
  35249. CYTHON_UNUSED_VAR(context);
  35250. if (op->func_is_coroutine) {
  35251. return __Pyx_NewRef(op->func_is_coroutine);
  35252. }
  35253. result = __Pyx_CyFunction_get_is_coroutine_value(op);
  35254. if (unlikely(!result))
  35255. return NULL;
  35256. __Pyx_BEGIN_CRITICAL_SECTION(op);
  35257. if (op->func_is_coroutine) {
  35258. Py_DECREF(result);
  35259. result = __Pyx_NewRef(op->func_is_coroutine);
  35260. } else {
  35261. op->func_is_coroutine = __Pyx_NewRef(result);
  35262. }
  35263. __Pyx_END_CRITICAL_SECTION();
  35264. return result;
  35265. }
  35266. static void __Pyx_CyFunction_raise_argument_count_error(__pyx_CyFunctionObject *func, const char* message, Py_ssize_t size) {
  35267. #if CYTHON_COMPILING_IN_LIMITED_API
  35268. PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL);
  35269. if (!py_name) return;
  35270. PyErr_Format(PyExc_TypeError,
  35271. "%.200S() %s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  35272. py_name, message, size);
  35273. Py_DECREF(py_name);
  35274. #else
  35275. const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name;
  35276. PyErr_Format(PyExc_TypeError,
  35277. "%.200s() %s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  35278. name, message, size);
  35279. #endif
  35280. }
  35281. static void __Pyx_CyFunction_raise_type_error(__pyx_CyFunctionObject *func, const char* message) {
  35282. #if CYTHON_COMPILING_IN_LIMITED_API
  35283. PyObject *py_name = __Pyx_CyFunction_get_name(func, NULL);
  35284. if (!py_name) return;
  35285. PyErr_Format(PyExc_TypeError,
  35286. "%.200S() %s",
  35287. py_name, message);
  35288. Py_DECREF(py_name);
  35289. #else
  35290. const char* name = ((PyCFunctionObject*)func)->m_ml->ml_name;
  35291. PyErr_Format(PyExc_TypeError,
  35292. "%.200s() %s",
  35293. name, message);
  35294. #endif
  35295. }
  35296. #if CYTHON_COMPILING_IN_LIMITED_API
  35297. static PyObject *
  35298. __Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) {
  35299. CYTHON_UNUSED_VAR(context);
  35300. return PyObject_GetAttrString(op->func, "__module__");
  35301. }
  35302. static int
  35303. __Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
  35304. CYTHON_UNUSED_VAR(context);
  35305. return PyObject_SetAttrString(op->func, "__module__", value);
  35306. }
  35307. #endif
  35308. static PyGetSetDef __pyx_CyFunction_getsets[] = {
  35309. {"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
  35310. {"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
  35311. {"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
  35312. {"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
  35313. {"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
  35314. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  35315. {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0},
  35316. {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)PyObject_GenericSetDict, 0, 0},
  35317. #else
  35318. {"func_dict", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0},
  35319. {"__dict__", (getter)PyObject_GenericGetDict, (setter)PyObject_GenericSetDict, 0, 0},
  35320. #endif
  35321. {"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
  35322. {"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
  35323. {"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
  35324. {"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
  35325. {"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
  35326. {"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
  35327. {"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
  35328. {"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
  35329. {"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
  35330. {"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
  35331. {"_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0},
  35332. #if CYTHON_COMPILING_IN_LIMITED_API
  35333. {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0},
  35334. #endif
  35335. {0, 0, 0, 0, 0}
  35336. };
  35337. static PyMemberDef __pyx_CyFunction_members[] = {
  35338. #if !CYTHON_COMPILING_IN_LIMITED_API
  35339. {"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0},
  35340. #endif
  35341. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  35342. {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0},
  35343. #endif
  35344. #if CYTHON_METH_FASTCALL
  35345. #if CYTHON_COMPILING_IN_LIMITED_API
  35346. {"__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0},
  35347. #else
  35348. {"__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0},
  35349. #endif
  35350. #if CYTHON_COMPILING_IN_LIMITED_API
  35351. {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0},
  35352. #else
  35353. {"__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0},
  35354. #endif
  35355. #endif
  35356. {0, 0, 0, 0, 0}
  35357. };
  35358. static PyObject *
  35359. __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args)
  35360. {
  35361. PyObject *result = NULL;
  35362. CYTHON_UNUSED_VAR(args);
  35363. __Pyx_BEGIN_CRITICAL_SECTION(m);
  35364. Py_INCREF(m->func_qualname);
  35365. result = m->func_qualname;
  35366. __Pyx_END_CRITICAL_SECTION();
  35367. return result;
  35368. }
  35369. static PyMethodDef __pyx_CyFunction_methods[] = {
  35370. {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
  35371. {0, 0, 0, 0}
  35372. };
  35373. #if CYTHON_COMPILING_IN_LIMITED_API
  35374. #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
  35375. #else
  35376. #define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist)
  35377. #endif
  35378. static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
  35379. PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
  35380. #if !CYTHON_COMPILING_IN_LIMITED_API
  35381. PyCFunctionObject *cf = (PyCFunctionObject*) op;
  35382. #endif
  35383. if (unlikely(op == NULL))
  35384. return NULL;
  35385. #if CYTHON_COMPILING_IN_LIMITED_API
  35386. op->func = PyCFunction_NewEx(ml, (PyObject*)op, module);
  35387. if (unlikely(!op->func)) return NULL;
  35388. #endif
  35389. op->flags = flags;
  35390. __Pyx_CyFunction_weakreflist(op) = NULL;
  35391. #if !CYTHON_COMPILING_IN_LIMITED_API
  35392. cf->m_ml = ml;
  35393. cf->m_self = (PyObject *) op;
  35394. #endif
  35395. Py_XINCREF(closure);
  35396. op->func_closure = closure;
  35397. #if !CYTHON_COMPILING_IN_LIMITED_API
  35398. Py_XINCREF(module);
  35399. cf->m_module = module;
  35400. #endif
  35401. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  35402. op->func_dict = NULL;
  35403. #endif
  35404. op->func_name = NULL;
  35405. Py_INCREF(qualname);
  35406. op->func_qualname = qualname;
  35407. op->func_doc = NULL;
  35408. #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  35409. op->func_classobj = NULL;
  35410. #else
  35411. ((PyCMethodObject*)op)->mm_class = NULL;
  35412. #endif
  35413. op->func_globals = globals;
  35414. Py_INCREF(op->func_globals);
  35415. Py_XINCREF(code);
  35416. op->func_code = code;
  35417. op->defaults = NULL;
  35418. op->defaults_tuple = NULL;
  35419. op->defaults_kwdict = NULL;
  35420. op->defaults_getter = NULL;
  35421. op->func_annotations = NULL;
  35422. op->func_is_coroutine = NULL;
  35423. #if CYTHON_METH_FASTCALL
  35424. switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) {
  35425. case METH_NOARGS:
  35426. __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS;
  35427. break;
  35428. case METH_O:
  35429. __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O;
  35430. break;
  35431. case METH_METHOD | METH_FASTCALL | METH_KEYWORDS:
  35432. __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD;
  35433. break;
  35434. case METH_FASTCALL | METH_KEYWORDS:
  35435. __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS;
  35436. break;
  35437. case METH_VARARGS | METH_KEYWORDS:
  35438. __Pyx_CyFunction_func_vectorcall(op) = NULL;
  35439. break;
  35440. default:
  35441. PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
  35442. Py_DECREF(op);
  35443. return NULL;
  35444. }
  35445. #endif
  35446. return (PyObject *) op;
  35447. }
  35448. static int
  35449. __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
  35450. {
  35451. Py_CLEAR(m->func_closure);
  35452. #if CYTHON_COMPILING_IN_LIMITED_API
  35453. Py_CLEAR(m->func);
  35454. #else
  35455. Py_CLEAR(((PyCFunctionObject*)m)->m_module);
  35456. #endif
  35457. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  35458. Py_CLEAR(m->func_dict);
  35459. #elif PY_VERSION_HEX < 0x030d0000
  35460. _PyObject_ClearManagedDict((PyObject*)m);
  35461. #else
  35462. PyObject_ClearManagedDict((PyObject*)m);
  35463. #endif
  35464. Py_CLEAR(m->func_name);
  35465. Py_CLEAR(m->func_qualname);
  35466. Py_CLEAR(m->func_doc);
  35467. Py_CLEAR(m->func_globals);
  35468. Py_CLEAR(m->func_code);
  35469. #if !CYTHON_COMPILING_IN_LIMITED_API
  35470. #if PY_VERSION_HEX < 0x030900B1
  35471. Py_CLEAR(__Pyx_CyFunction_GetClassObj(m));
  35472. #else
  35473. {
  35474. PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class;
  35475. ((PyCMethodObject *) (m))->mm_class = NULL;
  35476. Py_XDECREF(cls);
  35477. }
  35478. #endif
  35479. #endif
  35480. Py_CLEAR(m->defaults_tuple);
  35481. Py_CLEAR(m->defaults_kwdict);
  35482. Py_CLEAR(m->func_annotations);
  35483. Py_CLEAR(m->func_is_coroutine);
  35484. Py_CLEAR(m->defaults);
  35485. return 0;
  35486. }
  35487. static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
  35488. {
  35489. if (__Pyx_CyFunction_weakreflist(m) != NULL)
  35490. PyObject_ClearWeakRefs((PyObject *) m);
  35491. __Pyx_CyFunction_clear(m);
  35492. __Pyx_PyHeapTypeObject_GC_Del(m);
  35493. }
  35494. static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
  35495. {
  35496. PyObject_GC_UnTrack(m);
  35497. __Pyx__CyFunction_dealloc(m);
  35498. }
  35499. static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
  35500. {
  35501. {
  35502. int e = __Pyx_call_type_traverse((PyObject*)m, 1, visit, arg);
  35503. if (e) return e;
  35504. }
  35505. Py_VISIT(m->func_closure);
  35506. #if CYTHON_COMPILING_IN_LIMITED_API
  35507. Py_VISIT(m->func);
  35508. #else
  35509. Py_VISIT(((PyCFunctionObject*)m)->m_module);
  35510. #endif
  35511. #if PY_VERSION_HEX < 0x030C0000 || CYTHON_COMPILING_IN_LIMITED_API
  35512. Py_VISIT(m->func_dict);
  35513. #else
  35514. {
  35515. int e =
  35516. #if PY_VERSION_HEX < 0x030d0000
  35517. _PyObject_VisitManagedDict
  35518. #else
  35519. PyObject_VisitManagedDict
  35520. #endif
  35521. ((PyObject*)m, visit, arg);
  35522. if (e != 0) return e;
  35523. }
  35524. #endif
  35525. __Pyx_VISIT_CONST(m->func_name);
  35526. __Pyx_VISIT_CONST(m->func_qualname);
  35527. Py_VISIT(m->func_doc);
  35528. Py_VISIT(m->func_globals);
  35529. __Pyx_VISIT_CONST(m->func_code);
  35530. #if !CYTHON_COMPILING_IN_LIMITED_API
  35531. Py_VISIT(__Pyx_CyFunction_GetClassObj(m));
  35532. #endif
  35533. Py_VISIT(m->defaults_tuple);
  35534. Py_VISIT(m->defaults_kwdict);
  35535. Py_VISIT(m->func_is_coroutine);
  35536. Py_VISIT(m->defaults);
  35537. return 0;
  35538. }
  35539. static PyObject*
  35540. __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
  35541. {
  35542. PyObject *repr;
  35543. __Pyx_BEGIN_CRITICAL_SECTION(op);
  35544. repr = PyUnicode_FromFormat("<cyfunction %U at %p>",
  35545. op->func_qualname, (void *)op);
  35546. __Pyx_END_CRITICAL_SECTION();
  35547. return repr;
  35548. }
  35549. static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
  35550. #if CYTHON_COMPILING_IN_LIMITED_API
  35551. PyObject *f = ((__pyx_CyFunctionObject*)func)->func;
  35552. PyCFunction meth;
  35553. int flags;
  35554. meth = PyCFunction_GetFunction(f);
  35555. if (unlikely(!meth)) return NULL;
  35556. flags = PyCFunction_GetFlags(f);
  35557. if (unlikely(flags < 0)) return NULL;
  35558. #else
  35559. PyCFunctionObject* f = (PyCFunctionObject*)func;
  35560. PyCFunction meth = f->m_ml->ml_meth;
  35561. int flags = f->m_ml->ml_flags;
  35562. #endif
  35563. Py_ssize_t size;
  35564. switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
  35565. case METH_VARARGS:
  35566. if (likely(kw == NULL || PyDict_Size(kw) == 0))
  35567. return (*meth)(self, arg);
  35568. break;
  35569. case METH_VARARGS | METH_KEYWORDS:
  35570. return (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, arg, kw);
  35571. case METH_NOARGS:
  35572. if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
  35573. #if CYTHON_ASSUME_SAFE_SIZE
  35574. size = PyTuple_GET_SIZE(arg);
  35575. #else
  35576. size = PyTuple_Size(arg);
  35577. if (unlikely(size < 0)) return NULL;
  35578. #endif
  35579. if (likely(size == 0))
  35580. return (*meth)(self, NULL);
  35581. __Pyx_CyFunction_raise_argument_count_error(
  35582. (__pyx_CyFunctionObject*)func,
  35583. "takes no arguments", size);
  35584. return NULL;
  35585. }
  35586. break;
  35587. case METH_O:
  35588. if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
  35589. #if CYTHON_ASSUME_SAFE_SIZE
  35590. size = PyTuple_GET_SIZE(arg);
  35591. #else
  35592. size = PyTuple_Size(arg);
  35593. if (unlikely(size < 0)) return NULL;
  35594. #endif
  35595. if (likely(size == 1)) {
  35596. PyObject *result, *arg0;
  35597. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  35598. arg0 = PyTuple_GET_ITEM(arg, 0);
  35599. #else
  35600. arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
  35601. #endif
  35602. result = (*meth)(self, arg0);
  35603. #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
  35604. Py_DECREF(arg0);
  35605. #endif
  35606. return result;
  35607. }
  35608. __Pyx_CyFunction_raise_argument_count_error(
  35609. (__pyx_CyFunctionObject*)func,
  35610. "takes exactly one argument", size);
  35611. return NULL;
  35612. }
  35613. break;
  35614. default:
  35615. PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
  35616. return NULL;
  35617. }
  35618. __Pyx_CyFunction_raise_type_error(
  35619. (__pyx_CyFunctionObject*)func, "takes no keyword arguments");
  35620. return NULL;
  35621. }
  35622. static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  35623. PyObject *self, *result;
  35624. #if CYTHON_COMPILING_IN_LIMITED_API
  35625. self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func);
  35626. if (unlikely(!self) && PyErr_Occurred()) return NULL;
  35627. #else
  35628. self = ((PyCFunctionObject*)func)->m_self;
  35629. #endif
  35630. result = __Pyx_CyFunction_CallMethod(func, self, arg, kw);
  35631. return result;
  35632. }
  35633. static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
  35634. PyObject *result;
  35635. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
  35636. #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
  35637. __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc);
  35638. if (vc) {
  35639. #if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE
  35640. return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw);
  35641. #else
  35642. (void) &__Pyx_PyVectorcall_FastCallDict;
  35643. return PyVectorcall_Call(func, args, kw);
  35644. #endif
  35645. }
  35646. #endif
  35647. if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
  35648. Py_ssize_t argc;
  35649. PyObject *new_args;
  35650. PyObject *self;
  35651. #if CYTHON_ASSUME_SAFE_SIZE
  35652. argc = PyTuple_GET_SIZE(args);
  35653. #else
  35654. argc = PyTuple_Size(args);
  35655. if (unlikely(argc < 0)) return NULL;
  35656. #endif
  35657. new_args = PyTuple_GetSlice(args, 1, argc);
  35658. if (unlikely(!new_args))
  35659. return NULL;
  35660. self = PyTuple_GetItem(args, 0);
  35661. if (unlikely(!self)) {
  35662. Py_DECREF(new_args);
  35663. PyErr_Format(PyExc_TypeError,
  35664. "unbound method %.200S() needs an argument",
  35665. cyfunc->func_qualname);
  35666. return NULL;
  35667. }
  35668. result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
  35669. Py_DECREF(new_args);
  35670. } else {
  35671. result = __Pyx_CyFunction_Call(func, args, kw);
  35672. }
  35673. return result;
  35674. }
  35675. #if CYTHON_METH_FASTCALL && CYTHON_VECTORCALL
  35676. static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames)
  35677. {
  35678. int ret = 0;
  35679. if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
  35680. if (unlikely(nargs < 1)) {
  35681. __Pyx_CyFunction_raise_type_error(
  35682. cyfunc, "needs an argument");
  35683. return -1;
  35684. }
  35685. ret = 1;
  35686. }
  35687. if (unlikely(kwnames) && unlikely(__Pyx_PyTuple_GET_SIZE(kwnames))) {
  35688. __Pyx_CyFunction_raise_type_error(
  35689. cyfunc, "takes no keyword arguments");
  35690. return -1;
  35691. }
  35692. return ret;
  35693. }
  35694. static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  35695. {
  35696. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
  35697. Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
  35698. PyObject *self;
  35699. #if CYTHON_COMPILING_IN_LIMITED_API
  35700. PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
  35701. if (unlikely(!meth)) return NULL;
  35702. #else
  35703. PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
  35704. #endif
  35705. switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
  35706. case 1:
  35707. self = args[0];
  35708. args += 1;
  35709. nargs -= 1;
  35710. break;
  35711. case 0:
  35712. #if CYTHON_COMPILING_IN_LIMITED_API
  35713. self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
  35714. if (unlikely(!self) && PyErr_Occurred()) return NULL;
  35715. #else
  35716. self = ((PyCFunctionObject*)cyfunc)->m_self;
  35717. #endif
  35718. break;
  35719. default:
  35720. return NULL;
  35721. }
  35722. if (unlikely(nargs != 0)) {
  35723. __Pyx_CyFunction_raise_argument_count_error(
  35724. cyfunc, "takes no arguments", nargs);
  35725. return NULL;
  35726. }
  35727. return meth(self, NULL);
  35728. }
  35729. static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  35730. {
  35731. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
  35732. Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
  35733. PyObject *self;
  35734. #if CYTHON_COMPILING_IN_LIMITED_API
  35735. PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
  35736. if (unlikely(!meth)) return NULL;
  35737. #else
  35738. PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
  35739. #endif
  35740. switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
  35741. case 1:
  35742. self = args[0];
  35743. args += 1;
  35744. nargs -= 1;
  35745. break;
  35746. case 0:
  35747. #if CYTHON_COMPILING_IN_LIMITED_API
  35748. self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
  35749. if (unlikely(!self) && PyErr_Occurred()) return NULL;
  35750. #else
  35751. self = ((PyCFunctionObject*)cyfunc)->m_self;
  35752. #endif
  35753. break;
  35754. default:
  35755. return NULL;
  35756. }
  35757. if (unlikely(nargs != 1)) {
  35758. __Pyx_CyFunction_raise_argument_count_error(
  35759. cyfunc, "takes exactly one argument", nargs);
  35760. return NULL;
  35761. }
  35762. return meth(self, args[0]);
  35763. }
  35764. static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  35765. {
  35766. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
  35767. Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
  35768. PyObject *self;
  35769. #if CYTHON_COMPILING_IN_LIMITED_API
  35770. PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
  35771. if (unlikely(!meth)) return NULL;
  35772. #else
  35773. PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
  35774. #endif
  35775. switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
  35776. case 1:
  35777. self = args[0];
  35778. args += 1;
  35779. nargs -= 1;
  35780. break;
  35781. case 0:
  35782. #if CYTHON_COMPILING_IN_LIMITED_API
  35783. self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
  35784. if (unlikely(!self) && PyErr_Occurred()) return NULL;
  35785. #else
  35786. self = ((PyCFunctionObject*)cyfunc)->m_self;
  35787. #endif
  35788. break;
  35789. default:
  35790. return NULL;
  35791. }
  35792. return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))meth)(self, args, nargs, kwnames);
  35793. }
  35794. static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
  35795. {
  35796. __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
  35797. PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc);
  35798. Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
  35799. PyObject *self;
  35800. #if CYTHON_COMPILING_IN_LIMITED_API
  35801. PyCFunction meth = PyCFunction_GetFunction(cyfunc->func);
  35802. if (unlikely(!meth)) return NULL;
  35803. #else
  35804. PyCFunction meth = ((PyCFunctionObject*)cyfunc)->m_ml->ml_meth;
  35805. #endif
  35806. switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
  35807. case 1:
  35808. self = args[0];
  35809. args += 1;
  35810. nargs -= 1;
  35811. break;
  35812. case 0:
  35813. #if CYTHON_COMPILING_IN_LIMITED_API
  35814. self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)cyfunc)->func);
  35815. if (unlikely(!self) && PyErr_Occurred()) return NULL;
  35816. #else
  35817. self = ((PyCFunctionObject*)cyfunc)->m_self;
  35818. #endif
  35819. break;
  35820. default:
  35821. return NULL;
  35822. }
  35823. #if PY_VERSION_HEX < 0x030e00A6
  35824. size_t nargs_value = (size_t) nargs;
  35825. #else
  35826. Py_ssize_t nargs_value = nargs;
  35827. #endif
  35828. return ((__Pyx_PyCMethod)(void(*)(void))meth)(self, cls, args, nargs_value, kwnames);
  35829. }
  35830. #endif
  35831. static PyType_Slot __pyx_CyFunctionType_slots[] = {
  35832. {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc},
  35833. {Py_tp_repr, (void *)__Pyx_CyFunction_repr},
  35834. {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod},
  35835. {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse},
  35836. {Py_tp_clear, (void *)__Pyx_CyFunction_clear},
  35837. {Py_tp_methods, (void *)__pyx_CyFunction_methods},
  35838. {Py_tp_members, (void *)__pyx_CyFunction_members},
  35839. {Py_tp_getset, (void *)__pyx_CyFunction_getsets},
  35840. {Py_tp_descr_get, (void *)__Pyx_PyMethod_New},
  35841. {0, 0},
  35842. };
  35843. static PyType_Spec __pyx_CyFunctionType_spec = {
  35844. __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
  35845. sizeof(__pyx_CyFunctionObject),
  35846. 0,
  35847. #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
  35848. Py_TPFLAGS_METHOD_DESCRIPTOR |
  35849. #endif
  35850. #if CYTHON_METH_FASTCALL
  35851. #if defined(Py_TPFLAGS_HAVE_VECTORCALL)
  35852. Py_TPFLAGS_HAVE_VECTORCALL |
  35853. #elif defined(_Py_TPFLAGS_HAVE_VECTORCALL)
  35854. _Py_TPFLAGS_HAVE_VECTORCALL |
  35855. #endif
  35856. #endif // CYTHON_METH_FASTCALL
  35857. #if PY_VERSION_HEX >= 0x030C0000 && !CYTHON_COMPILING_IN_LIMITED_API
  35858. Py_TPFLAGS_MANAGED_DICT |
  35859. #endif
  35860. Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION |
  35861. Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
  35862. __pyx_CyFunctionType_slots
  35863. };
  35864. static int __pyx_CyFunction_init(PyObject *module) {
  35865. __pyx_mstatetype *mstate = __Pyx_PyModule_GetState(module);
  35866. mstate->__pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(
  35867. mstate->__pyx_CommonTypesMetaclassType, module, &__pyx_CyFunctionType_spec, NULL);
  35868. if (unlikely(mstate->__pyx_CyFunctionType == NULL)) {
  35869. return -1;
  35870. }
  35871. return 0;
  35872. }
  35873. static CYTHON_INLINE PyObject *__Pyx_CyFunction_InitDefaults(PyObject *func, PyTypeObject *defaults_type) {
  35874. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  35875. m->defaults = PyObject_CallObject((PyObject*)defaults_type, NULL); // _PyObject_New(defaults_type);
  35876. if (unlikely(!m->defaults))
  35877. return NULL;
  35878. return m->defaults;
  35879. }
  35880. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
  35881. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  35882. m->defaults_tuple = tuple;
  35883. Py_INCREF(tuple);
  35884. }
  35885. static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
  35886. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  35887. m->defaults_kwdict = dict;
  35888. Py_INCREF(dict);
  35889. }
  35890. static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
  35891. __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
  35892. m->func_annotations = dict;
  35893. Py_INCREF(dict);
  35894. }
  35895. /* CythonFunction */
  35896. static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
  35897. PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
  35898. PyObject *op = __Pyx_CyFunction_Init(
  35899. PyObject_GC_New(__pyx_CyFunctionObject, __pyx_mstate_global->__pyx_CyFunctionType),
  35900. ml, flags, qualname, closure, module, globals, code
  35901. );
  35902. if (likely(op)) {
  35903. PyObject_GC_Track(op);
  35904. }
  35905. return op;
  35906. }
  35907. /* pyfrozenset_new (used by PySetContains) */
  35908. static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) {
  35909. if (it) {
  35910. PyObject* result;
  35911. #if CYTHON_COMPILING_IN_PYPY
  35912. PyObject* args;
  35913. args = PyTuple_Pack(1, it);
  35914. if (unlikely(!args))
  35915. return NULL;
  35916. result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL);
  35917. Py_DECREF(args);
  35918. return result;
  35919. #else
  35920. if (PyFrozenSet_CheckExact(it)) {
  35921. Py_INCREF(it);
  35922. return it;
  35923. }
  35924. result = PyFrozenSet_New(it);
  35925. if (unlikely(!result))
  35926. return NULL;
  35927. if ((__PYX_LIMITED_VERSION_HEX >= 0x030A0000)
  35928. #if CYTHON_COMPILING_IN_LIMITED_API
  35929. || __Pyx_get_runtime_version() >= 0x030A0000
  35930. #endif
  35931. )
  35932. return result;
  35933. {
  35934. Py_ssize_t size = __Pyx_PySet_GET_SIZE(result);
  35935. if (likely(size > 0))
  35936. return result;
  35937. #if !CYTHON_ASSUME_SAFE_SIZE
  35938. if (unlikely(size < 0)) {
  35939. Py_DECREF(result);
  35940. return NULL;
  35941. }
  35942. #endif
  35943. }
  35944. Py_DECREF(result);
  35945. #endif
  35946. }
  35947. return __Pyx_PyObject_CallNoArg((PyObject*) &PyFrozenSet_Type);
  35948. }
  35949. /* PySetContains */
  35950. static int __Pyx_PySet_ContainsUnhashable(PyObject *set, PyObject *key) {
  35951. int result = -1;
  35952. if (PySet_Check(key) && PyErr_ExceptionMatches(PyExc_TypeError)) {
  35953. PyObject *tmpkey;
  35954. PyErr_Clear();
  35955. tmpkey = __Pyx_PyFrozenSet_New(key);
  35956. if (tmpkey != NULL) {
  35957. result = PySet_Contains(set, tmpkey);
  35958. Py_DECREF(tmpkey);
  35959. }
  35960. }
  35961. return result;
  35962. }
  35963. static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq) {
  35964. int result = PySet_Contains(set, key);
  35965. if (unlikely(result < 0)) {
  35966. result = __Pyx_PySet_ContainsUnhashable(set, key);
  35967. }
  35968. return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
  35969. }
  35970. /* AllocateExtensionType */
  35971. static PyObject *__Pyx_AllocateExtensionType(PyTypeObject *t, int is_final) {
  35972. if (is_final || likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
  35973. allocfunc alloc_func = __Pyx_PyType_GetSlot(t, tp_alloc, allocfunc);
  35974. return alloc_func(t, 0);
  35975. } else {
  35976. newfunc tp_new = __Pyx_PyType_TryGetSlot(&PyBaseObject_Type, tp_new, newfunc);
  35977. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  35978. if (!tp_new) {
  35979. PyObject *new_str = PyUnicode_FromString("__new__");
  35980. if (likely(new_str)) {
  35981. PyObject *o = PyObject_CallMethodObjArgs((PyObject *)&PyBaseObject_Type, new_str, t, NULL);
  35982. Py_DECREF(new_str);
  35983. return o;
  35984. } else
  35985. return NULL;
  35986. } else
  35987. #endif
  35988. return tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  35989. }
  35990. }
  35991. /* PyObjectCallMethod0 (used by PyType_Ready) */
  35992. static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
  35993. #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
  35994. PyObject *args[1] = {obj};
  35995. (void) __Pyx_PyObject_CallOneArg;
  35996. (void) __Pyx_PyObject_CallNoArg;
  35997. return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
  35998. #else
  35999. PyObject *method = NULL, *result = NULL;
  36000. int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
  36001. if (likely(is_method)) {
  36002. result = __Pyx_PyObject_CallOneArg(method, obj);
  36003. Py_DECREF(method);
  36004. return result;
  36005. }
  36006. if (unlikely(!method)) goto bad;
  36007. result = __Pyx_PyObject_CallNoArg(method);
  36008. Py_DECREF(method);
  36009. bad:
  36010. return result;
  36011. #endif
  36012. }
  36013. /* ValidateBasesTuple (used by PyType_Ready) */
  36014. #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
  36015. static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) {
  36016. Py_ssize_t i, n;
  36017. #if CYTHON_ASSUME_SAFE_SIZE
  36018. n = PyTuple_GET_SIZE(bases);
  36019. #else
  36020. n = PyTuple_Size(bases);
  36021. if (unlikely(n < 0)) return -1;
  36022. #endif
  36023. for (i = 1; i < n; i++)
  36024. {
  36025. PyTypeObject *b;
  36026. #if CYTHON_AVOID_BORROWED_REFS
  36027. PyObject *b0 = PySequence_GetItem(bases, i);
  36028. if (!b0) return -1;
  36029. #elif CYTHON_ASSUME_SAFE_MACROS
  36030. PyObject *b0 = PyTuple_GET_ITEM(bases, i);
  36031. #else
  36032. PyObject *b0 = PyTuple_GetItem(bases, i);
  36033. if (!b0) return -1;
  36034. #endif
  36035. b = (PyTypeObject*) b0;
  36036. if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE))
  36037. {
  36038. __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b);
  36039. PyErr_Format(PyExc_TypeError,
  36040. "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name);
  36041. __Pyx_DECREF_TypeName(b_name);
  36042. #if CYTHON_AVOID_BORROWED_REFS
  36043. Py_DECREF(b0);
  36044. #endif
  36045. return -1;
  36046. }
  36047. if (dictoffset == 0)
  36048. {
  36049. Py_ssize_t b_dictoffset = 0;
  36050. #if CYTHON_USE_TYPE_SLOTS
  36051. b_dictoffset = b->tp_dictoffset;
  36052. #else
  36053. PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__");
  36054. if (!py_b_dictoffset) goto dictoffset_return;
  36055. b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset);
  36056. Py_DECREF(py_b_dictoffset);
  36057. if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return;
  36058. #endif
  36059. if (b_dictoffset) {
  36060. {
  36061. __Pyx_TypeName b_name = __Pyx_PyType_GetFullyQualifiedName(b);
  36062. PyErr_Format(PyExc_TypeError,
  36063. "extension type '%.200s' has no __dict__ slot, "
  36064. "but base type '" __Pyx_FMT_TYPENAME "' has: "
  36065. "either add 'cdef dict __dict__' to the extension type "
  36066. "or add '__slots__ = [...]' to the base type",
  36067. type_name, b_name);
  36068. __Pyx_DECREF_TypeName(b_name);
  36069. }
  36070. #if !CYTHON_USE_TYPE_SLOTS
  36071. dictoffset_return:
  36072. #endif
  36073. #if CYTHON_AVOID_BORROWED_REFS
  36074. Py_DECREF(b0);
  36075. #endif
  36076. return -1;
  36077. }
  36078. }
  36079. #if CYTHON_AVOID_BORROWED_REFS
  36080. Py_DECREF(b0);
  36081. #endif
  36082. }
  36083. return 0;
  36084. }
  36085. #endif
  36086. /* PyType_Ready */
  36087. CYTHON_UNUSED static int __Pyx_PyType_HasMultipleInheritance(PyTypeObject *t) {
  36088. while (t) {
  36089. PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
  36090. if (bases) {
  36091. return 1;
  36092. }
  36093. t = __Pyx_PyType_GetSlot(t, tp_base, PyTypeObject*);
  36094. }
  36095. return 0;
  36096. }
  36097. static int __Pyx_PyType_Ready(PyTypeObject *t) {
  36098. #if CYTHON_USE_TYPE_SPECS || !CYTHON_COMPILING_IN_CPYTHON || defined(PYSTON_MAJOR_VERSION)
  36099. (void)__Pyx_PyObject_CallMethod0;
  36100. #if CYTHON_USE_TYPE_SPECS
  36101. (void)__Pyx_validate_bases_tuple;
  36102. #endif
  36103. return PyType_Ready(t);
  36104. #else
  36105. int r;
  36106. if (!__Pyx_PyType_HasMultipleInheritance(t)) {
  36107. return PyType_Ready(t);
  36108. }
  36109. PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
  36110. if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1))
  36111. return -1;
  36112. #if !defined(PYSTON_MAJOR_VERSION)
  36113. {
  36114. int gc_was_enabled;
  36115. #if PY_VERSION_HEX >= 0x030A00b1
  36116. gc_was_enabled = PyGC_Disable();
  36117. (void)__Pyx_PyObject_CallMethod0;
  36118. #else
  36119. PyObject *ret, *py_status;
  36120. PyObject *gc = NULL;
  36121. #if (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) &&\
  36122. !CYTHON_COMPILING_IN_GRAAL
  36123. gc = PyImport_GetModule(__pyx_mstate_global->__pyx_kp_u_gc);
  36124. #endif
  36125. if (unlikely(!gc)) gc = PyImport_Import(__pyx_mstate_global->__pyx_kp_u_gc);
  36126. if (unlikely(!gc)) return -1;
  36127. py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_isenabled);
  36128. if (unlikely(!py_status)) {
  36129. Py_DECREF(gc);
  36130. return -1;
  36131. }
  36132. gc_was_enabled = __Pyx_PyObject_IsTrue(py_status);
  36133. Py_DECREF(py_status);
  36134. if (gc_was_enabled > 0) {
  36135. ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_disable);
  36136. if (unlikely(!ret)) {
  36137. Py_DECREF(gc);
  36138. return -1;
  36139. }
  36140. Py_DECREF(ret);
  36141. } else if (unlikely(gc_was_enabled == -1)) {
  36142. Py_DECREF(gc);
  36143. return -1;
  36144. }
  36145. #endif
  36146. t->tp_flags |= Py_TPFLAGS_HEAPTYPE;
  36147. #if PY_VERSION_HEX >= 0x030A0000
  36148. t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE;
  36149. #endif
  36150. #else
  36151. (void)__Pyx_PyObject_CallMethod0;
  36152. #endif
  36153. r = PyType_Ready(t);
  36154. #if !defined(PYSTON_MAJOR_VERSION)
  36155. t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE;
  36156. #if PY_VERSION_HEX >= 0x030A00b1
  36157. if (gc_was_enabled)
  36158. PyGC_Enable();
  36159. #else
  36160. if (gc_was_enabled) {
  36161. PyObject *tp, *v, *tb;
  36162. PyErr_Fetch(&tp, &v, &tb);
  36163. ret = __Pyx_PyObject_CallMethod0(gc, __pyx_mstate_global->__pyx_kp_u_enable);
  36164. if (likely(ret || r == -1)) {
  36165. Py_XDECREF(ret);
  36166. PyErr_Restore(tp, v, tb);
  36167. } else {
  36168. Py_XDECREF(tp);
  36169. Py_XDECREF(v);
  36170. Py_XDECREF(tb);
  36171. r = -1;
  36172. }
  36173. }
  36174. Py_DECREF(gc);
  36175. #endif
  36176. }
  36177. #endif
  36178. return r;
  36179. #endif
  36180. }
  36181. /* HasAttr (used by ImportImpl) */
  36182. #if __PYX_LIMITED_VERSION_HEX < 0x030d0000
  36183. static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
  36184. PyObject *r;
  36185. if (unlikely(!PyUnicode_Check(n))) {
  36186. PyErr_SetString(PyExc_TypeError,
  36187. "hasattr(): attribute name must be string");
  36188. return -1;
  36189. }
  36190. r = __Pyx_PyObject_GetAttrStrNoError(o, n);
  36191. if (!r) {
  36192. return (unlikely(PyErr_Occurred())) ? -1 : 0;
  36193. } else {
  36194. Py_DECREF(r);
  36195. return 1;
  36196. }
  36197. }
  36198. #endif
  36199. /* ImportImpl (used by Import) */
  36200. static int __Pyx__Import_GetModule(PyObject *qualname, PyObject **module) {
  36201. PyObject *imported_module = PyImport_GetModule(qualname);
  36202. if (unlikely(!imported_module)) {
  36203. *module = NULL;
  36204. if (PyErr_Occurred()) {
  36205. return -1;
  36206. }
  36207. return 0;
  36208. }
  36209. *module = imported_module;
  36210. return 1;
  36211. }
  36212. static int __Pyx__Import_Lookup(PyObject *qualname, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject **module) {
  36213. PyObject *imported_module;
  36214. PyObject *top_level_package_name;
  36215. Py_ssize_t i;
  36216. int status, module_found;
  36217. Py_ssize_t dot_index;
  36218. module_found = __Pyx__Import_GetModule(qualname, &imported_module);
  36219. if (unlikely(!module_found || module_found == -1)) {
  36220. *module = NULL;
  36221. return module_found;
  36222. }
  36223. if (imported_names) {
  36224. for (i = 0; i < len_imported_names; i++) {
  36225. PyObject *imported_name = imported_names[i];
  36226. #if __PYX_LIMITED_VERSION_HEX < 0x030d0000
  36227. int has_imported_attribute = PyObject_HasAttr(imported_module, imported_name);
  36228. #else
  36229. int has_imported_attribute = PyObject_HasAttrWithError(imported_module, imported_name);
  36230. if (unlikely(has_imported_attribute == -1)) goto error;
  36231. #endif
  36232. if (!has_imported_attribute) {
  36233. goto not_found;
  36234. }
  36235. }
  36236. *module = imported_module;
  36237. return 1;
  36238. }
  36239. dot_index = PyUnicode_FindChar(qualname, '.', 0, PY_SSIZE_T_MAX, 1);
  36240. if (dot_index == -1) {
  36241. *module = imported_module;
  36242. return 1;
  36243. }
  36244. if (unlikely(dot_index == -2)) goto error;
  36245. top_level_package_name = PyUnicode_Substring(qualname, 0, dot_index);
  36246. if (unlikely(!top_level_package_name)) goto error;
  36247. Py_DECREF(imported_module);
  36248. status = __Pyx__Import_GetModule(top_level_package_name, module);
  36249. Py_DECREF(top_level_package_name);
  36250. return status;
  36251. error:
  36252. Py_DECREF(imported_module);
  36253. *module = NULL;
  36254. return -1;
  36255. not_found:
  36256. Py_DECREF(imported_module);
  36257. *module = NULL;
  36258. return 0;
  36259. }
  36260. static PyObject *__Pyx__Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, PyObject *moddict, int level) {
  36261. PyObject *module = 0;
  36262. PyObject *empty_dict = 0;
  36263. PyObject *from_list = 0;
  36264. int module_found;
  36265. if (!qualname) {
  36266. qualname = name;
  36267. }
  36268. module_found = __Pyx__Import_Lookup(qualname, imported_names, len_imported_names, &module);
  36269. if (likely(module_found == 1)) {
  36270. return module;
  36271. } else if (unlikely(module_found == -1)) {
  36272. return NULL;
  36273. }
  36274. empty_dict = PyDict_New();
  36275. if (unlikely(!empty_dict))
  36276. goto bad;
  36277. if (imported_names) {
  36278. #if CYTHON_COMPILING_IN_CPYTHON
  36279. from_list = __Pyx_PyList_FromArray(imported_names, len_imported_names);
  36280. if (unlikely(!from_list))
  36281. goto bad;
  36282. #else
  36283. from_list = PyList_New(len_imported_names);
  36284. if (unlikely(!from_list)) goto bad;
  36285. for (Py_ssize_t i=0; i<len_imported_names; ++i) {
  36286. if (PyList_SetItem(from_list, i, __Pyx_NewRef(imported_names[i])) < 0) goto bad;
  36287. }
  36288. #endif
  36289. }
  36290. if (level == -1) {
  36291. const char* package_sep = strchr(__Pyx_MODULE_NAME, '.');
  36292. if (package_sep != (0)) {
  36293. module = PyImport_ImportModuleLevelObject(
  36294. name, moddict, empty_dict, from_list, 1);
  36295. if (unlikely(!module)) {
  36296. if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
  36297. goto bad;
  36298. PyErr_Clear();
  36299. }
  36300. }
  36301. level = 0;
  36302. }
  36303. if (!module) {
  36304. module = PyImport_ImportModuleLevelObject(
  36305. name, moddict, empty_dict, from_list, level);
  36306. }
  36307. bad:
  36308. Py_XDECREF(from_list);
  36309. Py_XDECREF(empty_dict);
  36310. return module;
  36311. }
  36312. /* Import */
  36313. static PyObject *__Pyx_Import(PyObject *name, PyObject *const *imported_names, Py_ssize_t len_imported_names, PyObject *qualname, int level) {
  36314. return __Pyx__Import(name, imported_names, len_imported_names, qualname, __pyx_mstate_global->__pyx_d, level);
  36315. }
  36316. /* ImportFrom */
  36317. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
  36318. PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
  36319. if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
  36320. const char* module_name_str = 0;
  36321. PyObject* module_name = 0;
  36322. PyObject* module_dot = 0;
  36323. PyObject* full_name = 0;
  36324. PyErr_Clear();
  36325. module_name_str = PyModule_GetName(module);
  36326. if (unlikely(!module_name_str)) { goto modbad; }
  36327. module_name = PyUnicode_FromString(module_name_str);
  36328. if (unlikely(!module_name)) { goto modbad; }
  36329. module_dot = PyUnicode_Concat(module_name, __pyx_mstate_global->__pyx_kp_u__2);
  36330. if (unlikely(!module_dot)) { goto modbad; }
  36331. full_name = PyUnicode_Concat(module_dot, name);
  36332. if (unlikely(!full_name)) { goto modbad; }
  36333. #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) ||\
  36334. CYTHON_COMPILING_IN_GRAAL
  36335. {
  36336. PyObject *modules = PyImport_GetModuleDict();
  36337. if (unlikely(!modules))
  36338. goto modbad;
  36339. value = PyObject_GetItem(modules, full_name);
  36340. }
  36341. #else
  36342. value = PyImport_GetModule(full_name);
  36343. #endif
  36344. modbad:
  36345. Py_XDECREF(full_name);
  36346. Py_XDECREF(module_dot);
  36347. Py_XDECREF(module_name);
  36348. }
  36349. if (unlikely(!value)) {
  36350. PyErr_Format(PyExc_ImportError, "cannot import name %S", name);
  36351. }
  36352. return value;
  36353. }
  36354. /* ListPack */
  36355. static PyObject *__Pyx_PyList_Pack(Py_ssize_t n, ...) {
  36356. va_list va;
  36357. PyObject *l = PyList_New(n);
  36358. va_start(va, n);
  36359. if (unlikely(!l)) goto end;
  36360. for (Py_ssize_t i=0; i<n; ++i) {
  36361. PyObject *arg = va_arg(va, PyObject*);
  36362. Py_INCREF(arg);
  36363. if (__Pyx_PyList_SET_ITEM(l, i, arg) != (0)) {
  36364. Py_CLEAR(l);
  36365. goto end;
  36366. }
  36367. }
  36368. end:
  36369. va_end(va);
  36370. return l;
  36371. }
  36372. /* CLineInTraceback (used by AddTraceback) */
  36373. #if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
  36374. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030A0000
  36375. #define __Pyx_PyProbablyModule_GetDict(o) __Pyx_XNewRef(PyModule_GetDict(o))
  36376. #elif !CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  36377. #define __Pyx_PyProbablyModule_GetDict(o) PyObject_GenericGetDict(o, NULL);
  36378. #else
  36379. PyObject* __Pyx_PyProbablyModule_GetDict(PyObject *o) {
  36380. PyObject **dict_ptr = _PyObject_GetDictPtr(o);
  36381. return dict_ptr ? __Pyx_XNewRef(*dict_ptr) : NULL;
  36382. }
  36383. #endif
  36384. static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
  36385. PyObject *use_cline = NULL;
  36386. PyObject *ptype, *pvalue, *ptraceback;
  36387. PyObject *cython_runtime_dict;
  36388. CYTHON_MAYBE_UNUSED_VAR(tstate);
  36389. if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) {
  36390. return c_line;
  36391. }
  36392. __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
  36393. cython_runtime_dict = __Pyx_PyProbablyModule_GetDict(__pyx_mstate_global->__pyx_cython_runtime);
  36394. if (likely(cython_runtime_dict)) {
  36395. __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
  36396. use_cline, cython_runtime_dict,
  36397. __Pyx_PyDict_SetDefault(cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False))
  36398. }
  36399. if (use_cline == NULL || use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
  36400. c_line = 0;
  36401. }
  36402. Py_XDECREF(use_cline);
  36403. Py_XDECREF(cython_runtime_dict);
  36404. __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
  36405. return c_line;
  36406. }
  36407. #endif
  36408. /* CodeObjectCache (used by AddTraceback) */
  36409. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
  36410. int start = 0, mid = 0, end = count - 1;
  36411. if (end >= 0 && code_line > entries[end].code_line) {
  36412. return count;
  36413. }
  36414. while (start < end) {
  36415. mid = start + (end - start) / 2;
  36416. if (code_line < entries[mid].code_line) {
  36417. end = mid;
  36418. } else if (code_line > entries[mid].code_line) {
  36419. start = mid + 1;
  36420. } else {
  36421. return mid;
  36422. }
  36423. }
  36424. if (code_line <= entries[mid].code_line) {
  36425. return mid;
  36426. } else {
  36427. return mid + 1;
  36428. }
  36429. }
  36430. static __Pyx_CachedCodeObjectType *__pyx__find_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line) {
  36431. __Pyx_CachedCodeObjectType* code_object;
  36432. int pos;
  36433. if (unlikely(!code_line) || unlikely(!code_cache->entries)) {
  36434. return NULL;
  36435. }
  36436. pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line);
  36437. if (unlikely(pos >= code_cache->count) || unlikely(code_cache->entries[pos].code_line != code_line)) {
  36438. return NULL;
  36439. }
  36440. code_object = code_cache->entries[pos].code_object;
  36441. Py_INCREF(code_object);
  36442. return code_object;
  36443. }
  36444. static __Pyx_CachedCodeObjectType *__pyx_find_code_object(int code_line) {
  36445. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
  36446. (void)__pyx__find_code_object;
  36447. return NULL; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just miss.
  36448. #else
  36449. struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
  36450. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  36451. __pyx_nonatomic_int_type old_count = __pyx_atomic_incr_acq_rel(&code_cache->accessor_count);
  36452. if (old_count < 0) {
  36453. __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
  36454. return NULL;
  36455. }
  36456. #endif
  36457. __Pyx_CachedCodeObjectType *result = __pyx__find_code_object(code_cache, code_line);
  36458. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  36459. __pyx_atomic_decr_acq_rel(&code_cache->accessor_count);
  36460. #endif
  36461. return result;
  36462. #endif
  36463. }
  36464. static void __pyx__insert_code_object(struct __Pyx_CodeObjectCache *code_cache, int code_line, __Pyx_CachedCodeObjectType* code_object)
  36465. {
  36466. int pos, i;
  36467. __Pyx_CodeObjectCacheEntry* entries = code_cache->entries;
  36468. if (unlikely(!code_line)) {
  36469. return;
  36470. }
  36471. if (unlikely(!entries)) {
  36472. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
  36473. if (likely(entries)) {
  36474. code_cache->entries = entries;
  36475. code_cache->max_count = 64;
  36476. code_cache->count = 1;
  36477. entries[0].code_line = code_line;
  36478. entries[0].code_object = code_object;
  36479. Py_INCREF(code_object);
  36480. }
  36481. return;
  36482. }
  36483. pos = __pyx_bisect_code_objects(code_cache->entries, code_cache->count, code_line);
  36484. if ((pos < code_cache->count) && unlikely(code_cache->entries[pos].code_line == code_line)) {
  36485. __Pyx_CachedCodeObjectType* tmp = entries[pos].code_object;
  36486. entries[pos].code_object = code_object;
  36487. Py_INCREF(code_object);
  36488. Py_DECREF(tmp);
  36489. return;
  36490. }
  36491. if (code_cache->count == code_cache->max_count) {
  36492. int new_max = code_cache->max_count + 64;
  36493. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
  36494. code_cache->entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
  36495. if (unlikely(!entries)) {
  36496. return;
  36497. }
  36498. code_cache->entries = entries;
  36499. code_cache->max_count = new_max;
  36500. }
  36501. for (i=code_cache->count; i>pos; i--) {
  36502. entries[i] = entries[i-1];
  36503. }
  36504. entries[pos].code_line = code_line;
  36505. entries[pos].code_object = code_object;
  36506. code_cache->count++;
  36507. Py_INCREF(code_object);
  36508. }
  36509. static void __pyx_insert_code_object(int code_line, __Pyx_CachedCodeObjectType* code_object) {
  36510. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING && !CYTHON_ATOMICS
  36511. (void)__pyx__insert_code_object;
  36512. return; // Most implementation should have atomics. But otherwise, don't make it thread-safe, just fail.
  36513. #else
  36514. struct __Pyx_CodeObjectCache *code_cache = &__pyx_mstate_global->__pyx_code_cache;
  36515. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  36516. __pyx_nonatomic_int_type expected = 0;
  36517. if (!__pyx_atomic_int_cmp_exchange(&code_cache->accessor_count, &expected, INT_MIN)) {
  36518. return;
  36519. }
  36520. #endif
  36521. __pyx__insert_code_object(code_cache, code_line, code_object);
  36522. #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  36523. __pyx_atomic_sub(&code_cache->accessor_count, INT_MIN);
  36524. #endif
  36525. #endif
  36526. }
  36527. /* AddTraceback */
  36528. #include "compile.h"
  36529. #include "frameobject.h"
  36530. #include "traceback.h"
  36531. #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION)
  36532. #ifndef Py_BUILD_CORE
  36533. #define Py_BUILD_CORE 1
  36534. #endif
  36535. #include "internal/pycore_frame.h"
  36536. #endif
  36537. #if CYTHON_COMPILING_IN_LIMITED_API
  36538. static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict,
  36539. PyObject *firstlineno, PyObject *name) {
  36540. PyObject *replace = NULL;
  36541. if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL;
  36542. if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL;
  36543. replace = PyObject_GetAttrString(code, "replace");
  36544. if (likely(replace)) {
  36545. PyObject *result = PyObject_Call(replace, __pyx_mstate_global->__pyx_empty_tuple, scratch_dict);
  36546. Py_DECREF(replace);
  36547. return result;
  36548. }
  36549. PyErr_Clear();
  36550. return NULL;
  36551. }
  36552. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  36553. int py_line, const char *filename) {
  36554. PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL;
  36555. PyObject *replace = NULL, *getframe = NULL, *frame = NULL;
  36556. PyObject *exc_type, *exc_value, *exc_traceback;
  36557. int success = 0;
  36558. if (c_line) {
  36559. c_line = __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
  36560. }
  36561. PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
  36562. code_object = __pyx_find_code_object(c_line ? -c_line : py_line);
  36563. if (!code_object) {
  36564. code_object = Py_CompileString("_getframe()", filename, Py_eval_input);
  36565. if (unlikely(!code_object)) goto bad;
  36566. py_py_line = PyLong_FromLong(py_line);
  36567. if (unlikely(!py_py_line)) goto bad;
  36568. if (c_line) {
  36569. py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  36570. } else {
  36571. py_funcname = PyUnicode_FromString(funcname);
  36572. }
  36573. if (unlikely(!py_funcname)) goto bad;
  36574. dict = PyDict_New();
  36575. if (unlikely(!dict)) goto bad;
  36576. {
  36577. PyObject *old_code_object = code_object;
  36578. code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname);
  36579. Py_DECREF(old_code_object);
  36580. }
  36581. if (unlikely(!code_object)) goto bad;
  36582. __pyx_insert_code_object(c_line ? -c_line : py_line, code_object);
  36583. } else {
  36584. dict = PyDict_New();
  36585. }
  36586. getframe = PySys_GetObject("_getframe");
  36587. if (unlikely(!getframe)) goto bad;
  36588. if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad;
  36589. frame = PyEval_EvalCode(code_object, dict, dict);
  36590. if (unlikely(!frame) || frame == Py_None) goto bad;
  36591. success = 1;
  36592. bad:
  36593. PyErr_Restore(exc_type, exc_value, exc_traceback);
  36594. Py_XDECREF(code_object);
  36595. Py_XDECREF(py_py_line);
  36596. Py_XDECREF(py_funcname);
  36597. Py_XDECREF(dict);
  36598. Py_XDECREF(replace);
  36599. if (success) {
  36600. PyTraceBack_Here(
  36601. (struct _frame*)frame);
  36602. }
  36603. Py_XDECREF(frame);
  36604. }
  36605. #else
  36606. static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
  36607. const char *funcname, int c_line,
  36608. int py_line, const char *filename) {
  36609. PyCodeObject *py_code = NULL;
  36610. PyObject *py_funcname = NULL;
  36611. if (c_line) {
  36612. py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  36613. if (!py_funcname) goto bad;
  36614. funcname = PyUnicode_AsUTF8(py_funcname);
  36615. if (!funcname) goto bad;
  36616. }
  36617. py_code = PyCode_NewEmpty(filename, funcname, py_line);
  36618. Py_XDECREF(py_funcname);
  36619. return py_code;
  36620. bad:
  36621. Py_XDECREF(py_funcname);
  36622. return NULL;
  36623. }
  36624. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  36625. int py_line, const char *filename) {
  36626. PyCodeObject *py_code = 0;
  36627. PyFrameObject *py_frame = 0;
  36628. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  36629. PyObject *ptype, *pvalue, *ptraceback;
  36630. if (c_line) {
  36631. c_line = __Pyx_CLineForTraceback(tstate, c_line);
  36632. }
  36633. py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
  36634. if (!py_code) {
  36635. __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
  36636. py_code = __Pyx_CreateCodeObjectForTraceback(
  36637. funcname, c_line, py_line, filename);
  36638. if (!py_code) {
  36639. /* If the code object creation fails, then we should clear the
  36640. fetched exception references and propagate the new exception */
  36641. Py_XDECREF(ptype);
  36642. Py_XDECREF(pvalue);
  36643. Py_XDECREF(ptraceback);
  36644. goto bad;
  36645. }
  36646. __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
  36647. __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
  36648. }
  36649. py_frame = PyFrame_New(
  36650. tstate, /*PyThreadState *tstate,*/
  36651. py_code, /*PyCodeObject *code,*/
  36652. __pyx_mstate_global->__pyx_d, /*PyObject *globals,*/
  36653. 0 /*PyObject *locals*/
  36654. );
  36655. if (!py_frame) goto bad;
  36656. __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
  36657. PyTraceBack_Here(py_frame);
  36658. bad:
  36659. Py_XDECREF(py_code);
  36660. Py_XDECREF(py_frame);
  36661. }
  36662. #endif
  36663. /* Declarations */
  36664. #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
  36665. #ifdef __cplusplus
  36666. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  36667. return ::std::complex< double >(x, y);
  36668. }
  36669. #else
  36670. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  36671. return x + y*(__pyx_t_double_complex)_Complex_I;
  36672. }
  36673. #endif
  36674. #else
  36675. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  36676. __pyx_t_double_complex z;
  36677. z.real = x;
  36678. z.imag = y;
  36679. return z;
  36680. }
  36681. #endif
  36682. /* Arithmetic */
  36683. #if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
  36684. #else
  36685. static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  36686. return (a.real == b.real) && (a.imag == b.imag);
  36687. }
  36688. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  36689. __pyx_t_double_complex z;
  36690. z.real = a.real + b.real;
  36691. z.imag = a.imag + b.imag;
  36692. return z;
  36693. }
  36694. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  36695. __pyx_t_double_complex z;
  36696. z.real = a.real - b.real;
  36697. z.imag = a.imag - b.imag;
  36698. return z;
  36699. }
  36700. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  36701. __pyx_t_double_complex z;
  36702. z.real = a.real * b.real - a.imag * b.imag;
  36703. z.imag = a.real * b.imag + a.imag * b.real;
  36704. return z;
  36705. }
  36706. #if 1
  36707. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  36708. if (b.imag == 0) {
  36709. return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
  36710. } else if (fabs(b.real) >= fabs(b.imag)) {
  36711. if (b.real == 0 && b.imag == 0) {
  36712. return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
  36713. } else {
  36714. double r = b.imag / b.real;
  36715. double s = (double)(1.0) / (b.real + b.imag * r);
  36716. return __pyx_t_double_complex_from_parts(
  36717. (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
  36718. }
  36719. } else {
  36720. double r = b.real / b.imag;
  36721. double s = (double)(1.0) / (b.imag + b.real * r);
  36722. return __pyx_t_double_complex_from_parts(
  36723. (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
  36724. }
  36725. }
  36726. #else
  36727. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  36728. if (b.imag == 0) {
  36729. return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
  36730. } else {
  36731. double denom = b.real * b.real + b.imag * b.imag;
  36732. return __pyx_t_double_complex_from_parts(
  36733. (a.real * b.real + a.imag * b.imag) / denom,
  36734. (a.imag * b.real - a.real * b.imag) / denom);
  36735. }
  36736. }
  36737. #endif
  36738. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
  36739. __pyx_t_double_complex z;
  36740. z.real = -a.real;
  36741. z.imag = -a.imag;
  36742. return z;
  36743. }
  36744. static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
  36745. return (a.real == 0) && (a.imag == 0);
  36746. }
  36747. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
  36748. __pyx_t_double_complex z;
  36749. z.real = a.real;
  36750. z.imag = -a.imag;
  36751. return z;
  36752. }
  36753. #if 1
  36754. static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
  36755. #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
  36756. return sqrt(z.real*z.real + z.imag*z.imag);
  36757. #else
  36758. return hypot(z.real, z.imag);
  36759. #endif
  36760. }
  36761. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  36762. __pyx_t_double_complex z;
  36763. double r, lnr, theta, z_r, z_theta;
  36764. if (b.imag == 0 && b.real == (int)b.real) {
  36765. if (b.real < 0) {
  36766. double denom = a.real * a.real + a.imag * a.imag;
  36767. a.real = a.real / denom;
  36768. a.imag = -a.imag / denom;
  36769. b.real = -b.real;
  36770. }
  36771. switch ((int)b.real) {
  36772. case 0:
  36773. z.real = 1;
  36774. z.imag = 0;
  36775. return z;
  36776. case 1:
  36777. return a;
  36778. case 2:
  36779. return __Pyx_c_prod_double(a, a);
  36780. case 3:
  36781. z = __Pyx_c_prod_double(a, a);
  36782. return __Pyx_c_prod_double(z, a);
  36783. case 4:
  36784. z = __Pyx_c_prod_double(a, a);
  36785. return __Pyx_c_prod_double(z, z);
  36786. }
  36787. }
  36788. if (a.imag == 0) {
  36789. if (a.real == 0) {
  36790. return a;
  36791. } else if ((b.imag == 0) && (a.real >= 0)) {
  36792. z.real = pow(a.real, b.real);
  36793. z.imag = 0;
  36794. return z;
  36795. } else if (a.real > 0) {
  36796. r = a.real;
  36797. theta = 0;
  36798. } else {
  36799. r = -a.real;
  36800. theta = atan2(0.0, -1.0);
  36801. }
  36802. } else {
  36803. r = __Pyx_c_abs_double(a);
  36804. theta = atan2(a.imag, a.real);
  36805. }
  36806. lnr = log(r);
  36807. z_r = exp(lnr * b.real - theta * b.imag);
  36808. z_theta = theta * b.real + lnr * b.imag;
  36809. z.real = z_r * cos(z_theta);
  36810. z.imag = z_r * sin(z_theta);
  36811. return z;
  36812. }
  36813. #endif
  36814. #endif
  36815. /* FromPy */
  36816. static __pyx_t_double_complex __Pyx_PyComplex_As___pyx_t_double_complex(PyObject* o) {
  36817. #if CYTHON_COMPILING_IN_LIMITED_API
  36818. double real=-1.0, imag=-1.0;
  36819. real = PyComplex_RealAsDouble(o);
  36820. if (unlikely(real == -1.0 && PyErr_Occurred())) goto end;
  36821. imag = PyComplex_ImagAsDouble(o);
  36822. end:
  36823. return __pyx_t_double_complex_from_parts(
  36824. (double)real, (double)imag
  36825. );
  36826. #else
  36827. Py_complex cval;
  36828. #if !CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_GRAAL
  36829. if (PyComplex_CheckExact(o))
  36830. cval = ((PyComplexObject *)o)->cval;
  36831. else
  36832. #endif
  36833. cval = PyComplex_AsCComplex(o);
  36834. return __pyx_t_double_complex_from_parts(
  36835. (double)cval.real,
  36836. (double)cval.imag);
  36837. #endif
  36838. }
  36839. /* CIntToPy */
  36840. static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) {
  36841. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  36842. #pragma GCC diagnostic push
  36843. #pragma GCC diagnostic ignored "-Wconversion"
  36844. #endif
  36845. const long neg_one = (long) -1, const_zero = (long) 0;
  36846. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  36847. #pragma GCC diagnostic pop
  36848. #endif
  36849. const int is_unsigned = neg_one > const_zero;
  36850. if (is_unsigned) {
  36851. if (sizeof(long) < sizeof(long)) {
  36852. return PyLong_FromLong((long) value);
  36853. } else if (sizeof(long) <= sizeof(unsigned long)) {
  36854. return PyLong_FromUnsignedLong((unsigned long) value);
  36855. #if !CYTHON_COMPILING_IN_PYPY
  36856. } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
  36857. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  36858. #endif
  36859. }
  36860. } else {
  36861. if (sizeof(long) <= sizeof(long)) {
  36862. return PyLong_FromLong((long) value);
  36863. } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
  36864. return PyLong_FromLongLong((PY_LONG_LONG) value);
  36865. }
  36866. }
  36867. {
  36868. unsigned char *bytes = (unsigned char *)&value;
  36869. #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
  36870. if (is_unsigned) {
  36871. return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
  36872. } else {
  36873. return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
  36874. }
  36875. #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
  36876. int one = 1; int little = (int)*(unsigned char *)&one;
  36877. return _PyLong_FromByteArray(bytes, sizeof(long),
  36878. little, !is_unsigned);
  36879. #else
  36880. int one = 1; int little = (int)*(unsigned char *)&one;
  36881. PyObject *from_bytes, *result = NULL, *kwds = NULL;
  36882. PyObject *py_bytes = NULL, *order_str = NULL;
  36883. from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
  36884. if (!from_bytes) return NULL;
  36885. py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long));
  36886. if (!py_bytes) goto limited_bad;
  36887. order_str = PyUnicode_FromString(little ? "little" : "big");
  36888. if (!order_str) goto limited_bad;
  36889. {
  36890. PyObject *args[3+(CYTHON_VECTORCALL ? 1 : 0)] = { NULL, py_bytes, order_str };
  36891. if (!is_unsigned) {
  36892. kwds = __Pyx_MakeVectorcallBuilderKwds(1);
  36893. if (!kwds) goto limited_bad;
  36894. if (__Pyx_VectorcallBuilder_AddArgStr("signed", __Pyx_NewRef(Py_True), kwds, args+3, 0) < 0) goto limited_bad;
  36895. }
  36896. result = __Pyx_Object_Vectorcall_CallFromBuilder(from_bytes, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, kwds);
  36897. }
  36898. limited_bad:
  36899. Py_XDECREF(kwds);
  36900. Py_XDECREF(order_str);
  36901. Py_XDECREF(py_bytes);
  36902. Py_XDECREF(from_bytes);
  36903. return result;
  36904. #endif
  36905. }
  36906. }
  36907. /* FormatTypeName */
  36908. #if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x030d0000
  36909. static __Pyx_TypeName
  36910. __Pyx_PyType_GetFullyQualifiedName(PyTypeObject* tp)
  36911. {
  36912. PyObject *module = NULL, *name = NULL, *result = NULL;
  36913. #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
  36914. name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
  36915. __pyx_mstate_global->__pyx_n_u_qualname);
  36916. #else
  36917. name = PyType_GetQualName(tp);
  36918. #endif
  36919. if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) goto bad;
  36920. module = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
  36921. __pyx_mstate_global->__pyx_n_u_module);
  36922. if (unlikely(module == NULL) || unlikely(!PyUnicode_Check(module))) goto bad;
  36923. if (PyUnicode_CompareWithASCIIString(module, "builtins") == 0) {
  36924. result = name;
  36925. name = NULL;
  36926. goto done;
  36927. }
  36928. result = PyUnicode_FromFormat("%U.%U", module, name);
  36929. if (unlikely(result == NULL)) goto bad;
  36930. done:
  36931. Py_XDECREF(name);
  36932. Py_XDECREF(module);
  36933. return result;
  36934. bad:
  36935. PyErr_Clear();
  36936. if (name) {
  36937. result = name;
  36938. name = NULL;
  36939. } else {
  36940. result = __Pyx_NewRef(__pyx_mstate_global->__pyx_kp_u__3);
  36941. }
  36942. goto done;
  36943. }
  36944. #endif
  36945. /* CIntFromPyVerify (used by CIntFromPy) */
  36946. #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
  36947. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
  36948. #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
  36949. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
  36950. #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
  36951. {\
  36952. func_type value = func_value;\
  36953. if (sizeof(target_type) < sizeof(func_type)) {\
  36954. if (unlikely(value != (func_type) (target_type) value)) {\
  36955. func_type zero = 0;\
  36956. if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
  36957. return (target_type) -1;\
  36958. if (is_unsigned && unlikely(value < zero))\
  36959. goto raise_neg_overflow;\
  36960. else\
  36961. goto raise_overflow;\
  36962. }\
  36963. }\
  36964. return (target_type) value;\
  36965. }
  36966. /* CIntFromPy */
  36967. static CYTHON_INLINE long __Pyx_PyLong_As_long(PyObject *x) {
  36968. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  36969. #pragma GCC diagnostic push
  36970. #pragma GCC diagnostic ignored "-Wconversion"
  36971. #endif
  36972. const long neg_one = (long) -1, const_zero = (long) 0;
  36973. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  36974. #pragma GCC diagnostic pop
  36975. #endif
  36976. const int is_unsigned = neg_one > const_zero;
  36977. if (unlikely(!PyLong_Check(x))) {
  36978. long val;
  36979. PyObject *tmp = __Pyx_PyNumber_Long(x);
  36980. if (!tmp) return (long) -1;
  36981. val = __Pyx_PyLong_As_long(tmp);
  36982. Py_DECREF(tmp);
  36983. return val;
  36984. }
  36985. if (is_unsigned) {
  36986. #if CYTHON_USE_PYLONG_INTERNALS
  36987. if (unlikely(__Pyx_PyLong_IsNeg(x))) {
  36988. goto raise_neg_overflow;
  36989. } else if (__Pyx_PyLong_IsCompact(x)) {
  36990. __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
  36991. } else {
  36992. const digit* digits = __Pyx_PyLong_Digits(x);
  36993. assert(__Pyx_PyLong_DigitCount(x) > 1);
  36994. switch (__Pyx_PyLong_DigitCount(x)) {
  36995. case 2:
  36996. if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
  36997. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  36998. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  36999. } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
  37000. return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  37001. }
  37002. }
  37003. break;
  37004. case 3:
  37005. if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
  37006. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  37007. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37008. } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
  37009. return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  37010. }
  37011. }
  37012. break;
  37013. case 4:
  37014. if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
  37015. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  37016. __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])))
  37017. } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
  37018. return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  37019. }
  37020. }
  37021. break;
  37022. }
  37023. }
  37024. #endif
  37025. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
  37026. if (unlikely(Py_SIZE(x) < 0)) {
  37027. goto raise_neg_overflow;
  37028. }
  37029. #else
  37030. {
  37031. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  37032. if (unlikely(result < 0))
  37033. return (long) -1;
  37034. if (unlikely(result == 1))
  37035. goto raise_neg_overflow;
  37036. }
  37037. #endif
  37038. if ((sizeof(long) <= sizeof(unsigned long))) {
  37039. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
  37040. } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
  37041. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  37042. }
  37043. } else {
  37044. #if CYTHON_USE_PYLONG_INTERNALS
  37045. if (__Pyx_PyLong_IsCompact(x)) {
  37046. __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
  37047. } else {
  37048. const digit* digits = __Pyx_PyLong_Digits(x);
  37049. assert(__Pyx_PyLong_DigitCount(x) > 1);
  37050. switch (__Pyx_PyLong_SignedDigitCount(x)) {
  37051. case -2:
  37052. if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
  37053. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  37054. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37055. } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
  37056. return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  37057. }
  37058. }
  37059. break;
  37060. case 2:
  37061. if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
  37062. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  37063. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37064. } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
  37065. return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  37066. }
  37067. }
  37068. break;
  37069. case -3:
  37070. if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
  37071. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  37072. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37073. } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
  37074. return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  37075. }
  37076. }
  37077. break;
  37078. case 3:
  37079. if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
  37080. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  37081. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37082. } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
  37083. return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  37084. }
  37085. }
  37086. break;
  37087. case -4:
  37088. if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
  37089. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  37090. __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])))
  37091. } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
  37092. return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  37093. }
  37094. }
  37095. break;
  37096. case 4:
  37097. if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
  37098. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  37099. __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])))
  37100. } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
  37101. return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  37102. }
  37103. }
  37104. break;
  37105. }
  37106. }
  37107. #endif
  37108. if ((sizeof(long) <= sizeof(long))) {
  37109. __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
  37110. } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
  37111. __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
  37112. }
  37113. }
  37114. {
  37115. long val;
  37116. int ret = -1;
  37117. #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
  37118. Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
  37119. x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
  37120. if (unlikely(bytes_copied == -1)) {
  37121. } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
  37122. goto raise_overflow;
  37123. } else {
  37124. ret = 0;
  37125. }
  37126. #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
  37127. int one = 1; int is_little = (int)*(unsigned char *)&one;
  37128. unsigned char *bytes = (unsigned char *)&val;
  37129. ret = _PyLong_AsByteArray((PyLongObject *)x,
  37130. bytes, sizeof(val),
  37131. is_little, !is_unsigned);
  37132. #else
  37133. PyObject *v;
  37134. PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
  37135. int bits, remaining_bits, is_negative = 0;
  37136. int chunk_size = (sizeof(long) < 8) ? 30 : 62;
  37137. if (likely(PyLong_CheckExact(x))) {
  37138. v = __Pyx_NewRef(x);
  37139. } else {
  37140. v = PyNumber_Long(x);
  37141. if (unlikely(!v)) return (long) -1;
  37142. assert(PyLong_CheckExact(v));
  37143. }
  37144. {
  37145. int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
  37146. if (unlikely(result < 0)) {
  37147. Py_DECREF(v);
  37148. return (long) -1;
  37149. }
  37150. is_negative = result == 1;
  37151. }
  37152. if (is_unsigned && unlikely(is_negative)) {
  37153. Py_DECREF(v);
  37154. goto raise_neg_overflow;
  37155. } else if (is_negative) {
  37156. stepval = PyNumber_Invert(v);
  37157. Py_DECREF(v);
  37158. if (unlikely(!stepval))
  37159. return (long) -1;
  37160. } else {
  37161. stepval = v;
  37162. }
  37163. v = NULL;
  37164. val = (long) 0;
  37165. mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
  37166. shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
  37167. for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
  37168. PyObject *tmp, *digit;
  37169. long idigit;
  37170. digit = PyNumber_And(stepval, mask);
  37171. if (unlikely(!digit)) goto done;
  37172. idigit = PyLong_AsLong(digit);
  37173. Py_DECREF(digit);
  37174. if (unlikely(idigit < 0)) goto done;
  37175. val |= ((long) idigit) << bits;
  37176. tmp = PyNumber_Rshift(stepval, shift);
  37177. if (unlikely(!tmp)) goto done;
  37178. Py_DECREF(stepval); stepval = tmp;
  37179. }
  37180. Py_DECREF(shift); shift = NULL;
  37181. Py_DECREF(mask); mask = NULL;
  37182. {
  37183. long idigit = PyLong_AsLong(stepval);
  37184. if (unlikely(idigit < 0)) goto done;
  37185. remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
  37186. if (unlikely(idigit >= (1L << remaining_bits)))
  37187. goto raise_overflow;
  37188. val |= ((long) idigit) << bits;
  37189. }
  37190. if (!is_unsigned) {
  37191. if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
  37192. goto raise_overflow;
  37193. if (is_negative)
  37194. val = ~val;
  37195. }
  37196. ret = 0;
  37197. done:
  37198. Py_XDECREF(shift);
  37199. Py_XDECREF(mask);
  37200. Py_XDECREF(stepval);
  37201. #endif
  37202. if (unlikely(ret))
  37203. return (long) -1;
  37204. return val;
  37205. }
  37206. raise_overflow:
  37207. PyErr_SetString(PyExc_OverflowError,
  37208. "value too large to convert to long");
  37209. return (long) -1;
  37210. raise_neg_overflow:
  37211. PyErr_SetString(PyExc_OverflowError,
  37212. "can't convert negative value to long");
  37213. return (long) -1;
  37214. }
  37215. /* CIntFromPy */
  37216. static CYTHON_INLINE int __Pyx_PyLong_As_int(PyObject *x) {
  37217. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  37218. #pragma GCC diagnostic push
  37219. #pragma GCC diagnostic ignored "-Wconversion"
  37220. #endif
  37221. const int neg_one = (int) -1, const_zero = (int) 0;
  37222. #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
  37223. #pragma GCC diagnostic pop
  37224. #endif
  37225. const int is_unsigned = neg_one > const_zero;
  37226. if (unlikely(!PyLong_Check(x))) {
  37227. int val;
  37228. PyObject *tmp = __Pyx_PyNumber_Long(x);
  37229. if (!tmp) return (int) -1;
  37230. val = __Pyx_PyLong_As_int(tmp);
  37231. Py_DECREF(tmp);
  37232. return val;
  37233. }
  37234. if (is_unsigned) {
  37235. #if CYTHON_USE_PYLONG_INTERNALS
  37236. if (unlikely(__Pyx_PyLong_IsNeg(x))) {
  37237. goto raise_neg_overflow;
  37238. } else if (__Pyx_PyLong_IsCompact(x)) {
  37239. __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
  37240. } else {
  37241. const digit* digits = __Pyx_PyLong_Digits(x);
  37242. assert(__Pyx_PyLong_DigitCount(x) > 1);
  37243. switch (__Pyx_PyLong_DigitCount(x)) {
  37244. case 2:
  37245. if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
  37246. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  37247. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37248. } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
  37249. return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  37250. }
  37251. }
  37252. break;
  37253. case 3:
  37254. if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
  37255. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  37256. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37257. } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
  37258. return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  37259. }
  37260. }
  37261. break;
  37262. case 4:
  37263. if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
  37264. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  37265. __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])))
  37266. } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
  37267. return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  37268. }
  37269. }
  37270. break;
  37271. }
  37272. }
  37273. #endif
  37274. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
  37275. if (unlikely(Py_SIZE(x) < 0)) {
  37276. goto raise_neg_overflow;
  37277. }
  37278. #else
  37279. {
  37280. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  37281. if (unlikely(result < 0))
  37282. return (int) -1;
  37283. if (unlikely(result == 1))
  37284. goto raise_neg_overflow;
  37285. }
  37286. #endif
  37287. if ((sizeof(int) <= sizeof(unsigned long))) {
  37288. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
  37289. } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
  37290. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  37291. }
  37292. } else {
  37293. #if CYTHON_USE_PYLONG_INTERNALS
  37294. if (__Pyx_PyLong_IsCompact(x)) {
  37295. __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
  37296. } else {
  37297. const digit* digits = __Pyx_PyLong_Digits(x);
  37298. assert(__Pyx_PyLong_DigitCount(x) > 1);
  37299. switch (__Pyx_PyLong_SignedDigitCount(x)) {
  37300. case -2:
  37301. if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
  37302. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  37303. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37304. } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
  37305. return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  37306. }
  37307. }
  37308. break;
  37309. case 2:
  37310. if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
  37311. if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
  37312. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37313. } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
  37314. return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  37315. }
  37316. }
  37317. break;
  37318. case -3:
  37319. if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
  37320. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  37321. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37322. } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
  37323. return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  37324. }
  37325. }
  37326. break;
  37327. case 3:
  37328. if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
  37329. if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
  37330. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  37331. } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
  37332. return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  37333. }
  37334. }
  37335. break;
  37336. case -4:
  37337. if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
  37338. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  37339. __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])))
  37340. } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
  37341. return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  37342. }
  37343. }
  37344. break;
  37345. case 4:
  37346. if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
  37347. if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
  37348. __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])))
  37349. } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
  37350. return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  37351. }
  37352. }
  37353. break;
  37354. }
  37355. }
  37356. #endif
  37357. if ((sizeof(int) <= sizeof(long))) {
  37358. __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
  37359. } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
  37360. __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
  37361. }
  37362. }
  37363. {
  37364. int val;
  37365. int ret = -1;
  37366. #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
  37367. Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
  37368. x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
  37369. if (unlikely(bytes_copied == -1)) {
  37370. } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
  37371. goto raise_overflow;
  37372. } else {
  37373. ret = 0;
  37374. }
  37375. #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
  37376. int one = 1; int is_little = (int)*(unsigned char *)&one;
  37377. unsigned char *bytes = (unsigned char *)&val;
  37378. ret = _PyLong_AsByteArray((PyLongObject *)x,
  37379. bytes, sizeof(val),
  37380. is_little, !is_unsigned);
  37381. #else
  37382. PyObject *v;
  37383. PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
  37384. int bits, remaining_bits, is_negative = 0;
  37385. int chunk_size = (sizeof(long) < 8) ? 30 : 62;
  37386. if (likely(PyLong_CheckExact(x))) {
  37387. v = __Pyx_NewRef(x);
  37388. } else {
  37389. v = PyNumber_Long(x);
  37390. if (unlikely(!v)) return (int) -1;
  37391. assert(PyLong_CheckExact(v));
  37392. }
  37393. {
  37394. int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
  37395. if (unlikely(result < 0)) {
  37396. Py_DECREF(v);
  37397. return (int) -1;
  37398. }
  37399. is_negative = result == 1;
  37400. }
  37401. if (is_unsigned && unlikely(is_negative)) {
  37402. Py_DECREF(v);
  37403. goto raise_neg_overflow;
  37404. } else if (is_negative) {
  37405. stepval = PyNumber_Invert(v);
  37406. Py_DECREF(v);
  37407. if (unlikely(!stepval))
  37408. return (int) -1;
  37409. } else {
  37410. stepval = v;
  37411. }
  37412. v = NULL;
  37413. val = (int) 0;
  37414. mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
  37415. shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
  37416. for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
  37417. PyObject *tmp, *digit;
  37418. long idigit;
  37419. digit = PyNumber_And(stepval, mask);
  37420. if (unlikely(!digit)) goto done;
  37421. idigit = PyLong_AsLong(digit);
  37422. Py_DECREF(digit);
  37423. if (unlikely(idigit < 0)) goto done;
  37424. val |= ((int) idigit) << bits;
  37425. tmp = PyNumber_Rshift(stepval, shift);
  37426. if (unlikely(!tmp)) goto done;
  37427. Py_DECREF(stepval); stepval = tmp;
  37428. }
  37429. Py_DECREF(shift); shift = NULL;
  37430. Py_DECREF(mask); mask = NULL;
  37431. {
  37432. long idigit = PyLong_AsLong(stepval);
  37433. if (unlikely(idigit < 0)) goto done;
  37434. remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
  37435. if (unlikely(idigit >= (1L << remaining_bits)))
  37436. goto raise_overflow;
  37437. val |= ((int) idigit) << bits;
  37438. }
  37439. if (!is_unsigned) {
  37440. if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
  37441. goto raise_overflow;
  37442. if (is_negative)
  37443. val = ~val;
  37444. }
  37445. ret = 0;
  37446. done:
  37447. Py_XDECREF(shift);
  37448. Py_XDECREF(mask);
  37449. Py_XDECREF(stepval);
  37450. #endif
  37451. if (unlikely(ret))
  37452. return (int) -1;
  37453. return val;
  37454. }
  37455. raise_overflow:
  37456. PyErr_SetString(PyExc_OverflowError,
  37457. "value too large to convert to int");
  37458. return (int) -1;
  37459. raise_neg_overflow:
  37460. PyErr_SetString(PyExc_OverflowError,
  37461. "can't convert negative value to int");
  37462. return (int) -1;
  37463. }
  37464. /* FastTypeChecks */
  37465. #if CYTHON_COMPILING_IN_CPYTHON
  37466. static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
  37467. while (a) {
  37468. a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
  37469. if (a == b)
  37470. return 1;
  37471. }
  37472. return b == &PyBaseObject_Type;
  37473. }
  37474. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
  37475. PyObject *mro;
  37476. if (a == b) return 1;
  37477. mro = a->tp_mro;
  37478. if (likely(mro)) {
  37479. Py_ssize_t i, n;
  37480. n = PyTuple_GET_SIZE(mro);
  37481. for (i = 0; i < n; i++) {
  37482. if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
  37483. return 1;
  37484. }
  37485. return 0;
  37486. }
  37487. return __Pyx_InBases(a, b);
  37488. }
  37489. static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
  37490. PyObject *mro;
  37491. if (cls == a || cls == b) return 1;
  37492. mro = cls->tp_mro;
  37493. if (likely(mro)) {
  37494. Py_ssize_t i, n;
  37495. n = PyTuple_GET_SIZE(mro);
  37496. for (i = 0; i < n; i++) {
  37497. PyObject *base = PyTuple_GET_ITEM(mro, i);
  37498. if (base == (PyObject *)a || base == (PyObject *)b)
  37499. return 1;
  37500. }
  37501. return 0;
  37502. }
  37503. return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
  37504. }
  37505. static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
  37506. if (exc_type1) {
  37507. return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
  37508. } else {
  37509. return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
  37510. }
  37511. }
  37512. static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  37513. Py_ssize_t i, n;
  37514. assert(PyExceptionClass_Check(exc_type));
  37515. n = PyTuple_GET_SIZE(tuple);
  37516. for (i=0; i<n; i++) {
  37517. if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  37518. }
  37519. for (i=0; i<n; i++) {
  37520. PyObject *t = PyTuple_GET_ITEM(tuple, i);
  37521. if (likely(PyExceptionClass_Check(t))) {
  37522. if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
  37523. } else {
  37524. }
  37525. }
  37526. return 0;
  37527. }
  37528. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
  37529. if (likely(err == exc_type)) return 1;
  37530. if (likely(PyExceptionClass_Check(err))) {
  37531. if (likely(PyExceptionClass_Check(exc_type))) {
  37532. return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
  37533. } else if (likely(PyTuple_Check(exc_type))) {
  37534. return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
  37535. } else {
  37536. }
  37537. }
  37538. return PyErr_GivenExceptionMatches(err, exc_type);
  37539. }
  37540. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
  37541. assert(PyExceptionClass_Check(exc_type1));
  37542. assert(PyExceptionClass_Check(exc_type2));
  37543. if (likely(err == exc_type1 || err == exc_type2)) return 1;
  37544. if (likely(PyExceptionClass_Check(err))) {
  37545. return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
  37546. }
  37547. return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
  37548. }
  37549. #endif
  37550. /* GetRuntimeVersion */
  37551. #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
  37552. void __Pyx_init_runtime_version(void) {
  37553. if (__Pyx_cached_runtime_version == 0) {
  37554. const char* rt_version = Py_GetVersion();
  37555. unsigned long version = 0;
  37556. unsigned long factor = 0x01000000UL;
  37557. unsigned int digit = 0;
  37558. int i = 0;
  37559. while (factor) {
  37560. while ('0' <= rt_version[i] && rt_version[i] <= '9') {
  37561. digit = digit * 10 + (unsigned int) (rt_version[i] - '0');
  37562. ++i;
  37563. }
  37564. version += factor * digit;
  37565. if (rt_version[i] != '.')
  37566. break;
  37567. digit = 0;
  37568. factor >>= 8;
  37569. ++i;
  37570. }
  37571. __Pyx_cached_runtime_version = version;
  37572. }
  37573. }
  37574. #endif
  37575. static unsigned long __Pyx_get_runtime_version(void) {
  37576. #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
  37577. return Py_Version & ~0xFFUL;
  37578. #else
  37579. return __Pyx_cached_runtime_version;
  37580. #endif
  37581. }
  37582. /* CheckBinaryVersion */
  37583. static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) {
  37584. const unsigned long MAJOR_MINOR = 0xFFFF0000UL;
  37585. if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR))
  37586. return 0;
  37587. if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
  37588. return 1;
  37589. {
  37590. char message[200];
  37591. PyOS_snprintf(message, sizeof(message),
  37592. "compile time Python version %d.%d "
  37593. "of module '%.100s' "
  37594. "%s "
  37595. "runtime version %d.%d",
  37596. (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF),
  37597. __Pyx_MODULE_NAME,
  37598. (allow_newer) ? "was newer than" : "does not match",
  37599. (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
  37600. );
  37601. return PyErr_WarnEx(NULL, message, 1);
  37602. }
  37603. }
  37604. /* NewCodeObj */
  37605. #if CYTHON_COMPILING_IN_LIMITED_API
  37606. static PyObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
  37607. PyObject *code, PyObject *c, PyObject* n, PyObject *v,
  37608. PyObject *fv, PyObject *cell, PyObject* fn,
  37609. PyObject *name, int fline, PyObject *lnos) {
  37610. PyObject *exception_table = NULL;
  37611. PyObject *types_module=NULL, *code_type=NULL, *result=NULL;
  37612. #if __PYX_LIMITED_VERSION_HEX < 0x030b0000
  37613. PyObject *version_info;
  37614. PyObject *py_minor_version = NULL;
  37615. #endif
  37616. long minor_version = 0;
  37617. PyObject *type, *value, *traceback;
  37618. PyErr_Fetch(&type, &value, &traceback);
  37619. #if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
  37620. minor_version = 11;
  37621. #else
  37622. if (!(version_info = PySys_GetObject("version_info"))) goto end;
  37623. if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end;
  37624. minor_version = PyLong_AsLong(py_minor_version);
  37625. Py_DECREF(py_minor_version);
  37626. if (minor_version == -1 && PyErr_Occurred()) goto end;
  37627. #endif
  37628. if (!(types_module = PyImport_ImportModule("types"))) goto end;
  37629. if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end;
  37630. if (minor_version <= 7) {
  37631. (void)p;
  37632. result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOOO", a, k, l, s, f, code,
  37633. c, n, v, fn, name, fline, lnos, fv, cell);
  37634. } else if (minor_version <= 10) {
  37635. result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOOO", a,p, k, l, s, f, code,
  37636. c, n, v, fn, name, fline, lnos, fv, cell);
  37637. } else {
  37638. if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end;
  37639. result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOOOO", a,p, k, l, s, f, code,
  37640. c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell);
  37641. }
  37642. end:
  37643. Py_XDECREF(code_type);
  37644. Py_XDECREF(exception_table);
  37645. Py_XDECREF(types_module);
  37646. if (type) {
  37647. PyErr_Restore(type, value, traceback);
  37648. }
  37649. return result;
  37650. }
  37651. #elif PY_VERSION_HEX >= 0x030B0000
  37652. static PyCodeObject* __Pyx__PyCode_New(int a, int p, int k, int l, int s, int f,
  37653. PyObject *code, PyObject *c, PyObject* n, PyObject *v,
  37654. PyObject *fv, PyObject *cell, PyObject* fn,
  37655. PyObject *name, int fline, PyObject *lnos) {
  37656. PyCodeObject *result;
  37657. result =
  37658. #if PY_VERSION_HEX >= 0x030C0000
  37659. PyUnstable_Code_NewWithPosOnlyArgs
  37660. #else
  37661. PyCode_NewWithPosOnlyArgs
  37662. #endif
  37663. (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, __pyx_mstate_global->__pyx_empty_bytes);
  37664. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030c00A1
  37665. if (likely(result))
  37666. result->_co_firsttraceable = 0;
  37667. #endif
  37668. return result;
  37669. }
  37670. #elif !CYTHON_COMPILING_IN_PYPY
  37671. #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  37672. PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  37673. #else
  37674. #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  37675. PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  37676. #endif
  37677. static PyObject* __Pyx_PyCode_New(
  37678. const __Pyx_PyCode_New_function_description descr,
  37679. PyObject * const *varnames,
  37680. PyObject *filename,
  37681. PyObject *funcname,
  37682. PyObject *line_table,
  37683. PyObject *tuple_dedup_map
  37684. ) {
  37685. PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL;
  37686. Py_ssize_t var_count = (Py_ssize_t) descr.nlocals;
  37687. PyObject *varnames_tuple = PyTuple_New(var_count);
  37688. if (unlikely(!varnames_tuple)) return NULL;
  37689. for (Py_ssize_t i=0; i < var_count; i++) {
  37690. Py_INCREF(varnames[i]);
  37691. if (__Pyx_PyTuple_SET_ITEM(varnames_tuple, i, varnames[i]) != (0)) goto done;
  37692. }
  37693. #if CYTHON_COMPILING_IN_LIMITED_API
  37694. varnames_tuple_dedup = PyDict_GetItem(tuple_dedup_map, varnames_tuple);
  37695. if (!varnames_tuple_dedup) {
  37696. if (unlikely(PyDict_SetItem(tuple_dedup_map, varnames_tuple, varnames_tuple) < 0)) goto done;
  37697. varnames_tuple_dedup = varnames_tuple;
  37698. }
  37699. #else
  37700. varnames_tuple_dedup = PyDict_SetDefault(tuple_dedup_map, varnames_tuple, varnames_tuple);
  37701. if (unlikely(!varnames_tuple_dedup)) goto done;
  37702. #endif
  37703. #if CYTHON_AVOID_BORROWED_REFS
  37704. Py_INCREF(varnames_tuple_dedup);
  37705. #endif
  37706. if (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table != NULL && !CYTHON_COMPILING_IN_GRAAL) {
  37707. Py_ssize_t line_table_length = __Pyx_PyBytes_GET_SIZE(line_table);
  37708. #if !CYTHON_ASSUME_SAFE_SIZE
  37709. if (unlikely(line_table_length == -1)) goto done;
  37710. #endif
  37711. Py_ssize_t code_len = (line_table_length * 2 + 4) & ~3LL;
  37712. code_bytes = PyBytes_FromStringAndSize(NULL, code_len);
  37713. if (unlikely(!code_bytes)) goto done;
  37714. char* c_code_bytes = PyBytes_AsString(code_bytes);
  37715. if (unlikely(!c_code_bytes)) goto done;
  37716. memset(c_code_bytes, 0, (size_t) code_len);
  37717. }
  37718. code_obj = (PyObject*) __Pyx__PyCode_New(
  37719. (int) descr.argcount,
  37720. (int) descr.num_posonly_args,
  37721. (int) descr.num_kwonly_args,
  37722. (int) descr.nlocals,
  37723. 0,
  37724. (int) descr.flags,
  37725. code_bytes ? code_bytes : __pyx_mstate_global->__pyx_empty_bytes,
  37726. __pyx_mstate_global->__pyx_empty_tuple,
  37727. __pyx_mstate_global->__pyx_empty_tuple,
  37728. varnames_tuple_dedup,
  37729. __pyx_mstate_global->__pyx_empty_tuple,
  37730. __pyx_mstate_global->__pyx_empty_tuple,
  37731. filename,
  37732. funcname,
  37733. (int) descr.first_line,
  37734. (__PYX_LIMITED_VERSION_HEX >= (0x030b0000) && line_table) ? line_table : __pyx_mstate_global->__pyx_empty_bytes
  37735. );
  37736. done:
  37737. Py_XDECREF(code_bytes);
  37738. #if CYTHON_AVOID_BORROWED_REFS
  37739. Py_XDECREF(varnames_tuple_dedup);
  37740. #endif
  37741. Py_DECREF(varnames_tuple);
  37742. return code_obj;
  37743. }
  37744. /* DecompressString */
  37745. static PyObject *__Pyx_DecompressString(const char *s, Py_ssize_t length, int algo) {
  37746. PyObject *module, *decompress, *compressed_bytes, *decompressed;
  37747. const char* module_name = algo == 3 ? "compression.zstd" : algo == 2 ? "bz2" : "zlib";
  37748. PyObject *methodname = PyUnicode_FromString("decompress");
  37749. if (unlikely(!methodname)) return NULL;
  37750. #if __PYX_LIMITED_VERSION_HEX >= 0x030e0000
  37751. if (algo == 3) {
  37752. PyObject *fromlist = Py_BuildValue("[O]", methodname);
  37753. if (unlikely(!fromlist)) return NULL;
  37754. module = PyImport_ImportModuleLevel("compression.zstd", NULL, NULL, fromlist, 0);
  37755. Py_DECREF(fromlist);
  37756. } else
  37757. #endif
  37758. module = PyImport_ImportModule(module_name);
  37759. if (unlikely(!module)) goto import_failed;
  37760. decompress = PyObject_GetAttr(module, methodname);
  37761. if (unlikely(!decompress)) goto import_failed;
  37762. {
  37763. #ifdef __cplusplus
  37764. char *memview_bytes = const_cast<char*>(s);
  37765. #else
  37766. #if defined(__clang__)
  37767. #pragma clang diagnostic push
  37768. #pragma clang diagnostic ignored "-Wcast-qual"
  37769. #elif !defined(__INTEL_COMPILER) && defined(__GNUC__)
  37770. #pragma GCC diagnostic push
  37771. #pragma GCC diagnostic ignored "-Wcast-qual"
  37772. #endif
  37773. char *memview_bytes = (char*) s;
  37774. #if defined(__clang__)
  37775. #pragma clang diagnostic pop
  37776. #elif !defined(__INTEL_COMPILER) && defined(__GNUC__)
  37777. #pragma GCC diagnostic pop
  37778. #endif
  37779. #endif
  37780. #if CYTHON_COMPILING_IN_LIMITED_API && !defined(PyBUF_READ)
  37781. int memview_flags = 0x100;
  37782. #else
  37783. int memview_flags = PyBUF_READ;
  37784. #endif
  37785. compressed_bytes = PyMemoryView_FromMemory(memview_bytes, length, memview_flags);
  37786. }
  37787. if (unlikely(!compressed_bytes)) {
  37788. Py_DECREF(decompress);
  37789. goto bad;
  37790. }
  37791. decompressed = PyObject_CallFunctionObjArgs(decompress, compressed_bytes, NULL);
  37792. Py_DECREF(compressed_bytes);
  37793. Py_DECREF(decompress);
  37794. Py_DECREF(module);
  37795. Py_DECREF(methodname);
  37796. return decompressed;
  37797. import_failed:
  37798. PyErr_Format(PyExc_ImportError,
  37799. "Failed to import '%.20s.decompress' - cannot initialise module strings. "
  37800. "String compression was configured with the C macro 'CYTHON_COMPRESS_STRINGS=%d'.",
  37801. module_name, algo);
  37802. bad:
  37803. Py_XDECREF(module);
  37804. Py_DECREF(methodname);
  37805. return NULL;
  37806. }
  37807. #include <string.h>
  37808. static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) {
  37809. size_t len = strlen(s);
  37810. if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
  37811. PyErr_SetString(PyExc_OverflowError, "byte string is too long");
  37812. return -1;
  37813. }
  37814. return (Py_ssize_t) len;
  37815. }
  37816. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
  37817. Py_ssize_t len = __Pyx_ssize_strlen(c_str);
  37818. if (unlikely(len < 0)) return NULL;
  37819. return __Pyx_PyUnicode_FromStringAndSize(c_str, len);
  37820. }
  37821. static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) {
  37822. Py_ssize_t len = __Pyx_ssize_strlen(c_str);
  37823. if (unlikely(len < 0)) return NULL;
  37824. return PyByteArray_FromStringAndSize(c_str, len);
  37825. }
  37826. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
  37827. Py_ssize_t ignore;
  37828. return __Pyx_PyObject_AsStringAndSize(o, &ignore);
  37829. }
  37830. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
  37831. static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  37832. if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
  37833. #if CYTHON_COMPILING_IN_LIMITED_API
  37834. {
  37835. const char* result;
  37836. Py_ssize_t unicode_length;
  37837. CYTHON_MAYBE_UNUSED_VAR(unicode_length); // only for __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  37838. #if __PYX_LIMITED_VERSION_HEX < 0x030A0000
  37839. if (unlikely(PyArg_Parse(o, "s#", &result, length) < 0)) return NULL;
  37840. #else
  37841. result = PyUnicode_AsUTF8AndSize(o, length);
  37842. #endif
  37843. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  37844. unicode_length = PyUnicode_GetLength(o);
  37845. if (unlikely(unicode_length < 0)) return NULL;
  37846. if (unlikely(unicode_length != *length)) {
  37847. PyUnicode_AsASCIIString(o);
  37848. return NULL;
  37849. }
  37850. #endif
  37851. return result;
  37852. }
  37853. #else
  37854. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  37855. if (likely(PyUnicode_IS_ASCII(o))) {
  37856. *length = PyUnicode_GET_LENGTH(o);
  37857. return PyUnicode_AsUTF8(o);
  37858. } else {
  37859. PyUnicode_AsASCIIString(o);
  37860. return NULL;
  37861. }
  37862. #else
  37863. return PyUnicode_AsUTF8AndSize(o, length);
  37864. #endif
  37865. #endif
  37866. }
  37867. #endif
  37868. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  37869. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_UTF8
  37870. if (PyUnicode_Check(o)) {
  37871. return __Pyx_PyUnicode_AsStringAndSize(o, length);
  37872. } else
  37873. #endif
  37874. if (PyByteArray_Check(o)) {
  37875. #if (CYTHON_ASSUME_SAFE_SIZE && CYTHON_ASSUME_SAFE_MACROS) || (CYTHON_COMPILING_IN_PYPY && (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)))
  37876. *length = PyByteArray_GET_SIZE(o);
  37877. return PyByteArray_AS_STRING(o);
  37878. #else
  37879. *length = PyByteArray_Size(o);
  37880. if (*length == -1) return NULL;
  37881. return PyByteArray_AsString(o);
  37882. #endif
  37883. } else
  37884. {
  37885. char* result;
  37886. int r = PyBytes_AsStringAndSize(o, &result, length);
  37887. if (unlikely(r < 0)) {
  37888. return NULL;
  37889. } else {
  37890. return result;
  37891. }
  37892. }
  37893. }
  37894. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
  37895. int is_true = x == Py_True;
  37896. if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
  37897. else return PyObject_IsTrue(x);
  37898. }
  37899. static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
  37900. int retval;
  37901. if (unlikely(!x)) return -1;
  37902. retval = __Pyx_PyObject_IsTrue(x);
  37903. Py_DECREF(x);
  37904. return retval;
  37905. }
  37906. static PyObject* __Pyx_PyNumber_LongWrongResultType(PyObject* result) {
  37907. __Pyx_TypeName result_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(result));
  37908. if (PyLong_Check(result)) {
  37909. if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
  37910. "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). "
  37911. "The ability to return an instance of a strict subclass of int is deprecated, "
  37912. "and may be removed in a future version of Python.",
  37913. result_type_name)) {
  37914. __Pyx_DECREF_TypeName(result_type_name);
  37915. Py_DECREF(result);
  37916. return NULL;
  37917. }
  37918. __Pyx_DECREF_TypeName(result_type_name);
  37919. return result;
  37920. }
  37921. PyErr_Format(PyExc_TypeError,
  37922. "__int__ returned non-int (type " __Pyx_FMT_TYPENAME ")",
  37923. result_type_name);
  37924. __Pyx_DECREF_TypeName(result_type_name);
  37925. Py_DECREF(result);
  37926. return NULL;
  37927. }
  37928. static CYTHON_INLINE PyObject* __Pyx_PyNumber_Long(PyObject* x) {
  37929. #if CYTHON_USE_TYPE_SLOTS
  37930. PyNumberMethods *m;
  37931. #endif
  37932. PyObject *res = NULL;
  37933. if (likely(PyLong_Check(x)))
  37934. return __Pyx_NewRef(x);
  37935. #if CYTHON_USE_TYPE_SLOTS
  37936. m = Py_TYPE(x)->tp_as_number;
  37937. if (likely(m && m->nb_int)) {
  37938. res = m->nb_int(x);
  37939. }
  37940. #else
  37941. if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
  37942. res = PyNumber_Long(x);
  37943. }
  37944. #endif
  37945. if (likely(res)) {
  37946. if (unlikely(!PyLong_CheckExact(res))) {
  37947. return __Pyx_PyNumber_LongWrongResultType(res);
  37948. }
  37949. }
  37950. else if (!PyErr_Occurred()) {
  37951. PyErr_SetString(PyExc_TypeError,
  37952. "an integer is required");
  37953. }
  37954. return res;
  37955. }
  37956. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  37957. Py_ssize_t ival;
  37958. PyObject *x;
  37959. if (likely(PyLong_CheckExact(b))) {
  37960. #if CYTHON_USE_PYLONG_INTERNALS
  37961. if (likely(__Pyx_PyLong_IsCompact(b))) {
  37962. return __Pyx_PyLong_CompactValue(b);
  37963. } else {
  37964. const digit* digits = __Pyx_PyLong_Digits(b);
  37965. const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b);
  37966. switch (size) {
  37967. case 2:
  37968. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  37969. return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  37970. }
  37971. break;
  37972. case -2:
  37973. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  37974. return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  37975. }
  37976. break;
  37977. case 3:
  37978. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  37979. return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  37980. }
  37981. break;
  37982. case -3:
  37983. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  37984. return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  37985. }
  37986. break;
  37987. case 4:
  37988. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  37989. 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]));
  37990. }
  37991. break;
  37992. case -4:
  37993. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  37994. 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]));
  37995. }
  37996. break;
  37997. }
  37998. }
  37999. #endif
  38000. return PyLong_AsSsize_t(b);
  38001. }
  38002. x = PyNumber_Index(b);
  38003. if (!x) return -1;
  38004. ival = PyLong_AsSsize_t(x);
  38005. Py_DECREF(x);
  38006. return ival;
  38007. }
  38008. static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
  38009. if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
  38010. return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
  38011. } else {
  38012. Py_ssize_t ival;
  38013. PyObject *x;
  38014. x = PyNumber_Index(o);
  38015. if (!x) return -1;
  38016. ival = PyLong_AsLong(x);
  38017. Py_DECREF(x);
  38018. return ival;
  38019. }
  38020. }
  38021. static CYTHON_INLINE PyObject *__Pyx_Owned_Py_None(int b) {
  38022. CYTHON_UNUSED_VAR(b);
  38023. return __Pyx_NewRef(Py_None);
  38024. }
  38025. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  38026. return __Pyx_NewRef(b ? Py_True: Py_False);
  38027. }
  38028. static CYTHON_INLINE PyObject * __Pyx_PyLong_FromSize_t(size_t ival) {
  38029. return PyLong_FromSize_t(ival);
  38030. }
  38031. /* MultiPhaseInitModuleState */
  38032. #if CYTHON_PEP489_MULTI_PHASE_INIT && CYTHON_USE_MODULE_STATE
  38033. #ifndef CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  38034. #if (CYTHON_COMPILING_IN_LIMITED_API || PY_VERSION_HEX >= 0x030C0000)
  38035. #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 1
  38036. #else
  38037. #define CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE 0
  38038. #endif
  38039. #endif
  38040. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE && !CYTHON_ATOMICS
  38041. #error "Module state with PEP489 requires atomics. Currently that's one of\
  38042. C11, C++11, gcc atomic intrinsics or MSVC atomic intrinsics"
  38043. #endif
  38044. #if !CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  38045. #define __Pyx_ModuleStateLookup_Lock()
  38046. #define __Pyx_ModuleStateLookup_Unlock()
  38047. #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d0000
  38048. static PyMutex __Pyx_ModuleStateLookup_mutex = {0};
  38049. #define __Pyx_ModuleStateLookup_Lock() PyMutex_Lock(&__Pyx_ModuleStateLookup_mutex)
  38050. #define __Pyx_ModuleStateLookup_Unlock() PyMutex_Unlock(&__Pyx_ModuleStateLookup_mutex)
  38051. #elif defined(__cplusplus) && __cplusplus >= 201103L
  38052. #include <mutex>
  38053. static std::mutex __Pyx_ModuleStateLookup_mutex;
  38054. #define __Pyx_ModuleStateLookup_Lock() __Pyx_ModuleStateLookup_mutex.lock()
  38055. #define __Pyx_ModuleStateLookup_Unlock() __Pyx_ModuleStateLookup_mutex.unlock()
  38056. #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ > 201112L) && !defined(__STDC_NO_THREADS__)
  38057. #include <threads.h>
  38058. static mtx_t __Pyx_ModuleStateLookup_mutex;
  38059. static once_flag __Pyx_ModuleStateLookup_mutex_once_flag = ONCE_FLAG_INIT;
  38060. static void __Pyx_ModuleStateLookup_initialize_mutex(void) {
  38061. mtx_init(&__Pyx_ModuleStateLookup_mutex, mtx_plain);
  38062. }
  38063. #define __Pyx_ModuleStateLookup_Lock()\
  38064. call_once(&__Pyx_ModuleStateLookup_mutex_once_flag, __Pyx_ModuleStateLookup_initialize_mutex);\
  38065. mtx_lock(&__Pyx_ModuleStateLookup_mutex)
  38066. #define __Pyx_ModuleStateLookup_Unlock() mtx_unlock(&__Pyx_ModuleStateLookup_mutex)
  38067. #elif defined(HAVE_PTHREAD_H)
  38068. #include <pthread.h>
  38069. static pthread_mutex_t __Pyx_ModuleStateLookup_mutex = PTHREAD_MUTEX_INITIALIZER;
  38070. #define __Pyx_ModuleStateLookup_Lock() pthread_mutex_lock(&__Pyx_ModuleStateLookup_mutex)
  38071. #define __Pyx_ModuleStateLookup_Unlock() pthread_mutex_unlock(&__Pyx_ModuleStateLookup_mutex)
  38072. #elif defined(_WIN32)
  38073. #include <Windows.h> // synchapi.h on its own doesn't work
  38074. static SRWLOCK __Pyx_ModuleStateLookup_mutex = SRWLOCK_INIT;
  38075. #define __Pyx_ModuleStateLookup_Lock() AcquireSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
  38076. #define __Pyx_ModuleStateLookup_Unlock() ReleaseSRWLockExclusive(&__Pyx_ModuleStateLookup_mutex)
  38077. #else
  38078. #error "No suitable lock available for CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE.\
  38079. Requires C standard >= C11, or C++ standard >= C++11,\
  38080. or pthreads, or the Windows 32 API, or Python >= 3.13."
  38081. #endif
  38082. typedef struct {
  38083. int64_t id;
  38084. PyObject *module;
  38085. } __Pyx_InterpreterIdAndModule;
  38086. typedef struct {
  38087. char interpreter_id_as_index;
  38088. Py_ssize_t count;
  38089. Py_ssize_t allocated;
  38090. __Pyx_InterpreterIdAndModule table[1];
  38091. } __Pyx_ModuleStateLookupData;
  38092. #define __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE 32
  38093. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  38094. static __pyx_atomic_int_type __Pyx_ModuleStateLookup_read_counter = 0;
  38095. #endif
  38096. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  38097. static __pyx_atomic_ptr_type __Pyx_ModuleStateLookup_data = 0;
  38098. #else
  38099. static __Pyx_ModuleStateLookupData* __Pyx_ModuleStateLookup_data = NULL;
  38100. #endif
  38101. static __Pyx_InterpreterIdAndModule* __Pyx_State_FindModuleStateLookupTableLowerBound(
  38102. __Pyx_InterpreterIdAndModule* table,
  38103. Py_ssize_t count,
  38104. int64_t interpreterId) {
  38105. __Pyx_InterpreterIdAndModule* begin = table;
  38106. __Pyx_InterpreterIdAndModule* end = begin + count;
  38107. if (begin->id == interpreterId) {
  38108. return begin;
  38109. }
  38110. while ((end - begin) > __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
  38111. __Pyx_InterpreterIdAndModule* halfway = begin + (end - begin)/2;
  38112. if (halfway->id == interpreterId) {
  38113. return halfway;
  38114. }
  38115. if (halfway->id < interpreterId) {
  38116. begin = halfway;
  38117. } else {
  38118. end = halfway;
  38119. }
  38120. }
  38121. for (; begin < end; ++begin) {
  38122. if (begin->id >= interpreterId) return begin;
  38123. }
  38124. return begin;
  38125. }
  38126. static PyObject *__Pyx_State_FindModule(CYTHON_UNUSED void* dummy) {
  38127. int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
  38128. if (interpreter_id == -1) return NULL;
  38129. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  38130. __Pyx_ModuleStateLookupData* data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
  38131. {
  38132. __pyx_atomic_incr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
  38133. if (likely(data)) {
  38134. __Pyx_ModuleStateLookupData* new_data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_acquire(&__Pyx_ModuleStateLookup_data);
  38135. if (likely(data == new_data)) {
  38136. goto read_finished;
  38137. }
  38138. }
  38139. __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
  38140. __Pyx_ModuleStateLookup_Lock();
  38141. __pyx_atomic_incr_relaxed(&__Pyx_ModuleStateLookup_read_counter);
  38142. data = (__Pyx_ModuleStateLookupData*)__pyx_atomic_pointer_load_relaxed(&__Pyx_ModuleStateLookup_data);
  38143. __Pyx_ModuleStateLookup_Unlock();
  38144. }
  38145. read_finished:;
  38146. #else
  38147. __Pyx_ModuleStateLookupData* data = __Pyx_ModuleStateLookup_data;
  38148. #endif
  38149. __Pyx_InterpreterIdAndModule* found = NULL;
  38150. if (unlikely(!data)) goto end;
  38151. if (data->interpreter_id_as_index) {
  38152. if (interpreter_id < data->count) {
  38153. found = data->table+interpreter_id;
  38154. }
  38155. } else {
  38156. found = __Pyx_State_FindModuleStateLookupTableLowerBound(
  38157. data->table, data->count, interpreter_id);
  38158. }
  38159. end:
  38160. {
  38161. PyObject *result=NULL;
  38162. if (found && found->id == interpreter_id) {
  38163. result = found->module;
  38164. }
  38165. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  38166. __pyx_atomic_decr_acq_rel(&__Pyx_ModuleStateLookup_read_counter);
  38167. #endif
  38168. return result;
  38169. }
  38170. }
  38171. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  38172. static void __Pyx_ModuleStateLookup_wait_until_no_readers(void) {
  38173. while (__pyx_atomic_load(&__Pyx_ModuleStateLookup_read_counter) != 0);
  38174. }
  38175. #else
  38176. #define __Pyx_ModuleStateLookup_wait_until_no_readers()
  38177. #endif
  38178. static int __Pyx_State_AddModuleInterpIdAsIndex(__Pyx_ModuleStateLookupData **old_data, PyObject* module, int64_t interpreter_id) {
  38179. Py_ssize_t to_allocate = (*old_data)->allocated;
  38180. while (to_allocate <= interpreter_id) {
  38181. if (to_allocate == 0) to_allocate = 1;
  38182. else to_allocate *= 2;
  38183. }
  38184. __Pyx_ModuleStateLookupData *new_data = *old_data;
  38185. if (to_allocate != (*old_data)->allocated) {
  38186. new_data = (__Pyx_ModuleStateLookupData *)realloc(
  38187. *old_data,
  38188. sizeof(__Pyx_ModuleStateLookupData)+(to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
  38189. if (!new_data) {
  38190. PyErr_NoMemory();
  38191. return -1;
  38192. }
  38193. for (Py_ssize_t i = new_data->allocated; i < to_allocate; ++i) {
  38194. new_data->table[i].id = i;
  38195. new_data->table[i].module = NULL;
  38196. }
  38197. new_data->allocated = to_allocate;
  38198. }
  38199. new_data->table[interpreter_id].module = module;
  38200. if (new_data->count < interpreter_id+1) {
  38201. new_data->count = interpreter_id+1;
  38202. }
  38203. *old_data = new_data;
  38204. return 0;
  38205. }
  38206. static void __Pyx_State_ConvertFromInterpIdAsIndex(__Pyx_ModuleStateLookupData *data) {
  38207. __Pyx_InterpreterIdAndModule *read = data->table;
  38208. __Pyx_InterpreterIdAndModule *write = data->table;
  38209. __Pyx_InterpreterIdAndModule *end = read + data->count;
  38210. for (; read<end; ++read) {
  38211. if (read->module) {
  38212. write->id = read->id;
  38213. write->module = read->module;
  38214. ++write;
  38215. }
  38216. }
  38217. data->count = write - data->table;
  38218. for (; write<end; ++write) {
  38219. write->id = 0;
  38220. write->module = NULL;
  38221. }
  38222. data->interpreter_id_as_index = 0;
  38223. }
  38224. static int __Pyx_State_AddModule(PyObject* module, CYTHON_UNUSED void* dummy) {
  38225. int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
  38226. if (interpreter_id == -1) return -1;
  38227. int result = 0;
  38228. __Pyx_ModuleStateLookup_Lock();
  38229. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  38230. __Pyx_ModuleStateLookupData *old_data = (__Pyx_ModuleStateLookupData *)
  38231. __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
  38232. #else
  38233. __Pyx_ModuleStateLookupData *old_data = __Pyx_ModuleStateLookup_data;
  38234. #endif
  38235. __Pyx_ModuleStateLookupData *new_data = old_data;
  38236. if (!new_data) {
  38237. new_data = (__Pyx_ModuleStateLookupData *)calloc(1, sizeof(__Pyx_ModuleStateLookupData));
  38238. if (!new_data) {
  38239. result = -1;
  38240. PyErr_NoMemory();
  38241. goto end;
  38242. }
  38243. new_data->allocated = 1;
  38244. new_data->interpreter_id_as_index = 1;
  38245. }
  38246. __Pyx_ModuleStateLookup_wait_until_no_readers();
  38247. if (new_data->interpreter_id_as_index) {
  38248. if (interpreter_id < __PYX_MODULE_STATE_LOOKUP_SMALL_SIZE) {
  38249. result = __Pyx_State_AddModuleInterpIdAsIndex(&new_data, module, interpreter_id);
  38250. goto end;
  38251. }
  38252. __Pyx_State_ConvertFromInterpIdAsIndex(new_data);
  38253. }
  38254. {
  38255. Py_ssize_t insert_at = 0;
  38256. {
  38257. __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
  38258. new_data->table, new_data->count, interpreter_id);
  38259. assert(lower_bound);
  38260. insert_at = lower_bound - new_data->table;
  38261. if (unlikely(insert_at < new_data->count && lower_bound->id == interpreter_id)) {
  38262. lower_bound->module = module;
  38263. goto end; // already in table, nothing more to do
  38264. }
  38265. }
  38266. if (new_data->count+1 >= new_data->allocated) {
  38267. Py_ssize_t to_allocate = (new_data->count+1)*2;
  38268. new_data =
  38269. (__Pyx_ModuleStateLookupData*)realloc(
  38270. new_data,
  38271. sizeof(__Pyx_ModuleStateLookupData) +
  38272. (to_allocate-1)*sizeof(__Pyx_InterpreterIdAndModule));
  38273. if (!new_data) {
  38274. result = -1;
  38275. new_data = old_data;
  38276. PyErr_NoMemory();
  38277. goto end;
  38278. }
  38279. new_data->allocated = to_allocate;
  38280. }
  38281. ++new_data->count;
  38282. int64_t last_id = interpreter_id;
  38283. PyObject *last_module = module;
  38284. for (Py_ssize_t i=insert_at; i<new_data->count; ++i) {
  38285. int64_t current_id = new_data->table[i].id;
  38286. new_data->table[i].id = last_id;
  38287. last_id = current_id;
  38288. PyObject *current_module = new_data->table[i].module;
  38289. new_data->table[i].module = last_module;
  38290. last_module = current_module;
  38291. }
  38292. }
  38293. end:
  38294. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  38295. __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, new_data);
  38296. #else
  38297. __Pyx_ModuleStateLookup_data = new_data;
  38298. #endif
  38299. __Pyx_ModuleStateLookup_Unlock();
  38300. return result;
  38301. }
  38302. static int __Pyx_State_RemoveModule(CYTHON_UNUSED void* dummy) {
  38303. int64_t interpreter_id = PyInterpreterState_GetID(__Pyx_PyInterpreterState_Get());
  38304. if (interpreter_id == -1) return -1;
  38305. __Pyx_ModuleStateLookup_Lock();
  38306. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  38307. __Pyx_ModuleStateLookupData *data = (__Pyx_ModuleStateLookupData *)
  38308. __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, 0);
  38309. #else
  38310. __Pyx_ModuleStateLookupData *data = __Pyx_ModuleStateLookup_data;
  38311. #endif
  38312. if (data->interpreter_id_as_index) {
  38313. if (interpreter_id < data->count) {
  38314. data->table[interpreter_id].module = NULL;
  38315. }
  38316. goto done;
  38317. }
  38318. {
  38319. __Pyx_ModuleStateLookup_wait_until_no_readers();
  38320. __Pyx_InterpreterIdAndModule* lower_bound = __Pyx_State_FindModuleStateLookupTableLowerBound(
  38321. data->table, data->count, interpreter_id);
  38322. if (!lower_bound) goto done;
  38323. if (lower_bound->id != interpreter_id) goto done;
  38324. __Pyx_InterpreterIdAndModule *end = data->table+data->count;
  38325. for (;lower_bound<end-1; ++lower_bound) {
  38326. lower_bound->id = (lower_bound+1)->id;
  38327. lower_bound->module = (lower_bound+1)->module;
  38328. }
  38329. }
  38330. --data->count;
  38331. if (data->count == 0) {
  38332. free(data);
  38333. data = NULL;
  38334. }
  38335. done:
  38336. #if CYTHON_MODULE_STATE_LOOKUP_THREAD_SAFE
  38337. __pyx_atomic_pointer_exchange(&__Pyx_ModuleStateLookup_data, data);
  38338. #else
  38339. __Pyx_ModuleStateLookup_data = data;
  38340. #endif
  38341. __Pyx_ModuleStateLookup_Unlock();
  38342. return 0;
  38343. }
  38344. #endif
  38345. /* #### Code section: utility_code_pragmas_end ### */
  38346. #ifdef _MSC_VER
  38347. #pragma warning( pop )
  38348. #endif
  38349. /* #### Code section: end ### */
  38350. #endif /* Py_PYTHON_H */