Flutter Engine
The Flutter Engine
Public Member Functions | Friends | List of all members
skgpu::graphite::PaintOptions Class Reference

#include <PaintOptions.h>

Public Member Functions

 PaintOptions ()
 
 PaintOptions (const PaintOptions &)
 
 ~PaintOptions ()
 
PaintOptionsoperator= (const PaintOptions &)
 
void setShaders (SkSpan< const sk_sp< PrecompileShader > > shaders)
 
SkSpan< const sk_sp< PrecompileShader > > getShaders () const
 
void setImageFilters (SkSpan< const sk_sp< PrecompileImageFilter > > imageFilters)
 
SkSpan< const sk_sp< PrecompileImageFilter > > getImageFilters () const
 
void setMaskFilters (SkSpan< const sk_sp< PrecompileMaskFilter > > maskFilters)
 
SkSpan< const sk_sp< PrecompileMaskFilter > > getMaskFilters () const
 
void setColorFilters (SkSpan< const sk_sp< PrecompileColorFilter > > colorFilters)
 
SkSpan< const sk_sp< PrecompileColorFilter > > getColorFilters () const
 
void setBlendModes (SkSpan< const SkBlendMode > blendModes)
 
SkSpan< const SkBlendModegetBlendModes () const
 
void setBlenders (SkSpan< const sk_sp< PrecompileBlender > > blenders)
 
SkSpan< const sk_sp< PrecompileBlender > > getBlenders () const
 
void setDither (bool dither)
 
bool isDither () const
 
PaintOptionsPriv priv ()
 
const PaintOptionsPriv priv () const
 

Friends

class PaintOptionsPriv
 

Detailed Description

This is the Precompilation analog to SkPaint. It encapsulates a set of options for each field of the SkPaint (e.g., colorFilters, imageFilters, etc). Many of the specific details of an SkPaint that are irrelevant to the final compiled Pipelines are abstracted away (e.g., the SkPaint's color field).

How Precompilation works in practice is a PaintOptions object is created and a set of options for each slot (e.g., shader, blender) are added. When passed to the Precompile() function, all the combinations specified by the PaintOptions will be created and precompiled.

To be concrete, if a PaintOptions object had two shader options and two blender options, four combinations would be precompiled.

Definition at line 50 of file PaintOptions.h.

Constructor & Destructor Documentation

◆ PaintOptions() [1/2]

skgpu::graphite::PaintOptions::PaintOptions ( )
default

Constructs a PaintOptions object with default values. It is equivalent to a default initialized SkPaint.

Returns
default initialized PaintOptions

◆ PaintOptions() [2/2]

skgpu::graphite::PaintOptions::PaintOptions ( const PaintOptions )
default

◆ ~PaintOptions()

skgpu::graphite::PaintOptions::~PaintOptions ( )
default

Member Function Documentation

◆ getBlenders()

SkSpan< const sk_sp< PrecompileBlender > > skgpu::graphite::PaintOptions::getBlenders ( ) const
inline

Definition at line 128 of file PaintOptions.h.

128 {
129 return SkSpan<const sk_sp<PrecompileBlender>>(fBlenderOptions);
130 }

◆ getBlendModes()

SkSpan< const SkBlendMode > skgpu::graphite::PaintOptions::getBlendModes ( ) const
inline

Definition at line 117 of file PaintOptions.h.

117 {
118 return SkSpan<const SkBlendMode>(fBlendModeOptions.data(), fBlendModeOptions.size());
119 }
int size() const
Definition: SkTArray.h:421

◆ getColorFilters()

SkSpan< const sk_sp< PrecompileColorFilter > > skgpu::graphite::PaintOptions::getColorFilters ( ) const
inline

Definition at line 105 of file PaintOptions.h.

105 {
106 return SkSpan<const sk_sp<PrecompileColorFilter>>(fColorFilterOptions);
107 }

◆ getImageFilters()

SkSpan< const sk_sp< PrecompileImageFilter > > skgpu::graphite::PaintOptions::getImageFilters ( ) const
inline

Definition at line 81 of file PaintOptions.h.

81 {
82 return SkSpan<const sk_sp<PrecompileImageFilter>>(fImageFilterOptions);
83 }

◆ getMaskFilters()

SkSpan< const sk_sp< PrecompileMaskFilter > > skgpu::graphite::PaintOptions::getMaskFilters ( ) const
inline

Definition at line 93 of file PaintOptions.h.

93 {
94 return SkSpan<const sk_sp<PrecompileMaskFilter>>(fMaskFilterOptions);
95 }

◆ getShaders()

SkSpan< const sk_sp< PrecompileShader > > skgpu::graphite::PaintOptions::getShaders ( ) const
inline

Definition at line 69 of file PaintOptions.h.

69 {
70 return SkSpan<const sk_sp<PrecompileShader>>(fShaderOptions);
71 }

◆ isDither()

bool skgpu::graphite::PaintOptions::isDither ( ) const
inline

Definition at line 139 of file PaintOptions.h.

139{ return fDither; }

◆ operator=()

PaintOptions & skgpu::graphite::PaintOptions::operator= ( const PaintOptions )
default

◆ priv() [1/2]

PaintOptionsPriv skgpu::graphite::PaintOptions::priv ( )
inline

Definition at line 59 of file PaintOptionsPriv.h.

59{ return PaintOptionsPriv(this); }

◆ priv() [2/2]

const PaintOptionsPriv skgpu::graphite::PaintOptions::priv ( ) const
inline

Definition at line 62 of file PaintOptionsPriv.h.

62 {
63 return PaintOptionsPriv(const_cast<PaintOptions *>(this));
64}

◆ setBlenders()

void skgpu::graphite::PaintOptions::setBlenders ( SkSpan< const sk_sp< PrecompileBlender > >  blenders)

Sets the blender options used when generating precompilation combinations.

This corresponds to SkPaint's setBlender() method

Parameters
blendersThe options used for blending when generating precompilation combinations.

Definition at line 64 of file PaintOptions.cpp.

64 {
65 for (const sk_sp<PrecompileBlender>& b: blenders) {
66 if (b->priv().asBlendMode().has_value()) {
67 fBlendModeOptions.push_back(b->priv().asBlendMode().value());
68 } else {
69 fBlenderOptions.push_back(b);
70 }
71 }
72}
static bool b

◆ setBlendModes()

void skgpu::graphite::PaintOptions::setBlendModes ( SkSpan< const SkBlendMode blendModes)

Sets the blend mode options used when generating precompilation combinations.

This corresponds to SkPaint's setBlendMode() method

Parameters
blendModesThe options used for blending when generating precompilation combinations.

Definition at line 59 of file PaintOptions.cpp.

59 {
60 fBlendModeOptions.clear();
61 fBlendModeOptions.push_back_n(blendModes.size(), blendModes.data());
62}
constexpr T * data() const
Definition: SkSpan_impl.h:94
constexpr size_t size() const
Definition: SkSpan_impl.h:95
T * push_back_n(int n)
Definition: SkTArray.h:267

◆ setColorFilters()

void skgpu::graphite::PaintOptions::setColorFilters ( SkSpan< const sk_sp< PrecompileColorFilter > >  colorFilters)

Sets the color filter options used when generating precompilation combinations.

This corresponds to SkPaint's setColorFilter() method

Parameters
colorFiltersThe options used for color filtering when generating precompilation combinations.

Definition at line 50 of file PaintOptions.cpp.

50 {
51 fColorFilterOptions.clear();
52 fColorFilterOptions.push_back_n(colorFilters.size(), colorFilters.data());
53}

◆ setDither()

void skgpu::graphite::PaintOptions::setDither ( bool  dither)
inline

Sets the dither setting used when generating precompilation combinations

This corresponds to SkPaint's setDither() method

Parameters
ditherthe dither setting used when generating precompilation combinations.

Definition at line 138 of file PaintOptions.h.

138{ fDither = dither; }

◆ setImageFilters()

void skgpu::graphite::PaintOptions::setImageFilters ( SkSpan< const sk_sp< PrecompileImageFilter > >  imageFilters)

Sets the image filter options used when generating precompilation combinations.

This corresponds to SkPaint's setImageFilter() method

Parameters
imageFiltersThe options used for image filtering when generating precompilation combinations.

Definition at line 40 of file PaintOptions.cpp.

40 {
41 fImageFilterOptions.clear();
42 fImageFilterOptions.push_back_n(imageFilters.size(), imageFilters.data());
43}

◆ setMaskFilters()

void skgpu::graphite::PaintOptions::setMaskFilters ( SkSpan< const sk_sp< PrecompileMaskFilter > >  maskFilters)

Sets the mask filter options used when generating precompilation combinations.

This corresponds to SkPaint's setMaskFilter() method

Parameters
maskFiltersThe options used for mask filtering when generating precompilation combinations.

Definition at line 45 of file PaintOptions.cpp.

45 {
46 fMaskFilterOptions.clear();
47 fMaskFilterOptions.push_back_n(maskFilters.size(), maskFilters.data());
48}

◆ setShaders()

void skgpu::graphite::PaintOptions::setShaders ( SkSpan< const sk_sp< PrecompileShader > >  shaders)

Sets the shader options used when generating precompilation combinations.

This corresponds to SkPaint's setShader() method

Parameters
shadersThe options used for shading when generating precompilation combinations.

Definition at line 35 of file PaintOptions.cpp.

35 {
36 fShaderOptions.clear();
37 fShaderOptions.push_back_n(shaders.size(), shaders.data());
38}

Friends And Related Function Documentation

◆ PaintOptionsPriv

friend class PaintOptionsPriv
friend

Definition at line 146 of file PaintOptions.h.


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