xref: /aosp_15_r20/external/skia/src/sksl/generated/sksl_graphite_frag.unoptimized.sksl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1static constexpr char SKSL_MINIFIED_sksl_graphite_frag[] =
2"const int $kTileModeClamp=0;const int $kTileModeRepeat=1;const int $kTileModeDecal"
3"=3;const int $kFilterModeNearest=0;const int $kFilterModeLinear=1;const int"
4" $kColorSpaceXformFlagUnpremul=1;const int $kColorSpaceXformFlagLinearize=2"
5";const int $kColorSpaceXformFlagGamutTransform=4;const int $kColorSpaceXformFlagEncode"
6"=8;const int $kColorSpaceXformFlagPremul=16;const int $kColorSpaceXformFlagAlphaSwizzle"
7"=32;const int $kMaskFormatA8=0;const float $kLinearInset=.50001;$pure half4"
8" sk_error(){return half4(1.,0.,0.,1.);}$pure half4 sk_passthrough(half4 color"
9"){return color;}$pure half4 sk_solid_shader(float4 colorParam){return half4"
10"(colorParam);}$pure half4 sk_rgb_opaque(float4 colorParam){return half4(half3"
11"(colorParam.xyz),1.);}$pure half4 sk_alpha_only(float4 colorParam){return half4"
12"(0.,0.,0.,half(colorParam.w));}$pure float $apply_xfer_fn(int kind,float x,"
13"half4[2]cs){float G=float(cs[0].x);float A=float(cs[0].y);float B=float(cs["
14"0].z);float C=float(cs[0].w);float D=float(cs[1].x);float E=float(cs[1].y);"
15"float F=float(cs[1].z);float s=sign(x);x=abs(x);{float x_C;switch(kind){case"
16" 1:x=x<D?C*x+F:pow(A*x+B,G)+E;break;case 2:x_C=pow(x,C);x=pow(max(A+B*x_C,0."
17")/(D+E*x_C),F);break;case 3:x=x*A<=1.?pow(x*A,B):exp((x-E)*C)+D;x*=F+1.;break"
18";case 4:x/=F+1.;x=x<=1.?A*pow(x,B):C*log(x-D)+E;break;}}return s*x;}$pure half4"
19" sk_premul_alpha(float4 color){return half4(half3(color.xyz*color.w),half(color"
20".w));}$pure half4 sk_color_space_transform(half4 halfColor,int flags,int srcKind"
21",half3x3 gamutTransform,int dstKind,half4x4 coeffs){if(flags!=0){float4 color"
22"=float4(halfColor);if(bool(flags&$kColorSpaceXformFlagAlphaSwizzle))color.w"
23"=dot(float2(color.x,1.),float2(float(coeffs[1].w),float(coeffs[3].w)));if(bool"
24"(flags&$kColorSpaceXformFlagUnpremul))color=unpremul(color);if(bool(flags&$kColorSpaceXformFlagLinearize"
25")){half4 srcCoeffs[2];srcCoeffs[0]=coeffs[0];srcCoeffs[1]=coeffs[1];color.x"
26"=$apply_xfer_fn(srcKind,color.x,srcCoeffs);color.y=$apply_xfer_fn(srcKind,color"
27".y,srcCoeffs);color.z=$apply_xfer_fn(srcKind,color.z,srcCoeffs);}if(bool(flags"
28"&$kColorSpaceXformFlagGamutTransform))color.xyz=float3x3(gamutTransform)*color"
29".xyz;if(bool(flags&$kColorSpaceXformFlagEncode)){half4 dstCoeffs[2];dstCoeffs"
30"[0]=coeffs[2];dstCoeffs[1]=coeffs[3];color.x=$apply_xfer_fn(dstKind,color.x"
31",dstCoeffs);color.y=$apply_xfer_fn(dstKind,color.y,dstCoeffs);color.z=$apply_xfer_fn"
32"(dstKind,color.z,dstCoeffs);}halfColor=bool(flags&$kColorSpaceXformFlagPremul"
33")?sk_premul_alpha(color):half4(color);}return halfColor;}$pure half4 sk_circular_rrect_clip"
34"(float4 rect,float2 radiusPlusHalf,half4 edgeSelect){float2 fragCoord=sk_FragCoord"
35".xy;float2 radius=abs(radiusPlusHalf.x).xx;float2 dxy0=float2(edgeSelect.xy"
36")*((rect.xy+radius)-fragCoord);float2 dxy1=float2(edgeSelect.zw)*(fragCoord"
37"-(rect.zw-radius));float2 dxy=max(max(dxy0,dxy1),0.);half circleCornerAlpha"
38"=half(saturate(radius.x*(1.-length(dxy*radiusPlusHalf.y))));half4 rectEdgeAlphas"
39"=saturate(half4(half2(fragCoord-rect.xy),half2(rect.zw-fragCoord)));rectEdgeAlphas"
40"=mix(rectEdgeAlphas,half4(1.),edgeSelect);half alpha=(((circleCornerAlpha*rectEdgeAlphas"
41".x)*rectEdgeAlphas.y)*rectEdgeAlphas.z)*rectEdgeAlphas.w;alpha=radiusPlusHalf"
42".x<0.?1.-alpha:alpha;return alpha.xxxx;}$pure float $tile(int tileMode,float"
43" f,float low,float high){switch(tileMode){case 0:return clamp(f,low,high);case"
44" 1:{float length=high-low;return mod(f-low,length)+low;}case 2:{float length"
45"=high-low;float length2=2.*length;float tmp=mod(f-low,length2);return mix(tmp"
46",length2-tmp,step(length,tmp))+low;}default:return f;}}$pure half4 $sample_image"
47"(float2 pos,float2 invImgSize,sampler2D s){return sample(s,pos*invImgSize);"
48"}$pure half4 $sample_image_subset(float2 pos,float2 invImgSize,float4 subset"
49",int tileModeX,int tileModeY,int filterMode,float2 linearFilterInset,sampler2D"
50" s){if(tileModeX==$kTileModeDecal&&filterMode==$kFilterModeNearest){float snappedX"
51"=floor(pos.x)+.5;if(snappedX<subset.x||snappedX>subset.z)return half4(0.);}"
52"if(tileModeY==$kTileModeDecal&&filterMode==$kFilterModeNearest){float snappedY"
53"=floor(pos.y)+.5;if(snappedY<subset.y||snappedY>subset.w)return half4(0.);}"
54"pos.x=$tile(tileModeX,pos.x,subset.x,subset.z);pos.y=$tile(tileModeY,pos.y,"
55"subset.y,subset.w);float4 insetClamp;if(filterMode==$kFilterModeNearest)insetClamp"
56"=float4(floor(subset.xy)+$kLinearInset,ceil(subset.zw)-$kLinearInset);else insetClamp"
57"=float4(subset.xy+linearFilterInset.x,subset.zw-linearFilterInset.y);float2"
58" clampedPos=clamp(pos,insetClamp.xy,insetClamp.zw);half4 color=$sample_image"
59"(clampedPos,invImgSize,s);if(filterMode==$kFilterModeLinear){half2 error=half2"
60"(pos-clampedPos);half2 absError=abs(error);bool sampleExtraX=tileModeX==$kTileModeRepeat"
61";bool sampleExtraY=tileModeY==$kTileModeRepeat;if(sampleExtraX||sampleExtraY"
62"){float extraCoordX;float extraCoordY;half4 extraColorX;half4 extraColorY;if"
63"(sampleExtraX){extraCoordX=error.x>0.?insetClamp.x:insetClamp.z;extraColorX"
64"=$sample_image(float2(extraCoordX,clampedPos.y),invImgSize,s);}if(sampleExtraY"
65"){extraCoordY=error.y>0.?insetClamp.y:insetClamp.w;extraColorY=$sample_image"
66"(float2(clampedPos.x,extraCoordY),invImgSize,s);}if(sampleExtraX&&sampleExtraY"
67"){half4 extraColorXY=$sample_image(float2(extraCoordX,extraCoordY),invImgSize"
68",s);color=mix(mix(color,extraColorX,absError.x),mix(extraColorY,extraColorXY"
69",absError.x),absError.y);}else if(sampleExtraX)color=mix(color,extraColorX,"
70"absError.x);else if(sampleExtraY)color=mix(color,extraColorY,absError.y);}if"
71"(tileModeX==$kTileModeDecal)color*=max(1.-absError.x,0.);if(tileModeY==$kTileModeDecal"
72")color*=max(1.-absError.y,0.);}return color;}$pure half4 $cubic_filter_image"
73"(float2 pos,float2 invImgSize,float4 subset,int tileModeX,int tileModeY,half4x4"
74" coeffs,sampler2D s){float2 f=fract(pos-.5);pos-=1.5;pos=floor(pos)+.5;half4"
75" wx=coeffs*half4(1.,half(f.x),half(f.x*f.x),half((f.x*f.x)*f.x));half4 wy=coeffs"
76"*half4(1.,half(f.y),half(f.y*f.y),half((f.y*f.y)*f.y));half4 color=half4(0."
77");for(int y=0;y<4;++y){half4 rowColor=half4(0.);for(int x=0;x<4;++x)rowColor"
78"+=wx[x]*$sample_image_subset(pos+float2(float(x),float(y)),invImgSize,subset"
79",tileModeX,tileModeY,$kFilterModeNearest,.50001.xx,s);color+=wy[y]*rowColor"
80";}color.w=saturate(color.w);color.xyz=clamp(color.xyz,half3(0.),color.www);"
81"return color;}$pure half4 sk_image_shader(float2 coords,float2 invImgSize,float4"
82" subset,int tileModeX,int tileModeY,int filterMode,sampler2D s){return $sample_image_subset"
83"(coords,invImgSize,subset,tileModeX,tileModeY,filterMode,.50001.xx,s);}$pure"
84" half4 sk_cubic_image_shader(float2 coords,float2 invImgSize,float4 subset,"
85"int tileModeX,int tileModeY,half4x4 cubicCoeffs,sampler2D s){return $cubic_filter_image"
86"(coords,invImgSize,subset,tileModeX,tileModeY,cubicCoeffs,s);}$pure half4 sk_hw_image_shader"
87"(float2 coords,float2 invImgSize,sampler2D s){return $sample_image(coords,invImgSize"
88",s);}$pure half4 $yuv_to_rgb_no_swizzle(half Y,half U,half V,half alpha,half3x3"
89" yuvToRGBMatrix,half3 yuvToRGBTranslate){half3 preColor=half3(Y,U,V);half4 sampleColor"
90";sampleColor.xyz=saturate(yuvToRGBMatrix*preColor+yuvToRGBTranslate);sampleColor"
91".w=alpha;return sampleColor;}$pure half4 $yuv_to_rgb(half4 sampleColorY,half4"
92" sampleColorU,half4 sampleColorV,half alpha,half4 channelSelectY,half4 channelSelectU"
93",half4 channelSelectV,half3x3 yuvToRGBMatrix,half3 yuvToRGBTranslate){half Y"
94"=dot(channelSelectY,sampleColorY);half U=dot(channelSelectU,sampleColorU);half"
95" V=dot(channelSelectV,sampleColorV);return $yuv_to_rgb_no_swizzle(Y,U,V,alpha"
96",yuvToRGBMatrix,yuvToRGBTranslate);}$pure half4 sk_yuv_image_shader(float2 coords"
97",float2 invImgSizeY,float2 invImgSizeUV,float4 subset,float2 linearFilterUVInset"
98",int tileModeX,int tileModeY,int filterModeY,int filterModeUV,half4 channelSelectY"
99",half4 channelSelectU,half4 channelSelectV,half4 channelSelectA,half3x3 yuvToRGBMatrix"
100",half3 yuvToRGBTranslate,sampler2D sY,sampler2D sU,sampler2D sV,sampler2D sA"
101"){if(filterModeY!=filterModeUV)coords=floor(coords)+.5;int tileModeX_UV=tileModeX"
102"==$kTileModeDecal?$kTileModeClamp:tileModeX;int tileModeY_UV=tileModeY==$kTileModeDecal"
103"?$kTileModeClamp:tileModeY;half4 sampleColorY;half4 sampleColorU;half4 sampleColorV"
104";sampleColorY=$sample_image_subset(coords,invImgSizeY,subset,tileModeX,tileModeY"
105",filterModeY,.50001.xx,sY);sampleColorU=$sample_image_subset(coords,invImgSizeUV"
106",subset,tileModeX_UV,tileModeY_UV,filterModeUV,linearFilterUVInset,sU);sampleColorV"
107"=$sample_image_subset(coords,invImgSizeUV,subset,tileModeX_UV,tileModeY_UV,"
108"filterModeUV,linearFilterUVInset,sV);half alpha;if(channelSelectA==half4(1."
109"))alpha=1.;else{half4 sampleColorA=$sample_image_subset(coords,invImgSizeY,"
110"subset,tileModeX,tileModeY,filterModeY,.50001.xx,sA);alpha=dot(channelSelectA"
111",sampleColorA);}return $yuv_to_rgb(sampleColorY,sampleColorU,sampleColorV,alpha"
112",channelSelectY,channelSelectU,channelSelectV,yuvToRGBMatrix,yuvToRGBTranslate"
113");}$pure half4 sk_cubic_yuv_image_shader(float2 coords,float2 invImgSizeY,float2"
114" invImgSizeUV,float4 subset,int tileModeX,int tileModeY,half4x4 cubicCoeffs"
115",half4 channelSelectY,half4 channelSelectU,half4 channelSelectV,half4 channelSelectA"
116",half3x3 yuvToRGBMatrix,half3 yuvToRGBTranslate,sampler2D sY,sampler2D sU,sampler2D"
117" sV,sampler2D sA){int tileModeX_UV=tileModeX==$kTileModeDecal?$kTileModeClamp"
118":tileModeX;int tileModeY_UV=tileModeY==$kTileModeDecal?$kTileModeClamp:tileModeY"
119";half4 sampleColorY;half4 sampleColorU;half4 sampleColorV;sampleColorY=$cubic_filter_image"
120"(coords,invImgSizeY,subset,tileModeX,tileModeY,cubicCoeffs,sY);sampleColorU"
121"=$cubic_filter_image(coords,invImgSizeUV,subset,tileModeX_UV,tileModeY_UV,cubicCoeffs"
122",sU);sampleColorV=$cubic_filter_image(coords,invImgSizeUV,subset,tileModeX_UV"
123",tileModeY_UV,cubicCoeffs,sV);half alpha;if(channelSelectA==half4(1.))alpha"
124"=1.;else{half4 sampleColorA=$cubic_filter_image(coords,invImgSizeY,subset,tileModeX"
125",tileModeY,cubicCoeffs,sA);alpha=dot(channelSelectA,sampleColorA);}return $yuv_to_rgb"
126"(sampleColorY,sampleColorU,sampleColorV,alpha,channelSelectY,channelSelectU"
127",channelSelectV,yuvToRGBMatrix,yuvToRGBTranslate);}$pure half4 sk_hw_yuv_image_shader"
128"(float2 coords,float2 invImgSizeY,float2 invImgSizeUV,half4 channelSelectY,"
129"half4 channelSelectU,half4 channelSelectV,half4 channelSelectA,half3x3 yuvToRGBMatrix"
130",half3 yuvToRGBTranslate,sampler2D sY,sampler2D sU,sampler2D sV,sampler2D sA"
131"){half4 sampleColorY;half4 sampleColorU;half4 sampleColorV;sampleColorY=$sample_image"
132"(coords,invImgSizeY,sY);sampleColorU=$sample_image(coords,invImgSizeUV,sU);"
133"sampleColorV=$sample_image(coords,invImgSizeUV,sV);half alpha;if(channelSelectA"
134"==half4(1.))alpha=1.;else{half4 sampleColorA=$sample_image(coords,invImgSizeY"
135",sA);alpha=dot(channelSelectA,sampleColorA);}return $yuv_to_rgb(sampleColorY"
136",sampleColorU,sampleColorV,alpha,channelSelectY,channelSelectU,channelSelectV"
137",yuvToRGBMatrix,yuvToRGBTranslate);}$pure half4 sk_hw_yuv_no_swizzle_image_shader"
138"(float2 coords,float2 invImgSizeY,float2 invImgSizeUV,half3x3 yuvToRGBMatrix"
139",half4 yuvToRGBXlateAlphaParam,sampler2D sY,sampler2D sU,sampler2D sV,sampler2D"
140" sA){half Y=$sample_image(coords,invImgSizeY,sY).x;half U=$sample_image(coords"
141",invImgSizeUV,sU).x;half V=$sample_image(coords,invImgSizeUV,sV).x;half alpha"
142"=saturate($sample_image(coords,invImgSizeY,sA).x+yuvToRGBXlateAlphaParam.w)"
143";return $yuv_to_rgb_no_swizzle(Y,U,V,alpha,yuvToRGBMatrix,yuvToRGBXlateAlphaParam"
144".xyz);}$pure half4 sk_dither(half4 colorIn,half range,sampler2D lut){half value"
145"=sample(lut,sk_FragCoord.xy*.125).x-.5;return half4(clamp(colorIn.xyz+value"
146"*range,0.,colorIn.w),colorIn.w);}$pure float2 $tile_grad(int tileMode,float2"
147" t){switch(tileMode){case 0:t.x=saturate(t.x);break;case 1:t.x=fract(t.x);break"
148";case 2:{float t_1=t.x-1.;t.x=(t_1-2.*floor(t_1*.5))-1.;if(sk_Caps.mustDoOpBetweenFloorAndAbs"
149")t.x=clamp(t.x,-1.,1.);t.x=abs(t.x);break;}case 3:if(t.x<0.||t.x>1.)return float2"
150"(0.,-1.);break;}return t;}$pure half4 $colorize_grad_4(float4[4]colorsParam"
151",float4 offsetsParam,float2 t){if(t.y<0.)return half4(0.);else if(t.x<=offsetsParam"
152".x)return half4(colorsParam[0]);else if(t.x<offsetsParam.y)return half4(mix"
153"(colorsParam[0],colorsParam[1],(t.x-offsetsParam.x)/(offsetsParam.y-offsetsParam"
154".x)));else if(t.x<offsetsParam.z)return half4(mix(colorsParam[1],colorsParam"
155"[2],(t.x-offsetsParam.y)/(offsetsParam.z-offsetsParam.y)));else if(t.x<offsetsParam"
156".w)return half4(mix(colorsParam[2],colorsParam[3],(t.x-offsetsParam.z)/(offsetsParam"
157".w-offsetsParam.z)));else return half4(colorsParam[3]);}$pure half4 $colorize_grad_8"
158"(float4[8]colorsParam,float4[2]offsetsParam,float2 t){if(t.y<0.)return half4"
159"(0.);else if(t.x<offsetsParam[1].x)if(t.x<offsetsParam[0].z)if(t.x<=offsetsParam"
160"[0].x)return half4(colorsParam[0]);else if(t.x<offsetsParam[0].y)return half4"
161"(mix(colorsParam[0],colorsParam[1],(t.x-offsetsParam[0].x)/(offsetsParam[0]"
162".y-offsetsParam[0].x)));else return half4(mix(colorsParam[1],colorsParam[2]"
163",(t.x-offsetsParam[0].y)/(offsetsParam[0].z-offsetsParam[0].y)));else if(t."
164"x<offsetsParam[0].w)return half4(mix(colorsParam[2],colorsParam[3],(t.x-offsetsParam"
165"[0].z)/(offsetsParam[0].w-offsetsParam[0].z)));else return half4(mix(colorsParam"
166"[3],colorsParam[4],(t.x-offsetsParam[0].w)/(offsetsParam[1].x-offsetsParam["
167"0].w)));else if(t.x<offsetsParam[1].z)if(t.x<offsetsParam[1].y)return half4"
168"(mix(colorsParam[4],colorsParam[5],(t.x-offsetsParam[1].x)/(offsetsParam[1]"
169".y-offsetsParam[1].x)));else return half4(mix(colorsParam[5],colorsParam[6]"
170",(t.x-offsetsParam[1].y)/(offsetsParam[1].z-offsetsParam[1].y)));else if(t."
171"x<offsetsParam[1].w)return half4(mix(colorsParam[6],colorsParam[7],(t.x-offsetsParam"
172"[1].z)/(offsetsParam[1].w-offsetsParam[1].z)));else return half4(colorsParam"
173"[7]);}$pure half4 $colorize_grad_tex(sampler2D colorsAndOffsetsSampler,int numStops"
174",float2 t){if(t.y<0.)return half4(0.);else if(t.x==0.)return sampleLod(colorsAndOffsetsSampler"
175",float2(0.,.25),0.);else if(t.x==1.)return sampleLod(colorsAndOffsetsSampler"
176",float2(1.,.25),0.);else{float low=0.;float high=float(numStops);float invNumStops"
177"=1./high;for(int loop=1;loop<numStops;loop+=loop){float mid=floor((low+high"
178")*.5);float samplePos=(mid+.5)*invNumStops;float2 tmp=float2(sampleLod(colorsAndOffsetsSampler"
179",float2(samplePos,.75),0.).xy);float offset=ldexp(tmp.x,int(tmp.y));if(t.x<"
180"offset)high=mid;else low=mid;}high=(low+1.5)*invNumStops;low=(low+.5)*invNumStops"
181";half4 color0=sampleLod(colorsAndOffsetsSampler,float2(low,.25),0.);half4 color1"
182"=sampleLod(colorsAndOffsetsSampler,float2(high,.25),0.);float2 tmp=float2(sampleLod"
183"(colorsAndOffsetsSampler,float2(low,.75),0.).xy);float offset0=ldexp(tmp.x,"
184"int(tmp.y));tmp=float2(sampleLod(colorsAndOffsetsSampler,float2(high,.75),0."
185").xy);float offset1=ldexp(tmp.x,int(tmp.y));return half4(mix(float4(color0)"
186",float4(color1),(t.x-offset0)/(offset1-offset0)));}}$pure half4 $half4_from_array"
187"(float[]arr,int offset){return half4(half(arr[offset]),half(arr[offset+1]),"
188"half(arr[offset+2]),half(arr[offset+3]));}$pure half4 $colorize_grad_buf(float"
189"[]colorAndOffsetData,int offsetsBaseIndex,int numStops,float2 t){int colorsBaseIndex"
190"=offsetsBaseIndex+numStops;if(t.y<0.)return half4(0.);else if(t.x==0.)return"
191" $half4_from_array(colorAndOffsetData,colorsBaseIndex);else if(t.x==1.){int"
192" lastColorIndex=colorsBaseIndex+(numStops-1)*4;return $half4_from_array(colorAndOffsetData"
193",lastColorIndex);}else{int lowOffsetIndex=offsetsBaseIndex;int highOffsetIndex"
194"=(lowOffsetIndex+numStops)-1;for(int i=1;i<numStops;i+=i){int middleOffsetIndex"
195"=(lowOffsetIndex+highOffsetIndex)/2;if(t.x<colorAndOffsetData[middleOffsetIndex"
196"])highOffsetIndex=middleOffsetIndex;else lowOffsetIndex=middleOffsetIndex;}"
197"int lowColorIndex=colorsBaseIndex+(lowOffsetIndex-offsetsBaseIndex)*4;float"
198" lowOffset=colorAndOffsetData[lowOffsetIndex];half4 lowColor=$half4_from_array"
199"(colorAndOffsetData,lowColorIndex);int highColorIndex=colorsBaseIndex+(highOffsetIndex"
200"-offsetsBaseIndex)*4;float highOffset=colorAndOffsetData[highOffsetIndex];if"
201"(highOffset==lowOffset)return lowColor;else{half4 highColor=$half4_from_array"
202"(colorAndOffsetData,highColorIndex);return half4(mix(float4(lowColor),float4"
203"(highColor),(t.x-lowOffset)/(highOffset-lowOffset)));}}}$pure float2 $linear_grad_layout"
204"(float2 pos){return float2(pos.x+1e-05,1.);}$pure float2 $radial_grad_layout"
205"(float2 pos){float t=length(pos);return float2(t,1.);}$pure float2 $sweep_grad_layout"
206"(float biasParam,float scaleParam,float2 pos){float angle;if(sk_Caps.atan2ImplementedAsAtanYOverX"
207")angle=2.*atan(-pos.y,length(pos)-pos.x);else angle=pos.x!=0.?atan(-pos.y,-"
208"pos.x):sign(pos.y)*-1.57079637;float t=((angle*.159154937+.5)+biasParam)*scaleParam"
209";return float2(t,1.);}$pure float2 $conical_grad_layout(float radius0,float"
210" dRadius,float a,float invA,float2 pos){if(a==0.&&invA==1.){float t=length("
211"pos)*dRadius-radius0;return float2(t,1.);}else{float c=dot(pos,pos)-radius0"
212"*radius0;float negB=2.*(dRadius*radius0+pos.x);float t;if(a==0.)t=c/negB;else"
213"{float d=negB*negB-(4.*a)*c;if(d<0.)return float2(0.,-1.);float quadSign=sign"
214"(1.-dRadius);t=invA*(negB+quadSign*sqrt(d));}float isValid=sign(t*dRadius+radius0"
215");return float2(t,isValid);}}$pure half4 sk_linear_grad_4_shader(float2 coords"
216",float4[4]colorsParam,float4 offsetsParam,int tileMode,int colorSpace,int doUnpremul"
217"){float2 t=$linear_grad_layout(coords);t=$tile_grad(tileMode,t);half4 color"
218"=$colorize_grad_4(colorsParam,offsetsParam,t);return $interpolated_to_rgb_unpremul"
219"(color,colorSpace,doUnpremul);}$pure half4 sk_linear_grad_8_shader(float2 coords"
220",float4[8]colorsParam,float4[2]offsetsParam,int tileMode,int colorSpace,int"
221" doUnpremul){float2 t=$linear_grad_layout(coords);t=$tile_grad(tileMode,t);"
222"half4 color=$colorize_grad_8(colorsParam,offsetsParam,t);return $interpolated_to_rgb_unpremul"
223"(color,colorSpace,doUnpremul);}$pure half4 sk_linear_grad_tex_shader(float2"
224" coords,int numStops,int tileMode,int colorSpace,int doUnpremul,sampler2D colorAndOffsetSampler"
225"){float2 t=$linear_grad_layout(coords);t=$tile_grad(tileMode,t);half4 color"
226"=$colorize_grad_tex(colorAndOffsetSampler,numStops,t);return $interpolated_to_rgb_unpremul"
227"(color,colorSpace,doUnpremul);}$pure half4 sk_linear_grad_buf_shader(float2"
228" coords,int numStops,int bufferOffset,int tileMode,int colorSpace,int doUnpremul"
229",float[]colorAndOffsetData){float2 t=$linear_grad_layout(coords);t=$tile_grad"
230"(tileMode,t);half4 color=$colorize_grad_buf(colorAndOffsetData,bufferOffset"
231",numStops,t);return $interpolated_to_rgb_unpremul(color,colorSpace,doUnpremul"
232");}$pure half4 sk_radial_grad_4_shader(float2 coords,float4[4]colorsParam,float4"
233" offsetsParam,int tileMode,int colorSpace,int doUnpremul){float2 t=$radial_grad_layout"
234"(coords);t=$tile_grad(tileMode,t);half4 color=$colorize_grad_4(colorsParam,"
235"offsetsParam,t);return $interpolated_to_rgb_unpremul(color,colorSpace,doUnpremul"
236");}$pure half4 sk_radial_grad_8_shader(float2 coords,float4[8]colorsParam,float4"
237"[2]offsetsParam,int tileMode,int colorSpace,int doUnpremul){float2 t=$radial_grad_layout"
238"(coords);t=$tile_grad(tileMode,t);half4 color=$colorize_grad_8(colorsParam,"
239"offsetsParam,t);return $interpolated_to_rgb_unpremul(color,colorSpace,doUnpremul"
240");}$pure half4 sk_radial_grad_tex_shader(float2 coords,int numStops,int tileMode"
241",int colorSpace,int doUnpremul,sampler2D colorAndOffsetSampler){float2 t=$radial_grad_layout"
242"(coords);t=$tile_grad(tileMode,t);half4 color=$colorize_grad_tex(colorAndOffsetSampler"
243",numStops,t);return $interpolated_to_rgb_unpremul(color,colorSpace,doUnpremul"
244");}$pure half4 sk_radial_grad_buf_shader(float2 coords,int numStops,int bufferOffset"
245",int tileMode,int colorSpace,int doUnpremul,float[]colorAndOffsetData){float2"
246" t=$radial_grad_layout(coords);t=$tile_grad(tileMode,t);half4 color=$colorize_grad_buf"
247"(colorAndOffsetData,bufferOffset,numStops,t);return $interpolated_to_rgb_unpremul"
248"(color,colorSpace,doUnpremul);}$pure half4 sk_sweep_grad_4_shader(float2 coords"
249",float4[4]colorsParam,float4 offsetsParam,float biasParam,float scaleParam,"
250"int tileMode,int colorSpace,int doUnpremul){float2 t=$sweep_grad_layout(biasParam"
251",scaleParam,coords);t=$tile_grad(tileMode,t);half4 color=$colorize_grad_4(colorsParam"
252",offsetsParam,t);return $interpolated_to_rgb_unpremul(color,colorSpace,doUnpremul"
253");}$pure half4 sk_sweep_grad_8_shader(float2 coords,float4[8]colorsParam,float4"
254"[2]offsetsParam,float biasParam,float scaleParam,int tileMode,int colorSpace"
255",int doUnpremul){float2 t=$sweep_grad_layout(biasParam,scaleParam,coords);t"
256"=$tile_grad(tileMode,t);half4 color=$colorize_grad_8(colorsParam,offsetsParam"
257",t);return $interpolated_to_rgb_unpremul(color,colorSpace,doUnpremul);}$pure"
258" half4 sk_sweep_grad_tex_shader(float2 coords,float biasParam,float scaleParam"
259",int numStops,int tileMode,int colorSpace,int doUnpremul,sampler2D colorAndOffsetSampler"
260"){float2 t=$sweep_grad_layout(biasParam,scaleParam,coords);t=$tile_grad(tileMode"
261",t);half4 color=$colorize_grad_tex(colorAndOffsetSampler,numStops,t);return"
262" $interpolated_to_rgb_unpremul(color,colorSpace,doUnpremul);}$pure half4 sk_sweep_grad_buf_shader"
263"(float2 coords,float biasParam,float scaleParam,int numStops,int bufferOffset"
264",int tileMode,int colorSpace,int doUnpremul,float[]colorAndOffsetData){float2"
265" t=$sweep_grad_layout(biasParam,scaleParam,coords);t=$tile_grad(tileMode,t)"
266";half4 color=$colorize_grad_buf(colorAndOffsetData,bufferOffset,numStops,t)"
267";return $interpolated_to_rgb_unpremul(color,colorSpace,doUnpremul);}$pure half4"
268" sk_conical_grad_4_shader(float2 coords,float4[4]colorsParam,float4 offsetsParam"
269",float radius0Param,float dRadiusParam,float aParam,float invAParam,int tileMode"
270",int colorSpace,int doUnpremul){float2 t=$conical_grad_layout(radius0Param,"
271"dRadiusParam,aParam,invAParam,coords);t=$tile_grad(tileMode,t);half4 color="
272"$colorize_grad_4(colorsParam,offsetsParam,t);return $interpolated_to_rgb_unpremul"
273"(color,colorSpace,doUnpremul);}$pure half4 sk_conical_grad_8_shader(float2 coords"
274",float4[8]colorsParam,float4[2]offsetsParam,float radius0Param,float dRadiusParam"
275",float aParam,float invAParam,int tileMode,int colorSpace,int doUnpremul){float2"
276" t=$conical_grad_layout(radius0Param,dRadiusParam,aParam,invAParam,coords);"
277"t=$tile_grad(tileMode,t);half4 color=$colorize_grad_8(colorsParam,offsetsParam"
278",t);return $interpolated_to_rgb_unpremul(color,colorSpace,doUnpremul);}$pure"
279" half4 sk_conical_grad_tex_shader(float2 coords,float radius0Param,float dRadiusParam"
280",float aParam,float invAParam,int numStops,int tileMode,int colorSpace,int doUnpremul"
281",sampler2D colorAndOffsetSampler){float2 t=$conical_grad_layout(radius0Param"
282",dRadiusParam,aParam,invAParam,coords);t=$tile_grad(tileMode,t);half4 color"
283"=$colorize_grad_tex(colorAndOffsetSampler,numStops,t);return $interpolated_to_rgb_unpremul"
284"(color,colorSpace,doUnpremul);}$pure half4 sk_conical_grad_buf_shader(float2"
285" coords,float radius0Param,float dRadiusParam,float aParam,float invAParam,"
286"int numStops,int bufferOffset,int tileMode,int colorSpace,int doUnpremul,float"
287"[]colorAndOffsetData){float2 t=$conical_grad_layout(radius0Param,dRadiusParam"
288",aParam,invAParam,coords);t=$tile_grad(tileMode,t);half4 color=$colorize_grad_buf"
289"(colorAndOffsetData,bufferOffset,numStops,t);return $interpolated_to_rgb_unpremul"
290"(color,colorSpace,doUnpremul);}$pure half4 sk_matrix_colorfilter(half4 colorIn"
291",float4x4 m,float4 v,int inHSLA,int clampRGB){if(bool(inHSLA))colorIn=$rgb_to_hsl"
292"(colorIn.xyz,colorIn.w);else colorIn=unpremul(colorIn);half4 colorOut=half4"
293"(m*float4(colorIn)+v);if(bool(inHSLA))colorOut=$hsl_to_rgb(colorOut.xyz,colorOut"
294".w);else{if(bool(clampRGB))colorOut=saturate(colorOut);else colorOut.w=saturate"
295"(colorOut.w);colorOut.xyz*=colorOut.w;}return colorOut;}$pure half4 $noise_helper"
296"(half2 noiseVec,half2 stitchData,int stitching,sampler2D permutationSampler"
297"){const half kBlockSize=256.;half4 floorVal;floorVal.xy=floor(noiseVec);floorVal"
298".zw=floorVal.xy+half2(1.);if(bool(stitching))floorVal-=step(stitchData.xyxy"
299",floorVal)*stitchData.xyxy;half sampleX=sample(permutationSampler,float2(half2"
300"((floorVal.x+.5)*.00390625,.5))).x;half sampleY=sample(permutationSampler,float2"
301"(half2((floorVal.z+.5)*.00390625,.5))).x;half2 latticeIdx=half2(sampleX,sampleY"
302");if(sk_Caps.PerlinNoiseRoundingFix)latticeIdx=floor(latticeIdx*half2(255.)"
303"+half2(.5))*half2(.003921569);half4 noiseXCoords=kBlockSize*latticeIdx.xyxy"
304"+floorVal.yyww;noiseXCoords*=half4(.00390625);return noiseXCoords;}$pure half4"
305" $noise_function(half2 noiseVec,half4 noiseXCoords,sampler2D noiseSampler){"
306"half2 fractVal=fract(noiseVec);half2 noiseSmooth=smoothstep(0.,1.,fractVal)"
307";const half kInv256=.00390625;half4 result;for(int channel=0;channel<4;channel"
308"++){half chanCoord=(half(channel)+.5)*.25;half4 sampleA=sample(noiseSampler"
309",float2(float(noiseXCoords.x),float(chanCoord)));half4 sampleB=sample(noiseSampler"
310",float2(float(noiseXCoords.y),float(chanCoord)));half4 sampleC=sample(noiseSampler"
311",float2(float(noiseXCoords.w),float(chanCoord)));half4 sampleD=sample(noiseSampler"
312",float2(float(noiseXCoords.z),float(chanCoord)));half2 tmpFractVal=fractVal"
313";half u=dot((sampleA.yw+sampleA.xz*kInv256)*2.-1.,tmpFractVal);tmpFractVal."
314"x-=1.;half v=dot((sampleB.yw+sampleB.xz*kInv256)*2.-1.,tmpFractVal);half a="
315"mix(u,v,noiseSmooth.x);tmpFractVal.y-=1.;v=dot((sampleC.yw+sampleC.xz*kInv256"
316")*2.-1.,tmpFractVal);tmpFractVal.x+=1.;u=dot((sampleD.yw+sampleD.xz*kInv256"
317")*2.-1.,tmpFractVal);half b=mix(u,v,noiseSmooth.x);result[channel]=mix(a,b,"
318"noiseSmooth.y);}return result;}$pure half4 sk_perlin_noise_shader(float2 coords"
319",float2 baseFrequency,float2 stitchDataIn,int noiseType,int numOctaves,int stitching"
320",sampler2D permutationSampler,sampler2D noiseSampler){const int kFractalNoise"
321"=0;half2 noiseVec=half2((coords+.5)*baseFrequency);half4 color=half4(0.);half2"
322" stitchData=half2(stitchDataIn);half ratio=1.;for(int octave=0;octave<numOctaves"
323";++octave){half4 noiseXCoords=$noise_helper(noiseVec,stitchData,stitching,permutationSampler"
324");half4 tmp=$noise_function(noiseVec,noiseXCoords,noiseSampler);if(noiseType"
325"!=kFractalNoise)tmp=abs(tmp);color+=tmp*ratio;noiseVec*=half2(2.);ratio*=.5"
326";stitchData*=half2(2.);}if(noiseType==kFractalNoise)color=color*half4(.5)+half4"
327"(.5);color=saturate(color);return sk_premul_alpha(float4(color));}$pure half4"
328" sk_porter_duff_blend(half4 src,half4 dst,half4 coeffs){return blend_porter_duff"
329"(coeffs,src,dst);}$pure half4 sk_hslc_blend(half4 src,half4 dst,half2 flipSat"
330"){return blend_hslc(flipSat,src,dst);}$pure half4 sk_table_colorfilter(half4"
331" inColor,sampler2D s){half4 coords=unpremul(inColor)*.99609375+.001953125;half4"
332" color=half4(sample(s,float2(half2(coords.x,.375))).x,sample(s,float2(half2"
333"(coords.y,.625))).x,sample(s,float2(half2(coords.z,.875))).x,1.);return color"
334"*sample(s,float2(half2(coords.w,.125))).x;}$pure half4 sk_gaussian_colorfilter"
335"(half4 inColor){half factor=1.-inColor.w;factor=exp((-factor*factor)*4.)-.018"
336";return factor.xxxx;}$pure half4 sample_indexed_atlas(float2 textureCoords,"
337"int atlasIndex,sampler2D atlas0,sampler2D atlas1,sampler2D atlas2,sampler2D"
338" atlas3){switch(atlasIndex){case 1:return sample(atlas1,textureCoords);case"
339" 2:return sample(atlas2,textureCoords);case 3:return sample(atlas3,textureCoords"
340");default:return sample(atlas0,textureCoords);}}$pure half3 $sample_indexed_atlas_lcd"
341"(float2 textureCoords,int atlasIndex,half2 offset,sampler2D atlas0,sampler2D"
342" atlas1,sampler2D atlas2,sampler2D atlas3){half3 distance=half3(1.);switch("
343"atlasIndex){case 1:distance.x=sample(atlas1,float2(half2(textureCoords)-offset"
344")).x;distance.y=sample(atlas1,textureCoords).x;distance.z=sample(atlas1,float2"
345"(half2(textureCoords)+offset)).x;case 2:distance.x=sample(atlas2,float2(half2"
346"(textureCoords)-offset)).x;distance.y=sample(atlas2,textureCoords).x;distance"
347".z=sample(atlas2,float2(half2(textureCoords)+offset)).x;case 3:distance.x=sample"
348"(atlas3,float2(half2(textureCoords)-offset)).x;distance.y=sample(atlas3,textureCoords"
349").x;distance.z=sample(atlas3,float2(half2(textureCoords)+offset)).x;default"
350":distance.x=sample(atlas0,float2(half2(textureCoords)-offset)).x;distance.y"
351"=sample(atlas0,textureCoords).x;distance.z=sample(atlas0,float2(half2(textureCoords"
352")+offset)).x;}return distance;}$pure half4 bitmap_text_coverage_fn(half4 texColor"
353",int maskFormat){return maskFormat==$kMaskFormatA8?texColor.xxxx:texColor;}"
354"$pure half4 sdf_text_coverage_fn(half texColor,half2 gammaParams,float2 unormTexCoords"
355"){half dist=7.96875*(texColor-.5019608);dist-=gammaParams.x;half2 dist_grad"
356"=half2(dFdx(dist),dFdy(dist));half dg_len2=dot(dist_grad,dist_grad);dist_grad"
357"=dg_len2>=.0001?dist_grad*inversesqrt(dg_len2):half2(.7071);float2x2 jacobian"
358"=float2x2(dFdx(unormTexCoords),dFdy(unormTexCoords));half2 grad=half2(jacobian"
359"*float2(dist_grad));half approxFragWidth=.65*length(grad);if(gammaParams.y>"
360"0.)return saturate((dist+approxFragWidth)/(2.*approxFragWidth)).xxxx;else return"
361" smoothstep(-approxFragWidth,approxFragWidth,dist).xxxx;}$pure half4 sdf_text_lcd_coverage_fn"
362"(float2 textureCoords,half2 pixelGeometryDelta,half4 gammaParams,float2 unormTexCoords"
363",float texIndex,sampler2D atlas0,sampler2D atlas1,sampler2D atlas2,sampler2D"
364" atlas3){float2x2 jacobian=float2x2(dFdx(unormTexCoords),dFdy(unormTexCoords"
365"));half2 offset=half2(jacobian*float2(pixelGeometryDelta));half3 distance=$sample_indexed_atlas_lcd"
366"(textureCoords,int(texIndex),offset,atlas0,atlas1,atlas2,atlas3);half3 dist"
367"=half3(7.96875)*(distance-half3(.5019608));dist-=gammaParams.xyz;half2 dist_grad"
368"=half2(dFdx(dist.y),dFdy(dist.y));half dg_len2=dot(dist_grad,dist_grad);dist_grad"
369"=dg_len2>=.0001?dist_grad*inversesqrt(dg_len2):half2(.7071);half2 grad=half2"
370"(jacobian*float2(dist_grad));half3 approxFragWidth=(.65*length(grad)).xxx;if"
371"(gammaParams.w>0.)return half4(saturate(dist+approxFragWidth/(2.*approxFragWidth"
372")),1.);else return half4(smoothstep(-approxFragWidth,approxFragWidth,dist),"
373"1.);}$pure float $inverse_grad_len(float2 localGrad,float2x2 jacobian){float2"
374" devGrad=localGrad*jacobian;return inversesqrt(dot(devGrad,devGrad));}$pure"
375" float2 $elliptical_distance(float2 uv,float2 radii,float strokeRadius,float2x2"
376" jacobian){float2 invR2=1./(radii*radii+strokeRadius*strokeRadius);float2 normUV"
377"=invR2*uv;float invGradLength=$inverse_grad_len(normUV,jacobian);float f=(.5"
378"*invGradLength)*(dot(uv,normUV)-1.);float width=((radii.x*strokeRadius)*invR2"
379".x)*invGradLength;return float2(width-f,width+f);}void $corner_distance(inout"
380" float2 dist,float2x2 jacobian,float2 strokeParams,float2 cornerEdgeDist,float2"
381" xyFlip,float2 radii){float2 uv=radii-cornerEdgeDist;if(all(greaterThan(uv,"
382"0..xx)))if(all(greaterThan(radii,0..xx))||strokeParams.x>0.&&strokeParams.y"
383"<0.){float2 d=$elliptical_distance(uv*xyFlip,radii,strokeParams.x,jacobian)"
384";d.y=radii.x-strokeParams.x<=0.?1.:-d.y;dist=min(dist,d);}else if(strokeParams"
385".y==0.){float bevelDist=((strokeParams.x-uv.x)-uv.y)*$inverse_grad_len(xyFlip"
386",jacobian);dist.x=min(dist.x,bevelDist);}}void $corner_distances(inout float2"
387" d,float2x2 J,float2 stroke,float4 edgeDists,float4 xRadii,float4 yRadii){$corner_distance"
388"(d,J,stroke,edgeDists.xy,-1..xx,float2(xRadii.x,yRadii.x));$corner_distance"
389"(d,J,stroke,edgeDists.zy,float2(1.,-1.),float2(xRadii.y,yRadii.y));$corner_distance"
390"(d,J,stroke,edgeDists.zw,1..xx,float2(xRadii.z,yRadii.z));$corner_distance("
391"d,J,stroke,edgeDists.xw,float2(-1.,1.),float2(xRadii.w,yRadii.w));}$pure half4"
392" analytic_rrect_coverage_fn(float4 coords,float4 jacobian,float4 edgeDistances"
393",float4 xRadii,float4 yRadii,float2 strokeParams,float2 perPixelControl){if"
394"(perPixelControl.x>0.)return half4(1.);else if(perPixelControl.y>1.){float2"
395" outerDist=min(edgeDistances.xy,edgeDistances.zw);float c=min(outerDist.x,outerDist"
396".y)*coords.w;float scale=(perPixelControl.y-1.)*coords.w;float bias=coverage_bias"
397"(scale);return half(saturate(scale*(c+bias))).xxxx;}else{float2x2 J=float2x2"
398"(jacobian)*(1./coords.w);float2 invGradLen=float2($inverse_grad_len(float2("
399"1.,0.),J),$inverse_grad_len(float2(0.,1.),J));float2 outerDist=invGradLen*("
400"strokeParams.x+min(edgeDistances.xy,edgeDistances.zw));float2 d=float2(min("
401"outerDist.x,outerDist.y),-1.);float scale;float bias;if(perPixelControl.x>-"
402".95){float2 dim=invGradLen*((edgeDistances.xy+edgeDistances.zw)+2.*strokeParams"
403".xx);scale=min(min(dim.x,dim.y),1.);bias=coverage_bias(scale);}else{float2 strokeWidth"
404"=(2.*strokeParams.x)*invGradLen;float2 innerDist=strokeWidth-outerDist;d.y="
405"-max(innerDist.x,innerDist.y);if(strokeParams.x>0.){float narrowStroke=min("
406"strokeWidth.x,strokeWidth.y);float2 strokeDim=mix(narrowStroke.xx,strokeWidth"
407",greaterThanEqual(innerDist,-.5.xx));scale=saturate(max(strokeDim.x,strokeDim"
408".y));bias=coverage_bias(scale);}else scale=(bias=1.);}$corner_distances(d,J"
409",strokeParams,edgeDistances,xRadii,yRadii);float outsetDist=min(perPixelControl"
410".y,0.)*coords.w;float finalCoverage=scale*(min(d.x+outsetDist,-d.y)+bias);return"
411" half(saturate(finalCoverage)).xxxx;}}$pure half4 per_edge_aa_quad_coverage_fn"
412"(float4 coords,float4 edgeDistances){float2 outerDist=min(edgeDistances.xy,"
413"edgeDistances.zw);float c=min(outerDist.x,outerDist.y)*coords.w;return half"
414"(saturate(c)).xxxx;}$pure half4 circular_arc_coverage_fn(float4 circleEdge,"
415"float3 clipPlane,float3 isectPlane,float3 unionPlane,float roundCapRadius,float4"
416" roundCapPos){float d=length(circleEdge.xy);half distanceToOuterEdge=half(circleEdge"
417".z*(1.-d));half edgeAlpha=saturate(distanceToOuterEdge);half distanceToInnerEdge"
418"=half(circleEdge.z*(d-circleEdge.w));half innerAlpha=saturate(distanceToInnerEdge"
419");edgeAlpha*=innerAlpha;half clip=half(saturate(circleEdge.z*dot(circleEdge"
420".xy,clipPlane.xy)+clipPlane.z));clip*=half(saturate(circleEdge.z*dot(circleEdge"
421".xy,isectPlane.xy)+isectPlane.z));clip=clip+half(saturate(circleEdge.z*dot("
422"circleEdge.xy,unionPlane.xy)+unionPlane.z));half dcap1=half(circleEdge.z*(roundCapRadius"
423"-length(circleEdge.xy-roundCapPos.xy)));half dcap2=half(circleEdge.z*(roundCapRadius"
424"-length(circleEdge.xy-roundCapPos.zw)));half capAlpha=max(dcap1,0.)+max(dcap2"
425",0.);clip=saturate(clip+capAlpha);return(clip*edgeAlpha).xxxx;}$pure half4 $rect_blur_coverage_fn"
426"(float2 coords,float4 rect,half isFast,half invSixSigma,sampler2D integral)"
427"{half xCoverage;half yCoverage;if(isFast!=0.){half2 pos=max(half2(rect.xy-coords"
428"),half2(coords-rect.zw));xCoverage=sample(integral,float2(float(invSixSigma"
429"*pos.x),.5)).x;yCoverage=sample(integral,float2(float(invSixSigma*pos.y),.5"
430")).x;}else{half4 rect=half4(half2(rect.xy-coords),half2(coords-rect.zw));xCoverage"
431"=(1.-sample(integral,float2(float(invSixSigma*rect.x),.5)).x)-sample(integral"
432",float2(float(invSixSigma*rect.z),.5)).x;yCoverage=(1.-sample(integral,float2"
433"(float(invSixSigma*rect.y),.5)).x)-sample(integral,float2(float(invSixSigma"
434"*rect.w),.5)).x;}return(xCoverage*yCoverage).xxxx;}$pure half4 $circle_blur_coverage_fn"
435"(float2 coords,float4 circle,sampler2D blurProfile){float invTextureRadius="
436"circle.z;float normSolidRadius=circle.w;half2 vec=half2((coords-circle.xy)*"
437"invTextureRadius);float dist=float(length(vec))-normSolidRadius;return sample"
438"(blurProfile,float2(dist,.5)).xxxx;}$pure half4 $rrect_blur_coverage_fn(float2"
439" coords,float4 proxyRect,half edgeSize,sampler2D ninePatch){float2 translatedFragPosFloat"
440"=coords-proxyRect.xy;float2 proxyCenter=(proxyRect.zw-proxyRect.xy)*.5;translatedFragPosFloat"
441"-=proxyCenter;half2 fragDirection=half2(sign(translatedFragPosFloat));translatedFragPosFloat"
442"=abs(translatedFragPosFloat);half2 translatedFragPosHalf=half2(translatedFragPosFloat"
443"-(proxyCenter-float(edgeSize)));translatedFragPosHalf=max(translatedFragPosHalf"
444",0.);translatedFragPosHalf*=fragDirection;translatedFragPosHalf+=edgeSize.xx"
445";half2 proxyDims=(2.*edgeSize).xx;half2 texCoord=translatedFragPosHalf/proxyDims"
446";return sample(ninePatch,float2(texCoord)).xxxx;}$pure half4 blur_coverage_fn"
447"(float2 coords,float4 shapeData,half2 blurData,int shapeType,sampler2D s){switch"
448"(shapeType){case 0:{return $rect_blur_coverage_fn(coords,shapeData,blurData"
449".x,blurData.y,s);}case 2:{return $circle_blur_coverage_fn(coords,shapeData,"
450"s);}case 1:{return $rrect_blur_coverage_fn(coords,shapeData,blurData.x,s);}"
451"}return half4(0.);}";
452