Flutter Engine
The Flutter Engine
Classes | Enumerations | Functions
skif Namespace Reference

Classes

class  Backend
 
class  Context
 
class  DeviceSpace
 
class  FilterResult
 
struct  IVector
 
class  LayerSpace
 
class  LayerSpace< IVector >
 
class  LayerSpace< SkIPoint >
 
class  LayerSpace< SkIRect >
 
class  LayerSpace< SkISize >
 
class  LayerSpace< SkMatrix >
 
class  LayerSpace< SkPoint >
 
class  LayerSpace< SkRect >
 
class  LayerSpace< SkSize >
 
class  LayerSpace< Vector >
 
class  LayerSpace< ZValue >
 
class  Mapping
 
class  ParameterSpace
 
struct  Stats
 
struct  Vector
 

Enumerations

enum class  MatrixCapability { kTranslate , kScaleTranslate , kComplex }
 

Functions

sk_sp< BackendMakeRasterBackend (const SkSurfaceProps &surfaceProps, SkColorType colorType)
 
SkIRect RoundOut (SkRect r)
 
SkIRect RoundIn (SkRect r)
 
static bool compatible_sampling (const SkSamplingOptions &currentSampling, bool currentXformWontAffectNearest, SkSamplingOptions *nextSampling, bool nextXformWontAffectNearest)
 
sk_sp< BackendMakeGaneshBackend (sk_sp< GrRecordingContext > context, GrSurfaceOrigin origin, const SkSurfaceProps &surfaceProps, SkColorType colorType)
 
sk_sp< BackendMakeGraphiteBackend (skgpu::graphite::Recorder *recorder, const SkSurfaceProps &surfaceProps, SkColorType colorType)
 

Enumeration Type Documentation

◆ MatrixCapability

enum class skif::MatrixCapability
strong

Most ImageFilters can natively handle scaling and translate components in the CTM. Only some of them can handle affine (or more complex) matrices. Some may only handle translation.

Enumerator
kTranslate 
kScaleTranslate 
kComplex 

Definition at line 545 of file SkImageFilterTypes.h.

Function Documentation

◆ compatible_sampling()

static bool skif::compatible_sampling ( const SkSamplingOptions currentSampling,
bool  currentXformWontAffectNearest,
SkSamplingOptions nextSampling,
bool  nextXformWontAffectNearest 
)
static

Definition at line 986 of file SkImageFilterTypes.cpp.

989 {
990 // Both transforms could perform non-trivial sampling, but if they are similar enough we
991 // assume performing one non-trivial sampling operation with the concatenated transform will
992 // not be visually distinguishable from sampling twice.
993 // TODO(michaelludwig): For now ignore mipmap policy, SkSpecialImages are not supposed to be
994 // drawn with mipmapping, and the majority of filter steps produce images that are at the
995 // proper scale and do not define mip levels. The main exception is the ::Image() filter
996 // leaf but that doesn't use this system yet.
997 if (currentSampling.isAniso() && nextSampling->isAniso()) {
998 // Assume we can get away with one sampling at the highest anisotropy level
999 *nextSampling = SkSamplingOptions::Aniso(std::max(currentSampling.maxAniso,
1000 nextSampling->maxAniso));
1001 return true;
1002 } else if (currentSampling.isAniso() && nextSampling->filter == SkFilterMode::kLinear) {
1003 // Assume we can get away with the current anisotropic filter since the next is linear
1004 *nextSampling = currentSampling;
1005 return true;
1006 } else if (nextSampling->isAniso() && currentSampling.filter == SkFilterMode::kLinear) {
1007 // Mirror of the above, assume we can just get away with next's anisotropic filter
1008 return true;
1009 } else if (currentSampling.useCubic && (nextSampling->filter == SkFilterMode::kLinear ||
1010 (nextSampling->useCubic &&
1011 currentSampling.cubic.B == nextSampling->cubic.B &&
1012 currentSampling.cubic.C == nextSampling->cubic.C))) {
1013 // Assume we can get away with the current bicubic filter, since the next is the same
1014 // or a bilerp that can be upgraded.
1015 *nextSampling = currentSampling;
1016 return true;
1017 } else if (nextSampling->useCubic && currentSampling.filter == SkFilterMode::kLinear) {
1018 // Mirror of the above, assume we can just get away with next's cubic resampler
1019 return true;
1020 } else if (currentSampling.filter == SkFilterMode::kLinear &&
1021 nextSampling->filter == SkFilterMode::kLinear) {
1022 // Assume we can get away with a single bilerp vs. the two
1023 return true;
1024 } else if (nextSampling->filter == SkFilterMode::kNearest && currentXformWontAffectNearest) {
1025 // The next transform and nearest-neighbor filtering isn't impacted by the current transform
1026 SkASSERT(currentSampling.filter == SkFilterMode::kLinear);
1027 return true;
1028 } else if (currentSampling.filter == SkFilterMode::kNearest && nextXformWontAffectNearest) {
1029 // The next transform doesn't change the nearest-neighbor filtering of the current transform
1030 SkASSERT(nextSampling->filter == SkFilterMode::kLinear);
1031 *nextSampling = currentSampling;
1032 return true;
1033 } else {
1034 // The current or next sampling is nearest neighbor, and will produce visible texels
1035 // oriented with the current transform; assume this is a desired effect and preserve it.
1036 return false;
1037 }
1038}
#define SkASSERT(cond)
Definition: SkAssert.h:116
static float max(float r, float g, float b)
Definition: hsl.cpp:49
static constexpr SkSamplingOptions Aniso(int maxAniso)
const SkCubicResampler cubic
const SkFilterMode filter

◆ MakeGaneshBackend()

sk_sp< Backend > skif::MakeGaneshBackend ( sk_sp< GrRecordingContext context,
GrSurfaceOrigin  origin,
const SkSurfaceProps surfaceProps,
SkColorType  colorType 
)

Definition at line 895 of file GrImageUtils.cpp.

898 {
899 SkASSERT(context);
900 return sk_make_sp<GaneshBackend>(std::move(context), origin, surfaceProps, colorType);
901}
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)

◆ MakeGraphiteBackend()

sk_sp< Backend > skif::MakeGraphiteBackend ( skgpu::graphite::Recorder recorder,
const SkSurfaceProps surfaceProps,
SkColorType  colorType 
)

Definition at line 980 of file TextureUtils.cpp.

982 {
983 SkASSERT(recorder);
984 return sk_make_sp<GraphiteBackend>(recorder, surfaceProps, colorType);
985}

◆ MakeRasterBackend()

sk_sp< Backend > skif::MakeRasterBackend ( const SkSurfaceProps surfaceProps,
SkColorType  colorType 
)

Definition at line 218 of file SkImageFilterTypes.cpp.

218 {
219 // TODO (skbug:14286): Remove this forcing to 8888. Many legacy image filters only support
220 // N32 on CPU, but once they are implemented in terms of draws and SkSL they will support
221 // all color types, like the GPU backends.
222 colorType = kN32_SkColorType;
223
224 return sk_make_sp<RasterBackend>(surfaceProps, colorType);
225}

◆ RoundIn()

SkIRect skif::RoundIn ( SkRect  r)

Definition at line 255 of file SkImageFilterTypes.cpp.

255{ return r.makeOutset(kRoundEpsilon, kRoundEpsilon).roundIn(); }
void roundIn(SkIRect *dst) const
Definition: SkRect.h:1266
SkRect makeOutset(float dx, float dy) const
Definition: SkRect.h:1002

◆ RoundOut()

SkIRect skif::RoundOut ( SkRect  r)

Definition at line 253 of file SkImageFilterTypes.cpp.

253{ return r.makeInset(kRoundEpsilon, kRoundEpsilon).roundOut(); }
SkRect makeInset(float dx, float dy) const
Definition: SkRect.h:987
void roundOut(SkIRect *dst) const
Definition: SkRect.h:1241