Flutter Engine
The Flutter Engine
Public Member Functions | Public Attributes | List of all members
SkRuntimeEffectBuilder::BuilderUniform Struct Reference

#include <SkRuntimeEffect.h>

Public Member Functions

template<typename T >
std::enable_if_t< std::is_trivially_copyable< T >::value, BuilderUniform & > operator= (const T &val)
 
BuilderUniformoperator= (const SkMatrix &val)
 
template<typename T >
bool set (const T val[], const int count)
 

Public Attributes

SkRuntimeEffectBuilderfOwner
 
const SkRuntimeEffect::UniformfVar
 

Detailed Description

Definition at line 334 of file SkRuntimeEffect.h.

Member Function Documentation

◆ operator=() [1/2]

BuilderUniform & SkRuntimeEffectBuilder::BuilderUniform::operator= ( const SkMatrix val)
inline

Definition at line 354 of file SkRuntimeEffect.h.

354 {
355 if (!fVar) {
356 SkDEBUGFAIL("Assigning to missing variable");
357 } else if (fVar->sizeInBytes() != 9 * sizeof(float)) {
358 SkDEBUGFAIL("Incorrect value size");
359 } else {
360 float* data = SkTAddOffset<float>(fOwner->writableUniformData(),
361 (ptrdiff_t)fVar->offset);
362 data[0] = val.get(0); data[1] = val.get(3); data[2] = val.get(6);
363 data[3] = val.get(1); data[4] = val.get(4); data[5] = val.get(7);
364 data[6] = val.get(2); data[7] = val.get(5); data[8] = val.get(8);
365 }
366 return *this;
367 }
#define SkDEBUGFAIL(message)
Definition: SkAssert.h:118
SkScalar get(int index) const
Definition: SkMatrix.h:392
const SkRuntimeEffect::Uniform * fVar
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ operator=() [2/2]

template<typename T >
std::enable_if_t< std::is_trivially_copyable< T >::value, BuilderUniform & > SkRuntimeEffectBuilder::BuilderUniform::operator= ( const T val)
inline

Definition at line 341 of file SkRuntimeEffect.h.

342 {
343 if (!fVar) {
344 SkDEBUGFAIL("Assigning to missing variable");
345 } else if (sizeof(val) != fVar->sizeInBytes()) {
346 SkDEBUGFAIL("Incorrect value size");
347 } else {
348 memcpy(SkTAddOffset<void>(fOwner->writableUniformData(), fVar->offset),
349 &val, sizeof(val));
350 }
351 return *this;
352 }

◆ set()

template<typename T >
bool SkRuntimeEffectBuilder::BuilderUniform::set ( const T  val[],
const int  count 
)
inline

Definition at line 370 of file SkRuntimeEffect.h.

370 {
371 static_assert(std::is_trivially_copyable<T>::value, "Value must be trivial copyable");
372 if (!fVar) {
373 SkDEBUGFAIL("Assigning to missing variable");
374 return false;
375 } else if (sizeof(T) * count != fVar->sizeInBytes()) {
376 SkDEBUGFAIL("Incorrect value size");
377 return false;
378 } else {
379 memcpy(SkTAddOffset<void>(fOwner->writableUniformData(), fVar->offset),
380 val, sizeof(T) * count);
381 }
382 return true;
383 }
int count
Definition: FontMgrTest.cpp:50
uint8_t value
#define T
Definition: precompiler.cc:65

Member Data Documentation

◆ fOwner

SkRuntimeEffectBuilder* SkRuntimeEffectBuilder::BuilderUniform::fOwner

Definition at line 385 of file SkRuntimeEffect.h.

◆ fVar

const SkRuntimeEffect::Uniform* SkRuntimeEffectBuilder::BuilderUniform::fVar

Definition at line 386 of file SkRuntimeEffect.h.


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