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

#include <KeyHelpers.h>

Public Member Functions

 GradientData (SkShaderBase::GradientType, int numStops)
 
 GradientData (SkShaderBase::GradientType, SkPoint point0, SkPoint point1, float radius0, float radius1, float bias, float scale, SkTileMode, int numStops, const SkPMColor4f *colors, const float *offsets, sk_sp< TextureProxy > colorsAndOffsetsProxy, const SkGradientShader::Interpolation &)
 
bool operator== (const GradientData &rhs) const =delete
 
bool operator!= (const GradientData &rhs) const =delete
 

Public Attributes

SkShaderBase::GradientType fType
 
SkPoint fPoints [2]
 
float fRadii [2]
 
float fBias
 
float fScale
 
SkTileMode fTM
 
int fNumStops
 
SkPMColor4f fColors [kNumInternalStorageStops]
 
SkV4 fOffsets [kNumInternalStorageStops/4]
 
sk_sp< TextureProxyfColorsAndOffsetsProxy
 
SkGradientShader::Interpolation fInterpolation
 

Static Public Attributes

static constexpr int kNumInternalStorageStops = 8
 

Detailed Description

Definition at line 85 of file KeyHelpers.h.

Constructor & Destructor Documentation

◆ GradientData() [1/2]

skgpu::graphite::GradientShaderBlocks::GradientData::GradientData ( SkShaderBase::GradientType  type,
int  numStops 
)

Definition at line 282 of file KeyHelpers.cpp.

◆ GradientData() [2/2]

skgpu::graphite::GradientShaderBlocks::GradientData::GradientData ( SkShaderBase::GradientType  type,
SkPoint  point0,
SkPoint  point1,
float  radius0,
float  radius1,
float  bias,
float  scale,
SkTileMode  tm,
int  numStops,
const SkPMColor4f colors,
const float *  offsets,
sk_sp< TextureProxy colorsAndOffsetsProxy,
const SkGradientShader::Interpolation interp 
)

Definition at line 294 of file KeyHelpers.cpp.

304 : fType(type)
305 , fBias(bias)
306 , fScale(scale)
307 , fTM(tm)
308 , fNumStops(numStops)
310 SkASSERT(fNumStops >= 1);
311
312 fPoints[0] = point0;
313 fPoints[1] = point1;
314 fRadii[0] = radius0;
315 fRadii[1] = radius1;
316
318 memcpy(fColors, colors, fNumStops * sizeof(SkColor4f));
319 float* rawOffsets = fOffsets[0].ptr();
320 if (offsets) {
321 memcpy(rawOffsets, offsets, fNumStops * sizeof(float));
322 } else {
323 for (int i = 0; i < fNumStops; ++i) {
324 rawOffsets[i] = SkIntToFloat(i) / (fNumStops-1);
325 }
326 }
327
328 // Extend the colors and offset, if necessary, to fill out the arrays.
329 // The unrolled binary search implementation assumes excess stops match the last real value.
330 for (int i = fNumStops; i < kNumInternalStorageStops; ++i) {
331 fColors[i] = fColors[fNumStops-1];
332 rawOffsets[i] = rawOffsets[fNumStops-1];
333 }
334 } else {
335 fColorsAndOffsetsProxy = std::move(colorsAndOffsetsProxy);
337 }
338}
#define SkASSERT(cond)
Definition SkAssert.h:116
static float2 interp(const float2 &v0, const float2 &v1, const float2 &t)
#define SkIntToFloat(x)
Definition SkScalar.h:58
const Scalar scale
const float * ptr() const
Definition SkM44.h:129
SkGradientShader::Interpolation fInterpolation
Definition KeyHelpers.h:130

Member Function Documentation

◆ operator!=()

bool skgpu::graphite::GradientShaderBlocks::GradientData::operator!= ( const GradientData rhs) const
delete

◆ operator==()

bool skgpu::graphite::GradientShaderBlocks::GradientData::operator== ( const GradientData rhs) const
delete

Member Data Documentation

◆ fBias

float skgpu::graphite::GradientShaderBlocks::GradientData::fBias

Definition at line 117 of file KeyHelpers.h.

◆ fColors

SkPMColor4f skgpu::graphite::GradientShaderBlocks::GradientData::fColors[kNumInternalStorageStops]

Definition at line 126 of file KeyHelpers.h.

◆ fColorsAndOffsetsProxy

sk_sp<TextureProxy> skgpu::graphite::GradientShaderBlocks::GradientData::fColorsAndOffsetsProxy

Definition at line 128 of file KeyHelpers.h.

◆ fInterpolation

SkGradientShader::Interpolation skgpu::graphite::GradientShaderBlocks::GradientData::fInterpolation

Definition at line 130 of file KeyHelpers.h.

◆ fNumStops

int skgpu::graphite::GradientShaderBlocks::GradientData::fNumStops

Definition at line 121 of file KeyHelpers.h.

◆ fOffsets

SkV4 skgpu::graphite::GradientShaderBlocks::GradientData::fOffsets[kNumInternalStorageStops/4]

Definition at line 127 of file KeyHelpers.h.

◆ fPoints

SkPoint skgpu::graphite::GradientShaderBlocks::GradientData::fPoints[2]

Definition at line 113 of file KeyHelpers.h.

◆ fRadii

float skgpu::graphite::GradientShaderBlocks::GradientData::fRadii[2]

Definition at line 114 of file KeyHelpers.h.

◆ fScale

float skgpu::graphite::GradientShaderBlocks::GradientData::fScale

Definition at line 118 of file KeyHelpers.h.

◆ fTM

SkTileMode skgpu::graphite::GradientShaderBlocks::GradientData::fTM

Definition at line 120 of file KeyHelpers.h.

◆ fType

SkShaderBase::GradientType skgpu::graphite::GradientShaderBlocks::GradientData::fType

Definition at line 112 of file KeyHelpers.h.

◆ kNumInternalStorageStops

constexpr int skgpu::graphite::GradientShaderBlocks::GradientData::kNumInternalStorageStops = 8
staticconstexpr

Definition at line 88 of file KeyHelpers.h.


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