Flutter Engine
The Flutter Engine
Functions
SkSL_MinifiedSkSL.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (SkSL_MinifiedSkSL, 200, 200, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( SkSL_MinifiedSkSL  ,
200  ,
200  ,
false  ,
 
)

Definition at line 4 of file SkSL_MinifiedSkSL.cpp.

4 {
5static constexpr char SKSL_MINIFIED_GradientShader[] =
6"half4 main(float2 a){float b=1.-a.y*.006666667;if(a.x<100.)return half4(float4"
7"(0.,.5,.75,1.)*b);else return half4(half3(0.,.5,.75),half(b));}";
8
9void draw(SkCanvas* canvas) {
10 auto [effect, err] = SkRuntimeEffect::MakeForShader(SkString(SKSL_MINIFIED_GradientShader));
11 sk_sp<SkShader> myShader = effect->makeShader(/*uniforms=*/ nullptr,
12 /*children=*/ {});
13
14 // Fill canvas with gray, first:
15 canvas->drawColor(SK_ColorGRAY);
16
17 // Blend our test shader on top of that:
18 SkPaint p;
19 p.setShader(myShader);
20 canvas->drawPaint(p);
21}} // END FIDDLE
constexpr SkColor SK_ColorGRAY
Definition: SkColor.h:113
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
Definition: SkCanvas.h:1182
void drawPaint(const SkPaint &paint)
Definition: SkCanvas.cpp:1668
static Result MakeForShader(SkString sksl, const Options &)