• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1static constexpr char SKSL_MINIFIED_sksl_graphite_vert[] =
2"$pure float curve_type_using_inf_support(float4 a){if(isinf(a.z)){return 2."
3";}if(isinf(a.w)){return 1.;}return 0.;}$pure bool $k(float a){return a!=0.;"
4"}$pure bool $l(float a){return a==2.;}$pure float $m(float2 a,float2 b,float2"
5" c,float2 d,float2x2 e){float2 f=e*(fma(float2(-2.),b,c)+a);float2 g=e*(fma"
6"(float2(-2.),c,d)+b);return max(dot(f,f),dot(g,g));}$pure float $n(float2 a"
7",float2 b,float2 c,float2 d,float2x2 e){float f=$m(a,b,c,d,e);return max(ceil"
8"(sqrt(3.*sqrt(f))),1.);}$pure float $o(float2 a,float2 b,float2 c,float2 d,"
9"float2x2 e){float f=$m(a,b,c,d,e);return ceil(log2(max(9.*f,1.))*.25);}$pure"
10" float $p(float2 a,float2 b,float2 c,float d){float2 e=(min(min(a,b),c)+max"
11"(max(a,b),c))*.5;a-=e;b-=e;c-=e;float f=sqrt(max(max(dot(a,a),dot(b,b)),dot"
12"(c,c)));float2 g=fma(float2(-2.*d),b,a)+c;float h=abs(fma(-2.,d,2.));float i"
13"=max(0.,fma(f,4.,-1.));float j=length(g)*4.+i*h;float k=4.*min(d,1.);return"
14" j/k;}$pure float $q(float2 a,float2 b,float2 c,float d){float e=$p(a,b,c,d"
15");return max(ceil(sqrt(e)),1.);}$pure float $r(float2 a,float2 b,float2 c,float"
16" d){float e=$p(a,b,c,d);return ceil(log2(max(e,1.))*.5);}$pure float2 $s(float2"
17" c,float2 d){float2 e=c-d;if(e==float2(0.)){return float2(0.);}else{float f"
18"=1./max(abs(e.x),abs(e.y));return normalize(f*e);}}$pure float $t(float2 c,"
19"float2 d){return clamp(dot(c,d),-1.,1.);}$pure float $u(float a,float b){float"
20" c=fma(a,.5,.5);return(c*b)*b>=1.?inversesqrt(c):sqrt(c);}$pure float $v(float"
21" a){return.5/acos(max(1.-.25/a,-1.));}$pure float $w(float c,float d,float e"
22"){return fma(d-c,e,c);}$pure float2 $w(float2 c,float2 d,float e){return fma"
23"(d-c,float2(e),c);}$pure float4 $w(float4 c,float4 d,float4 e){return fma(d"
24"-c,e,c);}$pure float2 tessellate_filled_curve(float2x2 a,float b,float c,float4"
25" d,float4 e,float f){float2 g;if($l(f)){g=b!=0.?d.zw:(c!=0.?e.xy:d.xy);}else"
26"{float2 h=d.xy;float2 i=d.zw;float2 j=e.xy;float2 k=e.zw;float l=-1.;float m"
27";if($k(f)){l=k.x;m=$r(a*h,a*i,a*j,l);i*=l;k=j;}else{m=$o(h,i,j,k,a);}if(b>m"
28"){c=floor(ldexp(c,int(m-b)));b=m;}float n=floor(.5+ldexp(c,int(5.-b)));if(0."
29"<n&&n<32.){float o=n*.03125;float2 p=mix(h,i,o);float2 q=mix(i,j,o);float2 r"
30"=mix(j,k,o);float2 s=mix(p,q,o);float2 t=mix(q,r,o);float2 x=mix(s,t,o);float"
31" y=mix(1.,l,o);float z=(l+1.)-y;float A=mix(y,z,o);g=l<0.?x:s/A;}else{g=n=="
32"0.?h:k;}}return g;}$pure float4 tessellate_stroked_curve(float a,float b,float2x2"
33" c,float2 d,float e,float4 f,float4 g,float2 h,float2 i,float j){float2 k=f"
34".xy;float2 l=f.zw;float2 m=g.xy;float2 n=g.zw;float o=-1.;if($k(j)){o=n.x;n"
35"=m;}float p;if(o<0.){if(k==l&&m==n){p=1.;}else{p=$n(k,l,m,n,c);}}else{p=$q("
36"c*k,c*l,c*m,o);}float q=i.x;float r=i.y;bool s=i.x==0.;float t;if(s){t=$v(1."
37");q=.5;}else{t=$v(e*i.x);}if(s){k=c*k;l=c*l;m=c*m;n=c*n;h=c*h;}float2 u=$s("
38"k==l?(l==m?n:m):l,k);float2 v=$s(n,n==m?(m==l?k:l):m);if(u==float2(0.)){u=float2"
39"(1.,0.);v=float2(-1.,0.);}float x;if(r>=0.){x=(sign(r)+1.)+2.;}else{float2 y"
40"=$s(k,h);float z=acos($t(y,u));float A=max(ceil(z*t),1.);x=A+2.;x=min(x,b-2."
41");}float y=cross_length_2d(m-k,n-l);float z=abs(a)-x;if(z<0.){v=u;if(h!=k){"
42"u=$s(k,h);}y=cross_length_2d(u,v);}float A=$t(u,v);float B=acos(A);if(y<0.)"
43"{B=-B;}float C;float D=sign(a);if(z<0.){C=x-2.;p=1.;n=(m=(l=k));z+=C+1.;float"
44" E=.01;bool F=abs(y)*inversesqrt(dot(u,u)*dot(v,v))<E;if(!F||dot(u,v)<0.){if"
45"(z>=0.){D=y<0.?min(D,0.):max(D,0.);}}z=max(z,0.);}else{float E=(b-x)-1.;C=max"
46"(ceil(abs(B)*t),1.);C=min(C,E);p=min(p,(E-C)+1.);}float E=B/C;float F=(p+C)"
47"-1.;bool G=z>=F;if(z>F){D=0.;}if(abs(a)==2.&&r>0.){D*=$u(A,r);}float2 H;float2"
48" I;if(z!=0.&&!G){float2 J;float2 K;float2 L=l-k;float2 M=n-k;if(o>=0.){L*=o"
49";K=.5*M-L;J=(o-1.)*M;l*=o;}else{float2 N=m-l;K=N-L;J=fma(float2(-3.),N,M);}"
50"float2 N=K*(p*2.);float2 O=L*(p*p);float P=0.;float Q=min(p-1.,z);float R=-"
51"abs(E);float S=(1.+z)*abs(E);for(int U=4;U>=0;--U){float V=P+exp2(float(U))"
52";if(V<=Q){float2 W=fma(float2(V),J,N);W=fma(float2(V),W,O);float X=dot(normalize"
53"(W),u);float Y=fma(V,R,S);Y=min(Y,3.14159274);if(X>=cos(Y)){P=V;}}}float U="
54"P/p;float V=z-P;float W=acos(clamp(u.x,-1.,1.));W=u.y>=0.?W:-W;float X=fma("
55"V,E,W);H=float2(cos(X),sin(X));float2 Y=float2(-H.y,H.x);float Z=dot(Y,J);float"
56" aa=dot(Y,K);float ac=dot(Y,L);float ad=max(aa*aa-Z*ac,0.);float ae=sqrt(ad"
57");if(aa>0.){ae=-ae;}ae-=aa;float af=(-.5*ae)*Z;float2 ag=abs(fma(ae,ae,af))"
58"<abs(fma(Z,ac,af))?float2(ae,Z):float2(ac,ae);float ah=ag.y!=0.?ag.x/ag.y:0."
59";ah=clamp(ah,0.,1.);if(V==0.){ah=0.;}float ai=max(U,ah);float2 aj=$w(k,l,ai"
60");float2 ak=$w(l,m,ai);float2 al=$w(m,n,ai);float2 am=$w(aj,ak,ai);float2 an"
61"=$w(ak,al,ai);float2 ao=$w(am,an,ai);float ap=$w(1.,o,ai);float aq=(o+1.)-ap"
62";float ar=$w(ap,aq,ai);if(ai!=ah){H=o>=0.?$s(ak*ap,aj*aq):$s(an,am);}I=o>=0."
63"?am/ar:ao;}else{H=z==0.?u:v;I=z==0.?k:n;}float2 J=float2(H.y,-H.x);I+=J*(q*"
64"D);if(s){return float4(I+d,inverse(c)*I);}else{return float4(c*I+d,I);}}";
65