Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Friends | List of all members
SkBlurMaskFilterImpl Class Reference

#include <SkBlurMaskFilterImpl.h>

Inheritance diagram for SkBlurMaskFilterImpl:
SkMaskFilterBase SkMaskFilter SkFlattenable SkRefCnt SkRefCntBase

Public Member Functions

 SkBlurMaskFilterImpl (SkScalar sigma, SkBlurStyle, bool respectCTM)
 
SkMask::Format getFormat () const override
 
bool filterMask (SkMaskBuilder *dst, const SkMask &src, const SkMatrix &, SkIPoint *margin) const override
 
SkMaskFilterBase::Type type () const override
 
void computeFastBounds (const SkRect &, SkRect *) const override
 
bool asABlur (BlurRec *) const override
 
sk_sp< SkImageFilterasImageFilter (const SkMatrix &ctm) const override
 
SkScalar computeXformedSigma (const SkMatrix &ctm) const
 
SkBlurStyle blurStyle () const
 
SkScalar sigma () const
 
bool ignoreXform () const
 
- Public Member Functions inherited from SkMaskFilterBase
SkFlattenable::Type getFlattenableType () const override
 
- Public Member Functions inherited from SkMaskFilter
SkRect approximateFilteredBounds (const SkRect &src) const
 
- Public Member Functions inherited from SkFlattenable
 SkFlattenable ()
 
virtual Factory getFactory () const =0
 
virtual const char * getTypeName () 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
 

Private Member Functions

FilterReturn filterRectsToNine (const SkRect[], int count, const SkMatrix &, const SkIRect &clipBounds, SkTLazy< NinePatch > *) const override
 
FilterReturn filterRRectToNine (const SkRRect &, const SkMatrix &, const SkIRect &clipBounds, SkTLazy< NinePatch > *) const override
 
void flatten (SkWriteBuffer &) const override
 

Friends

class SkBlurMaskFilter
 
void sk_register_blur_maskfilter_createproc ()
 

Additional Inherited Members

- Public Types inherited from SkMaskFilterBase
enum class  Type {
  kBlur , kEmboss , kSDF , kShader ,
  kTable
}
 
- 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 &)
 
- Static Public Member Functions inherited from SkMaskFilterBase
static SkFlattenable::Type GetFlattenableType ()
 
- Static Public Member Functions inherited from SkMaskFilter
static sk_sp< SkMaskFilterMakeBlur (SkBlurStyle style, SkScalar sigma, bool respectCTM=true)
 
static sk_sp< SkMaskFilterDeserialize (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 Types inherited from SkMaskFilterBase
enum  FilterReturn { kFalse_FilterReturn , kTrue_FilterReturn , kUnimplemented_FilterReturn }
 
- Protected Member Functions inherited from SkMaskFilterBase
 SkMaskFilterBase ()
 

Detailed Description

Definition at line 28 of file SkBlurMaskFilterImpl.h.

Constructor & Destructor Documentation

◆ SkBlurMaskFilterImpl()

SkBlurMaskFilterImpl::SkBlurMaskFilterImpl ( SkScalar  sigma,
SkBlurStyle  style,
bool  respectCTM 
)

Definition at line 50 of file SkBlurMaskFilterImpl.cpp.

51 : fSigma(sigma)
52 , fBlurStyle(style)
53 , fRespectCTM(respectCTM) {
54 SkASSERT(fSigma > 0);
55 SkASSERT((unsigned)style <= kLastEnum_SkBlurStyle);
56}
#define SkASSERT(cond)
Definition SkAssert.h:116
@ kLastEnum_SkBlurStyle
Definition SkBlurTypes.h:17

Member Function Documentation

◆ asABlur()

bool SkBlurMaskFilterImpl::asABlur ( BlurRec ) const
overridevirtual

If this filter can be represented by a BlurRec, return true and (if not null) fill in the provided BlurRec parameter. If this effect cannot be represented as a BlurRec, return false and ignore the BlurRec parameter.

Reimplemented from SkMaskFilterBase.

Definition at line 62 of file SkBlurMaskFilterImpl.cpp.

62 {
63 if (this->ignoreXform()) {
64 return false;
65 }
66
67 if (rec) {
68 rec->fSigma = fSigma;
69 rec->fStyle = fBlurStyle;
70 }
71 return true;
72}

◆ asImageFilter()

sk_sp< SkImageFilter > SkBlurMaskFilterImpl::asImageFilter ( const SkMatrix ctm) const
overridevirtual

Return an SkImageFilter representation of this mask filter that SkCanvas can apply to an alpha-only image to produce an equivalent effect to running the mask filter directly.

Reimplemented from SkMaskFilterBase.

Definition at line 74 of file SkBlurMaskFilterImpl.cpp.

74 {
75 float sigma = fSigma;
76 if (this->ignoreXform()) {
77 // This is analogous to computeXformedSigma(), but it might be more correct to wrap the
78 // blur image filter in a local matrix with ctm^-1, or to control the skif::Mapping when
79 // the mask filter layer is restored. This is inaccurate when 'ctm' has skew or perspective
80 const float ctmScaleFactor = fSigma / ctm.mapRadius(fSigma);
81 sigma *= ctmScaleFactor;
82 }
83
84 // The null input image filter will be bound to the original coverage mask.
86 // Combine the original coverage mask (src) and the blurred coverage mask (dst)
87 switch(fBlurStyle) {
88 case kInner_SkBlurStyle: // dst = dst * src
89 // = 0 * src + src * dst
90 return SkImageFilters::Blend(SkBlendMode::kDstIn, std::move(filter), nullptr);
91 case kSolid_SkBlurStyle: // dst = src + dst - src * dst
92 // = 1 * src + (1 - src) * dst
93 return SkImageFilters::Blend(SkBlendMode::kSrcOver, std::move(filter), nullptr);
94 case kOuter_SkBlurStyle: // dst = dst * (1 - src)
95 // = 0 * src + (1 - src) * dst
96 return SkImageFilters::Blend(SkBlendMode::kDstOut, std::move(filter), nullptr);
98 return filter;
99 }
101}
#define SkUNREACHABLE
Definition SkAssert.h:135
@ kDstIn
r = d * sa
@ kSrcOver
r = s + (1-sa)*d
@ kDstOut
r = d * (1-sa)
@ kOuter_SkBlurStyle
nothing inside, fuzzy outside
Definition SkBlurTypes.h:14
@ kSolid_SkBlurStyle
solid inside, fuzzy outside
Definition SkBlurTypes.h:13
@ kInner_SkBlurStyle
fuzzy inside, nothing outside
Definition SkBlurTypes.h:15
@ kNormal_SkBlurStyle
fuzzy inside and outside
Definition SkBlurTypes.h:12
static sk_sp< SkImageFilter > Blur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Blend(SkBlendMode mode, sk_sp< SkImageFilter > background, sk_sp< SkImageFilter > foreground=nullptr, const CropRect &cropRect={})
SkScalar mapRadius(SkScalar radius) const

◆ blurStyle()

SkBlurStyle SkBlurMaskFilterImpl::blurStyle ( ) const
inline

Definition at line 44 of file SkBlurMaskFilterImpl.h.

44{return fBlurStyle;}

◆ computeFastBounds()

void SkBlurMaskFilterImpl::computeFastBounds ( const SkRect src,
SkRect dest 
) const
overridevirtual

The fast bounds function is used to enable the paint to be culled early in the drawing pipeline. This function accepts the current bounds of the paint as its src param and the filter adjust those bounds using its current mask and returns the result using the dest param. Callers are allowed to provide the same struct for both src and dest so each implementation must accommodate that behavior.

The default impl calls filterMask with the src mask having no image, but subclasses may override this if they can compute the rect faster.

Reimplemented from SkMaskFilterBase.

Definition at line 506 of file SkBlurMaskFilterImpl.cpp.

507 {
508 // TODO: if we're doing kInner blur, should we return a different outset?
509 // i.e. pad == 0 ?
510
511 SkScalar pad = 3.0f * fSigma;
512
513 dst->setLTRB(src.fLeft - pad, src.fTop - pad,
514 src.fRight + pad, src.fBottom + pad);
515}
float SkScalar
Definition extension.cpp:12
dst
Definition cp.py:12

◆ computeXformedSigma()

SkScalar SkBlurMaskFilterImpl::computeXformedSigma ( const SkMatrix ctm) const

Definition at line 103 of file SkBlurMaskFilterImpl.cpp.

103 {
104 constexpr SkScalar kMaxBlurSigma = SkIntToScalar(128);
105 SkScalar xformedSigma = this->ignoreXform() ? fSigma : ctm.mapRadius(fSigma);
106 return std::min(xformedSigma, kMaxBlurSigma);
107}
#define SkIntToScalar(x)
Definition SkScalar.h:57

◆ filterMask()

bool SkBlurMaskFilterImpl::filterMask ( SkMaskBuilder dst,
const SkMask src,
const SkMatrix ,
SkIPoint margin 
) const
overridevirtual

Create a new mask by filter the src mask. If src.fImage == null, then do not allocate or create the dst image but do fill out the other fields in dstMask. If you do allocate a dst image, use SkMask::AllocImage() If this returns false, dst mask is ignored.

Parameters
dstthe result of the filter. If src.fImage == null, dst should not allocate its image
srcthe original image to be filtered.
matrixthe CTM
marginif not null, return the buffer dx/dy need when calculating the effect. Used when drawing a clipped object to know how much larger to allocate the src before applying the filter. If returning false, ignore this parameter.
Returns
true if the dst mask was correctly created.

Implements SkMaskFilterBase.

Definition at line 109 of file SkBlurMaskFilterImpl.cpp.

111 {
112 SkScalar sigma = this->computeXformedSigma(matrix);
113 return SkBlurMask::BoxBlur(dst, src, sigma, fBlurStyle, margin);
114}
SkScalar computeXformedSigma(const SkMatrix &ctm) const
static bool BoxBlur(SkMaskBuilder *dst, const SkMask &src, SkScalar sigma, SkBlurStyle style, SkIPoint *margin=nullptr)

◆ filterRectsToNine()

SkMaskFilterBase::FilterReturn SkBlurMaskFilterImpl::filterRectsToNine ( const SkRect  [],
int  count,
const SkMatrix ,
const SkIRect clipBounds,
SkTLazy< NinePatch > *   
) const
overrideprivatevirtual

Override if your subclass can filter a rect, and return the answer as a ninepatch mask to be stretched over the returned outerRect. On success return kTrue_FilterReturn. On failure (e.g. out of memory) return kFalse_FilterReturn. If the normal filterMask() entry-point should be called (the default) return kUnimplemented_FilterReturn.

By convention, the caller will take the center rol/col from the returned mask as the slice it can replicate horizontally and vertically as we stretch the mask to fit inside outerRect. It is an error for outerRect to be smaller than the mask's bounds. This would imply that the width and height of the mask should be odd. This is not required, just that the caller will call mask.fBounds.centerX() and centerY() to find the strips that will be replicated.

Reimplemented from SkMaskFilterBase.

Definition at line 381 of file SkBlurMaskFilterImpl.cpp.

384 {
385 if (count < 1 || count > 2) {
387 }
388
389 // TODO: report correct metrics for innerstyle, where we do not grow the
390 // total bounds, but we do need an inset the size of our blur-radius
391 if (kInner_SkBlurStyle == fBlurStyle || kOuter_SkBlurStyle == fBlurStyle) {
393 }
394
395 // TODO: take clipBounds into account to limit our coordinates up front
396 // for now, just skip too-large src rects (to take the old code path).
397 if (rect_exceeds(rects[0], SkIntToScalar(32767))) {
399 }
400
401 SkIPoint margin;
402 SkMaskBuilder srcM(nullptr, rects[0].roundOut(), 0, SkMask::kA8_Format), dstM;
403
404 bool filterResult = false;
405 if (count == 1 && c_analyticBlurNinepatch) {
406 // special case for fast rect blur
407 // don't actually do the blur the first time, just compute the correct size
408 filterResult = this->filterRectMask(&dstM, rects[0], matrix, &margin,
410 } else {
411 filterResult = this->filterMask(&dstM, srcM, matrix, &margin);
412 }
413
414 if (!filterResult) {
415 return kFalse_FilterReturn;
416 }
417
418 /*
419 * smallR is the smallest version of 'rect' that will still guarantee that
420 * we get the same blur results on all edges, plus 1 center row/col that is
421 * representative of the extendible/stretchable edges of the ninepatch.
422 * Since our actual edge may be fractional we inset 1 more to be sure we
423 * don't miss any interior blur.
424 * x is an added pixel of blur, and { and } are the (fractional) edge
425 * pixels from the original rect.
426 *
427 * x x { x x .... x x } x x
428 *
429 * Thus, in this case, we inset by a total of 5 (on each side) beginning
430 * with our outer-rect (dstM.fBounds)
431 */
432 SkRect smallR[2];
434
435 // +2 is from +1 for each edge (to account for possible fractional edges
436 int smallW = dstM.fBounds.width() - srcM.fBounds.width() + 2;
437 int smallH = dstM.fBounds.height() - srcM.fBounds.height() + 2;
438 SkIRect innerIR;
439
440 if (1 == count) {
441 innerIR = srcM.fBounds;
442 center.set(smallW, smallH);
443 } else {
444 SkASSERT(2 == count);
445 rects[1].roundIn(&innerIR);
446 center.set(smallW + (innerIR.left() - srcM.fBounds.left()),
447 smallH + (innerIR.top() - srcM.fBounds.top()));
448 }
449
450 // +1 so we get a clean, stretchable, center row/col
451 smallW += 1;
452 smallH += 1;
453
454 // we want the inset amounts to be integral, so we don't change any
455 // fractional phase on the fRight or fBottom of our smallR.
456 const SkScalar dx = SkIntToScalar(innerIR.width() - smallW);
457 const SkScalar dy = SkIntToScalar(innerIR.height() - smallH);
458 if (dx < 0 || dy < 0) {
459 // we're too small, relative to our blur, to break into nine-patch,
460 // so we ask to have our normal filterMask() be called.
462 }
463
464 smallR[0].setLTRB(rects[0].left(), rects[0].top(),
465 rects[0].right() - dx, rects[0].bottom() - dy);
466 if (smallR[0].width() < 2 || smallR[0].height() < 2) {
468 }
469 if (2 == count) {
470 smallR[1].setLTRB(rects[1].left(), rects[1].top(),
471 rects[1].right() - dx, rects[1].bottom() - dy);
472 SkASSERT(!smallR[1].isEmpty());
473 }
474
475 const SkScalar sigma = this->computeXformedSigma(matrix);
476 SkTLazy<SkMask> cachedMask;
477 SkCachedData* cache = find_cached_rects(&cachedMask, sigma, fBlurStyle, smallR, count);
478 if (!cache) {
479 SkMaskBuilder filterM;
480 if (count > 1 || !c_analyticBlurNinepatch) {
481 if (!draw_rects_into_mask(smallR, count, &srcM)) {
482 return kFalse_FilterReturn;
483 }
484
485 SkAutoMaskFreeImage amf(srcM.image());
486
487 if (!this->filterMask(&filterM, srcM, matrix, &margin)) {
488 return kFalse_FilterReturn;
489 }
490 } else {
491 if (!this->filterRectMask(&filterM, smallR[0], matrix, &margin,
493 return kFalse_FilterReturn;
494 }
495 }
496 cache = add_cached_rects(&filterM, sigma, fBlurStyle, smallR, count);
497 cachedMask.init(filterM);
498 }
499 SkIRect bounds = cachedMask->fBounds;
500 bounds.offsetTo(0, 0);
501 patch->init(SkMask{cachedMask->fImage, bounds, cachedMask->fRowBytes, cachedMask->fFormat},
502 dstM.fBounds, center, cache); // transfer ownership to patch
503 return kTrue_FilterReturn;
504}
int count
static SkCachedData * find_cached_rects(SkTLazy< SkMask > *mask, SkScalar sigma, SkBlurStyle style, const SkRect rects[], int count)
static bool rect_exceeds(const SkRect &r, SkScalar v)
static bool draw_rects_into_mask(const SkRect rects[], int count, SkMaskBuilder *mask)
static SkCachedData * add_cached_rects(SkMaskBuilder *mask, SkScalar sigma, SkBlurStyle style, const SkRect rects[], int count)
static const bool c_analyticBlurNinepatch
std::unique_ptr< uint8_t, SkFunctionObject< SkMaskBuilder::FreeImage > > SkAutoMaskFreeImage
Definition SkMask.h:316
static bool left(const SkPoint &p0, const SkPoint &p1)
static bool right(const SkPoint &p0, const SkPoint &p1)
static SkScalar center(float pos0, float pos1)
bool filterMask(SkMaskBuilder *dst, const SkMask &src, const SkMatrix &, SkIPoint *margin) const override
T * init(Args &&... args)
Definition SkTLazy.h:45
Optional< SkRect > bounds
Definition SkRecords.h:189
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
Definition SkRecords.h:208
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 Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port Allow the VM service to fallback to automatic port selection if binding to a specified port fails trace Trace early application lifecycle Automatically switches to an endless trace buffer trace skia Filters out all Skia trace event categories except those that are specified in this comma separated list dump skp on shader Automatically dump the skp that triggers new shader compilations This is useful for writing custom ShaderWarmUp to reduce jank By this is not enabled to reduce the overhead purge persistent cache
Definition switches.h:191
int32_t height
int32_t width
constexpr int32_t top() const
Definition SkRect.h:120
constexpr int32_t height() const
Definition SkRect.h:165
constexpr int32_t width() const
Definition SkRect.h:158
constexpr int32_t left() const
Definition SkRect.h:113
@ kComputeBoundsAndRenderImage_CreateMode
compute bounds, alloc image and render into it
Definition SkMask.h:301
@ kJustComputeBounds_CreateMode
compute bounds and return
Definition SkMask.h:299
@ kA8_Format
8bits per pixel mask (e.g. antialiasing)
Definition SkMask.h:28
const SkIRect fBounds
Definition SkMask.h:42
void setLTRB(float left, float top, float right, float bottom)
Definition SkRect.h:865

◆ filterRRectToNine()

SkMaskFilterBase::FilterReturn SkBlurMaskFilterImpl::filterRRectToNine ( const SkRRect ,
const SkMatrix ,
const SkIRect clipBounds,
SkTLazy< NinePatch > *   
) const
overrideprivatevirtual

Similar to filterRectsToNine, except it performs the work on a round rect.

Reimplemented from SkMaskFilterBase.

Definition at line 245 of file SkBlurMaskFilterImpl.cpp.

247 {
248 SkASSERT(patch != nullptr);
249 switch (rrect.getType()) {
251 // Nothing to draw.
252 return kFalse_FilterReturn;
253
255 // We should have caught this earlier.
256 SkASSERT(false);
257 [[fallthrough]];
259 // The nine patch special case does not handle ovals, and we
260 // already have code for rectangles.
262
263 // These three can take advantage of this fast path.
267 break;
268 }
269
270 // TODO: report correct metrics for innerstyle, where we do not grow the
271 // total bounds, but we do need an inset the size of our blur-radius
272 if (kInner_SkBlurStyle == fBlurStyle) {
274 }
275
276 // TODO: take clipBounds into account to limit our coordinates up front
277 // for now, just skip too-large src rects (to take the old code path).
278 if (rect_exceeds(rrect.rect(), SkIntToScalar(32767))) {
280 }
281
282 SkIPoint margin;
283 SkMaskBuilder srcM(nullptr, rrect.rect().roundOut(), 0, SkMask::kA8_Format), dstM;
284
285 bool filterResult = false;
287 // special case for fast round rect blur
288 // don't actually do the blur the first time, just compute the correct size
289 filterResult = this->filterRRectMask(&dstM, rrect, matrix, &margin,
291 }
292
293 if (!filterResult) {
294 filterResult = this->filterMask(&dstM, srcM, matrix, &margin);
295 }
296
297 if (!filterResult) {
298 return kFalse_FilterReturn;
299 }
300
301 // Now figure out the appropriate width and height of the smaller round rectangle
302 // to stretch. It will take into account the larger radius per side as well as double
303 // the margin, to account for inner and outer blur.
308
309 const SkScalar leftUnstretched = std::max(UL.fX, LL.fX) + SkIntToScalar(2 * margin.fX);
310 const SkScalar rightUnstretched = std::max(UR.fX, LR.fX) + SkIntToScalar(2 * margin.fX);
311
312 // Extra space in the middle to ensure an unchanging piece for stretching. Use 3 to cover
313 // any fractional space on either side plus 1 for the part to stretch.
314 const SkScalar stretchSize = SkIntToScalar(3);
315
316 const SkScalar totalSmallWidth = leftUnstretched + rightUnstretched + stretchSize;
317 if (totalSmallWidth >= rrect.rect().width()) {
318 // There is no valid piece to stretch.
320 }
321
322 const SkScalar topUnstretched = std::max(UL.fY, UR.fY) + SkIntToScalar(2 * margin.fY);
323 const SkScalar bottomUnstretched = std::max(LL.fY, LR.fY) + SkIntToScalar(2 * margin.fY);
324
325 const SkScalar totalSmallHeight = topUnstretched + bottomUnstretched + stretchSize;
326 if (totalSmallHeight >= rrect.rect().height()) {
327 // There is no valid piece to stretch.
329 }
330
331 SkRect smallR = SkRect::MakeWH(totalSmallWidth, totalSmallHeight);
332
333 SkRRect smallRR;
334 SkVector radii[4];
338 radii[SkRRect::kLowerLeft_Corner] = LL;
339 smallRR.setRectRadii(smallR, radii);
340
341 const SkScalar sigma = this->computeXformedSigma(matrix);
342 SkTLazy<SkMask> cachedMask;
343 SkCachedData* cache = find_cached_rrect(&cachedMask, sigma, fBlurStyle, smallRR);
344 if (!cache) {
345 SkMaskBuilder filterM;
346 bool analyticBlurWorked = false;
348 analyticBlurWorked =
349 this->filterRRectMask(&filterM, smallRR, matrix, &margin,
351 }
352
353 if (!analyticBlurWorked) {
354 if (!draw_rrect_into_mask(smallRR, &srcM)) {
355 return kFalse_FilterReturn;
356 }
357 SkAutoMaskFreeImage amf(srcM.image());
358
359 if (!this->filterMask(&filterM, srcM, matrix, &margin)) {
360 return kFalse_FilterReturn;
361 }
362 }
363 cache = add_cached_rrect(&filterM, sigma, fBlurStyle, smallRR);
364 cachedMask.init(filterM);
365 }
366
367 SkIRect bounds = cachedMask->fBounds;
368 bounds.offsetTo(0, 0);
369 patch->init(SkMask{cachedMask->fImage, bounds, cachedMask->fRowBytes, cachedMask->fFormat},
370 dstM.fBounds,
371 SkIPoint{SkScalarCeilToInt(leftUnstretched) + 1,
372 SkScalarCeilToInt(topUnstretched) + 1},
373 cache); // transfer ownership to patch
374 return kTrue_FilterReturn;
375}
static bool draw_rrect_into_mask(const SkRRect rrect, SkMaskBuilder *mask)
static SkCachedData * add_cached_rrect(SkMaskBuilder *mask, SkScalar sigma, SkBlurStyle style, const SkRRect &rrect)
static const bool c_analyticBlurRRect
static SkCachedData * find_cached_rrect(SkTLazy< SkMask > *mask, SkScalar sigma, SkBlurStyle style, const SkRRect &rrect)
#define SkScalarCeilToInt(x)
Definition SkScalar.h:36
Type getType() const
Definition SkRRect.h:76
const SkRect & rect() const
Definition SkRRect.h:264
SkVector radii(Corner corner) const
Definition SkRRect.h:271
@ kOval_Type
non-zero width and height filled with radii
Definition SkRRect.h:69
@ kSimple_Type
non-zero width and height with equal radii
Definition SkRRect.h:70
@ kEmpty_Type
zero width or height
Definition SkRRect.h:67
@ kNinePatch_Type
non-zero width and height with axis-aligned radii
Definition SkRRect.h:71
@ kRect_Type
non-zero width and height, and zeroed radii
Definition SkRRect.h:68
@ kComplex_Type
non-zero width and height with arbitrary radii
Definition SkRRect.h:72
@ kUpperLeft_Corner
index of top-left corner radii
Definition SkRRect.h:252
@ kLowerRight_Corner
index of bottom-right corner radii
Definition SkRRect.h:254
@ kUpperRight_Corner
index of top-right corner radii
Definition SkRRect.h:253
@ kLowerLeft_Corner
index of bottom-left corner radii
Definition SkRRect.h:255
void setRectRadii(const SkRect &rect, const SkVector radii[4])
Definition SkRRect.cpp:189
#define LR
SkRRect rrect
Definition SkRecords.h:232
int32_t fX
x-axis value
int32_t fY
y-axis value
float fX
x-axis value
float fY
y-axis value
void roundOut(SkIRect *dst) const
Definition SkRect.h:1241
constexpr float height() const
Definition SkRect.h:769
constexpr float width() const
Definition SkRect.h:762
static constexpr SkRect MakeWH(float w, float h)
Definition SkRect.h:609

◆ flatten()

void SkBlurMaskFilterImpl::flatten ( SkWriteBuffer ) const
overrideprivatevirtual

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 SkFlattenable.

Definition at line 527 of file SkBlurMaskFilterImpl.cpp.

527 {
528 buffer.writeScalar(fSigma);
529 buffer.writeUInt(fBlurStyle);
530 buffer.writeUInt(!fRespectCTM); // historically we recorded ignoreCTM
531}
static const uint8_t buffer[]

◆ getFormat()

SkMask::Format SkBlurMaskFilterImpl::getFormat ( ) const
overridevirtual

Returns the format of the resulting mask that this subclass will return when its filterMask() method is called.

Implements SkMaskFilterBase.

Definition at line 58 of file SkBlurMaskFilterImpl.cpp.

58 {
59 return SkMask::kA8_Format;
60}

◆ ignoreXform()

bool SkBlurMaskFilterImpl::ignoreXform ( ) const
inline

Definition at line 46 of file SkBlurMaskFilterImpl.h.

46{ return !fRespectCTM; }

◆ sigma()

SkScalar SkBlurMaskFilterImpl::sigma ( ) const
inline

Definition at line 45 of file SkBlurMaskFilterImpl.h.

45{return fSigma;}

◆ type()

SkMaskFilterBase::Type SkBlurMaskFilterImpl::type ( ) const
inlineoverridevirtual

Implements SkMaskFilterBase.

Definition at line 36 of file SkBlurMaskFilterImpl.h.

Friends And Related Symbol Documentation

◆ sk_register_blur_maskfilter_createproc

void sk_register_blur_maskfilter_createproc ( )
friend

◆ SkBlurMaskFilter

friend class SkBlurMaskFilter
friend

Definition at line 71 of file SkBlurMaskFilterImpl.h.


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