Flutter Engine
The Flutter Engine
Functions | Variables
SkBlurMask.cpp File Reference
#include "src/core/SkBlurMask.h"
#include "include/core/SkBlurTypes.h"
#include "include/core/SkColorPriv.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRect.h"
#include "include/private/base/SkMath.h"
#include "include/private/base/SkSafe32.h"
#include "include/private/base/SkTPin.h"
#include "include/private/base/SkTemplates.h"
#include "include/private/base/SkTo.h"
#include "src/base/SkMathPriv.h"
#include "src/core/SkMaskBlurFilter.h"
#include <cmath>
#include <cstring>
#include <utility>

Go to the source code of this file.

Functions

template<typename AlphaIter >
static void merge_src_with_blur (uint8_t dst[], int dstRB, AlphaIter src, int srcRB, const uint8_t blur[], int blurRB, int sw, int sh)
 
template<typename AlphaIter >
static void clamp_solid_with_orig (uint8_t dst[], int dstRowBytes, AlphaIter src, int srcRowBytes, int sw, int sh)
 
template<typename AlphaIter >
static void clamp_outer_with_orig (uint8_t dst[], int dstRowBytes, AlphaIter src, int srcRowBytes, int sw, int sh)
 
void SkMask_FreeImage (uint8_t *image)
 
static float gaussianIntegral (float x)
 

Variables

static const SkScalar kBLUR_SIGMA_SCALE = 0.57735f
 

Function Documentation

◆ clamp_outer_with_orig()

template<typename AlphaIter >
static void clamp_outer_with_orig ( uint8_t  dst[],
int  dstRowBytes,
AlphaIter  src,
int  srcRowBytes,
int  sw,
int  sh 
)
static

Definition at line 89 of file SkBlurMask.cpp.

91 {
92 int x;
93 while (--sh >= 0) {
94 AlphaIter rowSrc(src);
95 for (x = sw - 1; x >= 0; --x) {
96 int srcValue = *rowSrc;
97 if (srcValue) {
98 *dst = SkToU8(SkAlphaMul(*dst, SkAlpha255To256(255 - srcValue)));
99 }
100 ++dst;
101 ++rowSrc;
102 }
103 dst += dstRowBytes - sw;
104 src >>= srcRowBytes;
105 }
106}
#define SkAlphaMul(value, alpha256)
Definition: SkColorPriv.h:34
static unsigned SkAlpha255To256(U8CPU alpha)
Definition: SkColorPriv.h:24
constexpr uint8_t SkToU8(S x)
Definition: SkTo.h:22
double x
dst
Definition: cp.py:12
sh
Definition: run_sh.py:10

◆ clamp_solid_with_orig()

template<typename AlphaIter >
static void clamp_solid_with_orig ( uint8_t  dst[],
int  dstRowBytes,
AlphaIter  src,
int  srcRowBytes,
int  sw,
int  sh 
)
static

Definition at line 70 of file SkBlurMask.cpp.

72 {
73 int x;
74 while (--sh >= 0) {
75 AlphaIter rowSrc(src);
76 for (x = sw - 1; x >= 0; --x) {
77 int s = *rowSrc;
78 int d = *dst;
79 *dst = SkToU8(s + d - SkMulDiv255Round(s, d));
80 ++dst;
81 ++rowSrc;
82 }
83 dst += dstRowBytes - sw;
84 src >>= srcRowBytes;
85 }
86}
static U8CPU SkMulDiv255Round(U16CPU a, U16CPU b)
Definition: SkMath.h:73
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition: main.cc:19
struct MyStruct s

◆ gaussianIntegral()

static float gaussianIntegral ( float  x)
static

Definition at line 321 of file SkBlurMask.cpp.

321 {
322 if (x > 1.5f) {
323 return 0.0f;
324 }
325 if (x < -1.5f) {
326 return 1.0f;
327 }
328
329 float x2 = x*x;
330 float x3 = x2*x;
331
332 if ( x > 0.5f ) {
333 return 0.5625f - (x3 / 6.0f - 3.0f * x2 * 0.25f + 1.125f * x);
334 }
335 if ( x > -0.5f ) {
336 return 0.5f - (0.75f * x - x3 / 3.0f);
337 }
338 return 0.4375f + (-x3 / 6.0f - 3.0f * x2 * 0.25f - 1.125f * x);
339}

◆ merge_src_with_blur()

template<typename AlphaIter >
static void merge_src_with_blur ( uint8_t  dst[],
int  dstRB,
AlphaIter  src,
int  srcRB,
const uint8_t  blur[],
int  blurRB,
int  sw,
int  sh 
)
static

Definition at line 49 of file SkBlurMask.cpp.

52 {
53 dstRB -= sw;
54 blurRB -= sw;
55 while (--sh >= 0) {
56 AlphaIter rowSrc(src);
57 for (int x = sw - 1; x >= 0; --x) {
58 *dst = SkToU8(SkAlphaMul(*blur, SkAlpha255To256(*rowSrc)));
59 ++dst;
60 ++rowSrc;
61 ++blur;
62 }
63 dst += dstRB;
64 src >>= srcRB;
65 blur += blurRB;
66 }
67}

◆ SkMask_FreeImage()

void SkMask_FreeImage ( uint8_t *  image)

Definition at line 112 of file SkBlurMask.cpp.

112 {
114}
sk_sp< const SkImage > image
Definition: SkRecords.h:269
static void FreeImage(void *image)
Definition: SkMask.cpp:57

Variable Documentation

◆ kBLUR_SIGMA_SCALE

const SkScalar kBLUR_SIGMA_SCALE = 0.57735f
static

Definition at line 37 of file SkBlurMask.cpp.