Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Static Public Member Functions | List of all members
skgpu::graphite::GradientShaderBlocks Struct Reference

#include <KeyHelpers.h>

Classes

struct  GradientData
 

Static Public Member Functions

static void AddBlock (const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *, const GradientData &)
 

Detailed Description

Definition at line 84 of file KeyHelpers.h.

Member Function Documentation

◆ AddBlock()

void skgpu::graphite::GradientShaderBlocks::AddBlock ( const KeyContext keyContext,
PaintParamsKeyBuilder builder,
PipelineDataGatherer gatherer,
const GradientData gradData 
)
static

Definition at line 340 of file KeyHelpers.cpp.

343 {
344 auto dict = keyContext.dict();
345
346 if (gradData.fNumStops > GradientData::kNumInternalStorageStops && gatherer) {
347 SkASSERT(gradData.fColorsAndOffsetsProxy);
348
350 static constexpr SkTileMode kClampTiling[2] = {SkTileMode::kClamp, SkTileMode::kClamp};
351 gatherer->add(kNearest, kClampTiling, gradData.fColorsAndOffsetsProxy);
352 }
353
355 switch (gradData.fType) {
356 case SkShaderBase::GradientType::kLinear:
357 codeSnippetID =
358 gradData.fNumStops <= 4 ? BuiltInCodeSnippetID::kLinearGradientShader4
359 : gradData.fNumStops <= 8 ? BuiltInCodeSnippetID::kLinearGradientShader8
361 add_linear_gradient_uniform_data(dict, codeSnippetID, gradData, gatherer);
362 break;
363 case SkShaderBase::GradientType::kRadial:
364 codeSnippetID =
365 gradData.fNumStops <= 4 ? BuiltInCodeSnippetID::kRadialGradientShader4
366 : gradData.fNumStops <= 8 ? BuiltInCodeSnippetID::kRadialGradientShader8
368 add_radial_gradient_uniform_data(dict, codeSnippetID, gradData, gatherer);
369 break;
370 case SkShaderBase::GradientType::kSweep:
371 codeSnippetID =
372 gradData.fNumStops <= 4 ? BuiltInCodeSnippetID::kSweepGradientShader4
373 : gradData.fNumStops <= 8 ? BuiltInCodeSnippetID::kSweepGradientShader8
375 add_sweep_gradient_uniform_data(dict, codeSnippetID, gradData, gatherer);
376 break;
377 case SkShaderBase::GradientType::kConical:
378 codeSnippetID =
379 gradData.fNumStops <= 4 ? BuiltInCodeSnippetID::kConicalGradientShader4
380 : gradData.fNumStops <= 8 ? BuiltInCodeSnippetID::kConicalGradientShader8
382 add_conical_gradient_uniform_data(dict, codeSnippetID, gradData, gatherer);
383 break;
385 default:
386 SkDEBUGFAIL("Expected a gradient shader, but it wasn't one.");
387 break;
388 }
389
390 builder->addBlock(codeSnippetID);
391}
#define SkDEBUGFAIL(message)
Definition SkAssert.h:118
#define SkASSERT(cond)
Definition SkAssert.h:116
SkTileMode
Definition SkTileMode.h:13

The documentation for this struct was generated from the following files: