Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
SkLocalMatrixImageFilter Class Reference

#include <SkLocalMatrixImageFilter.h>

Inheritance diagram for SkLocalMatrixImageFilter:
SkImageFilter_Base SkImageFilter SkFlattenable SkRefCnt SkRefCntBase

Public Member Functions

SkRect computeFastBounds (const SkRect &) const override
 
- Public Member Functions inherited from SkImageFilter_Base
skif::FilterResult filterImage (const skif::Context &context) const
 
sk_sp< SkImagemakeImageWithFilter (sk_sp< skif::Backend > backend, sk_sp< SkImage > src, const SkIRect &subset, const SkIRect &clipBounds, SkIRect *outSubset, SkIPoint *offset) const
 
skif::LayerSpace< SkIRectgetInputBounds (const skif::Mapping &mapping, const skif::DeviceSpace< SkIRect > &desiredOutput, std::optional< skif::ParameterSpace< SkRect > > knownContentBounds) const
 
std::optional< skif::DeviceSpace< SkIRect > > getOutputBounds (const skif::Mapping &mapping, const skif::ParameterSpace< SkRect > &contentBounds) const
 
bool affectsTransparentBlack () const
 
bool usesSource () const
 
MatrixCapability getCTMCapability () const
 
uint32_t uniqueID () const
 
SkFlattenable::Type getFlattenableType () const override
 
- Public Member Functions inherited from SkImageFilter
SkIRect filterBounds (const SkIRect &src, const SkMatrix &ctm, MapDirection, const SkIRect *inputRect=nullptr) const
 
bool isColorFilterNode (SkColorFilter **filterPtr) const
 
bool asColorFilter (SkColorFilter **filterPtr) const
 
bool asAColorFilter (SkColorFilter **filterPtr) const
 
int countInputs () const
 
const SkImageFiltergetInput (int i) const
 
virtual SkRect computeFastBounds (const SkRect &bounds) const
 
bool canComputeFastBounds () const
 
sk_sp< SkImageFiltermakeWithLocalMatrix (const SkMatrix &matrix) const
 
- Public Member Functions inherited from SkFlattenable
 SkFlattenable ()
 
virtual Factory getFactory () const =0
 
virtual const char * getTypeName () const =0
 
virtual void flatten (SkWriteBuffer &) const
 
virtual Type getFlattenableType () const =0
 
sk_sp< SkDataserialize (const SkSerialProcs *=nullptr) const
 
size_t serialize (void *memory, size_t memory_size, const SkSerialProcs *=nullptr) const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Static Public Member Functions

static sk_sp< SkImageFilterMake (const SkMatrix &localMatrix, sk_sp< SkImageFilter > input)
 
- Static Public Member Functions inherited from SkImageFilter_Base
static SkFlattenable::Type GetFlattenableType ()
 
static std::pair< sk_sp< SkImageFilter >, std::optional< SkRect > > Unflatten (SkReadBuffer &buffer)
 
- Static Public Member Functions inherited from SkImageFilter
static sk_sp< SkImageFilterDeserialize (const void *data, size_t size, const SkDeserialProcs *procs=nullptr)
 
- Static Public Member Functions inherited from SkFlattenable
static Factory NameToFactory (const char name[])
 
static const char * FactoryToName (Factory)
 
static void Register (const char name[], Factory)
 
static sk_sp< SkFlattenableDeserialize (Type, const void *data, size_t length, const SkDeserialProcs *procs=nullptr)
 

Protected Member Functions

void flatten (SkWriteBuffer &) const override
 
- Protected Member Functions inherited from SkImageFilter_Base
 SkImageFilter_Base (sk_sp< SkImageFilter > const *inputs, int inputCount, std::optional< bool > usesSrc={})
 
 ~SkImageFilter_Base () override
 
void flatten (SkWriteBuffer &) const override
 
skif::LayerSpace< SkIRectgetChildInputLayerBounds (int index, const skif::Mapping &mapping, const skif::LayerSpace< SkIRect > &desiredOutput, std::optional< skif::LayerSpace< SkIRect > > contentBounds) const
 
std::optional< skif::LayerSpace< SkIRect > > getChildOutputLayerBounds (int index, const skif::Mapping &mapping, std::optional< skif::LayerSpace< SkIRect > > contentBounds) const
 
skif::FilterResult getChildOutput (int index, const skif::Context &ctx) const
 
- Protected Member Functions inherited from SkImageFilter
sk_sp< SkImageFilterrefMe () const
 

Additional Inherited Members

- Public Types inherited from SkImageFilter_Base
using MatrixCapability = skif::MatrixCapability
 
- Public Types inherited from SkImageFilter
enum  MapDirection { kForward_MapDirection , kReverse_MapDirection }
 
- Public Types inherited from SkFlattenable
enum  Type {
  kSkColorFilter_Type , kSkBlender_Type , kSkDrawable_Type , kSkDrawLooper_Type ,
  kSkImageFilter_Type , kSkMaskFilter_Type , kSkPathEffect_Type , kSkShader_Type
}
 
typedef sk_sp< SkFlattenable >(* Factory) (SkReadBuffer &)
 

Detailed Description

Wraps another imagefilter + matrix, such that using this filter will give the same result as using the wrapped filter with the matrix applied to its context.

Definition at line 28 of file SkLocalMatrixImageFilter.h.

Member Function Documentation

◆ computeFastBounds()

SkRect SkLocalMatrixImageFilter::computeFastBounds ( const SkRect bounds) const
overridevirtual

Reimplemented from SkImageFilter.

Definition at line 81 of file SkLocalMatrixImageFilter.cpp.

81 {
82 // In onGet[Input|Output]LayerBounds, there is a Mapping that can be adjusted by the
83 // local matrix, so their layer-space parameters do not need to be modified. Since
84 // computeFastBounds() takes no matrix, it always operates as if it has the identity mapping.
85 //
86 // In order to match the behavior of onGetInputLayerBounds, we map 'bounds' by the inverse of
87 // the local matrix, pass that to the child, and then map the result by the local matrix.
88 // TODO: Implementing computeFastBounds in terms of onGetOutputLayerBounds() trivially removes
89 // this complexity.
90 SkRect localBounds = fInvLocalMatrix.mapRect(bounds);
91 return fLocalMatrix.mapRect(this->getInput(0)->computeFastBounds(localBounds));
92}
const SkImageFilter * getInput(int i) const
SkRect computeFastBounds(const SkRect &) const override
bool mapRect(SkRect *dst, const SkRect &src, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
Definition: SkMatrix.cpp:1141
Optional< SkRect > bounds
Definition: SkRecords.h:189

◆ flatten()

void SkLocalMatrixImageFilter::flatten ( SkWriteBuffer ) const
overrideprotectedvirtual

Override this if your subclass needs to record data that it will need to recreate itself from its CreateProc (returned by getFactory()).

DEPRECATED public : will move to protected ... use serialize() instead

Reimplemented from SkImageFilter_Base.

Definition at line 45 of file SkLocalMatrixImageFilter.cpp.

45 {
47 buffer.writeMatrix(fLocalMatrix);
48 // fInvLocalMatrix will be reconstructed
49}
void flatten(SkWriteBuffer &) const override
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126

◆ Make()

sk_sp< SkImageFilter > SkLocalMatrixImageFilter::Make ( const SkMatrix localMatrix,
sk_sp< SkImageFilter input 
)
static

Definition at line 14 of file SkLocalMatrixImageFilter.cpp.

15 {
16 if (!input) {
17 return nullptr;
18 }
19 if (localMatrix.isIdentity()) {
20 return input;
21 }
22
23 MatrixCapability inputCapability = as_IFB(input)->getCTMCapability();
24 if ((inputCapability == MatrixCapability::kTranslate && !localMatrix.isTranslate()) ||
25 (inputCapability == MatrixCapability::kScaleTranslate && !localMatrix.isScaleTranslate())) {
26 // Nothing we can do at this point
27 return nullptr;
28 }
29
30 SkMatrix invLocal;
31 if (!localMatrix.invert(&invLocal)) {
32 return nullptr;
33 }
34
35 return sk_sp<SkImageFilter>(new SkLocalMatrixImageFilter(localMatrix, invLocal, &input));
36}
static SkImageFilter_Base * as_IFB(SkImageFilter *filter)
skif::MatrixCapability MatrixCapability
MatrixCapability getCTMCapability() const
bool invert(SkMatrix *inverse) const
Definition: SkMatrix.h:1206
bool isTranslate() const
Definition: SkMatrix.h:248
bool isScaleTranslate() const
Definition: SkMatrix.h:236
bool isIdentity() const
Definition: SkMatrix.h:223

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