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