Flutter Engine
The Flutter Engine
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, bool useStorageBuffer)
 
 GradientData (SkShaderBase::GradientType, SkPoint point0, SkPoint point1, float radius0, float radius1, float bias, float scale, SkTileMode, int numStops, const SkPMColor4f *colors, const float *offsets, const SkGradientBaseShader *shader, sk_sp< TextureProxy > colorsAndOffsetsProxy, bool useStorageBuffer, 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
 
bool fUseStorageBuffer
 
SkPMColor4f fColors [kNumInternalStorageStops]
 
SkV4 fOffsets [kNumInternalStorageStops/4]
 
sk_sp< TextureProxyfColorsAndOffsetsProxy
 
const SkPMColor4ffSrcColors
 
const float * fSrcOffsets
 
const SkGradientBaseShaderfSrcShader
 
SkGradientShader::Interpolation fInterpolation
 

Static Public Attributes

static constexpr int kNumInternalStorageStops = 8
 

Detailed Description

Definition at line 87 of file KeyHelpers.h.

Constructor & Destructor Documentation

◆ GradientData() [1/2]

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

Definition at line 339 of file KeyHelpers.cpp.

342 : fType(type)
343 , fPoints{{0.0f, 0.0f}, {0.0f, 0.0f}}
344 , fRadii{0.0f, 0.0f}
345 , fBias(0.0f)
346 , fScale(0.0f)
348 , fNumStops(numStops)
349 , fUseStorageBuffer(useStorageBuffer)
350 , fSrcColors(nullptr)
351 , fSrcOffsets(nullptr) {
352 sk_bzero(fColors, sizeof(fColors));
353 sk_bzero(fOffsets, sizeof(fOffsets));
354}
sk_bzero(glyphs, sizeof(glyphs))
GLenum type
SkPMColor4f fColors[kNumInternalStorageStops]
Definition: KeyHelpers.h:134
SkV4 fOffsets[kNumInternalStorageStops/4]
Definition: KeyHelpers.h:135

◆ 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,
const SkGradientBaseShader shader,
sk_sp< TextureProxy colorsAndOffsetsProxy,
bool  useStorageBuffer,
const SkGradientShader::Interpolation interp 
)

Definition at line 356 of file KeyHelpers.cpp.

368 : fType(type)
369 , fBias(bias)
370 , fScale(scale)
371 , fTM(tm)
372 , fNumStops(numStops)
373 , fUseStorageBuffer(useStorageBuffer)
376 , fSrcShader(shader)
378 SkASSERT(fNumStops >= 1);
379
380 fPoints[0] = point0;
381 fPoints[1] = point1;
382 fRadii[0] = radius0;
383 fRadii[1] = radius1;
384
386 memcpy(fColors, colors, fNumStops * sizeof(SkColor4f));
387 float* rawOffsets = fOffsets[0].ptr();
388 if (offsets) {
389 memcpy(rawOffsets, offsets, fNumStops * sizeof(float));
390 } else {
391 for (int i = 0; i < fNumStops; ++i) {
392 rawOffsets[i] = SkIntToFloat(i) / (fNumStops-1);
393 }
394 }
395
396 // Extend the colors and offset, if necessary, to fill out the arrays.
397 // The unrolled binary search implementation assumes excess stops match the last real value.
398 for (int i = fNumStops; i < kNumInternalStorageStops; ++i) {
400 rawOffsets[i] = rawOffsets[fNumStops-1];
401 }
402 } else {
403 if (!fUseStorageBuffer) {
404 fColorsAndOffsetsProxy = std::move(colorsAndOffsetsProxy);
406 }
407 }
408}
#define SkASSERT(cond)
Definition: SkAssert.h:116
static float2 interp(const float2 &v0, const float2 &v1, const float2 &t)
Definition: SkGeometry.cpp:169
#define SkIntToFloat(x)
Definition: SkScalar.h:58
PODArray< SkColor > colors
Definition: SkRecords.h:276
list offsets
Definition: mskp_parser.py:37
const Scalar scale
const float * ptr() const
Definition: SkM44.h:129
SkGradientShader::Interpolation fInterpolation
Definition: KeyHelpers.h:141

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 121 of file KeyHelpers.h.

◆ fColors

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

Definition at line 134 of file KeyHelpers.h.

◆ fColorsAndOffsetsProxy

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

Definition at line 136 of file KeyHelpers.h.

◆ fInterpolation

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

Definition at line 141 of file KeyHelpers.h.

◆ fNumStops

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

Definition at line 125 of file KeyHelpers.h.

◆ fOffsets

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

Definition at line 135 of file KeyHelpers.h.

◆ fPoints

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

Definition at line 117 of file KeyHelpers.h.

◆ fRadii

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

Definition at line 118 of file KeyHelpers.h.

◆ fScale

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

Definition at line 122 of file KeyHelpers.h.

◆ fSrcColors

const SkPMColor4f* skgpu::graphite::GradientShaderBlocks::GradientData::fSrcColors

Definition at line 137 of file KeyHelpers.h.

◆ fSrcOffsets

const float* skgpu::graphite::GradientShaderBlocks::GradientData::fSrcOffsets

Definition at line 138 of file KeyHelpers.h.

◆ fSrcShader

const SkGradientBaseShader* skgpu::graphite::GradientShaderBlocks::GradientData::fSrcShader

Definition at line 139 of file KeyHelpers.h.

◆ fTM

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

Definition at line 124 of file KeyHelpers.h.

◆ fType

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

Definition at line 116 of file KeyHelpers.h.

◆ fUseStorageBuffer

bool skgpu::graphite::GradientShaderBlocks::GradientData::fUseStorageBuffer

Definition at line 126 of file KeyHelpers.h.

◆ kNumInternalStorageStops

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

Definition at line 90 of file KeyHelpers.h.


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