1 /*
2  * Copyright 2018 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef SkBlurPriv_DEFINED
9 #define SkBlurPriv_DEFINED
10 
11 #include "include/core/SkRRect.h"
12 #include "include/core/SkSize.h"
13 
14 static const int kSkBlurRRectMaxDivisions = 6;
15 
16 // This method computes all the parameters for drawing a partially occluded nine-patched
17 // blurred rrect mask:
18 //   rrectToDraw - the integerized rrect to draw in the mask
19 //   widthHeight - how large to make the mask (rrectToDraw will be centered in this coord sys)
20 //   rectXs, rectYs - the x & y coordinates of the covering geometry lattice
21 //   texXs, texYs - the texture coordinate at each point in rectXs & rectYs
22 //   numXs, numYs - number of coordinates in the x & y directions
23 //   skipMask - bit mask that contains a 1-bit whenever one of the cells is occluded
24 // It returns true if 'devRRect' is nine-patchable
25 bool SkComputeBlurredRRectParams(const SkRRect& srcRRect, const SkRRect& devRRect,
26                                  const SkRect& occluder,
27                                  SkScalar sigma, SkScalar xformedSigma,
28                                  SkRRect* rrectToDraw,
29                                  SkISize* widthHeight,
30                                  SkScalar rectXs[kSkBlurRRectMaxDivisions],
31                                  SkScalar rectYs[kSkBlurRRectMaxDivisions],
32                                  SkScalar texXs[kSkBlurRRectMaxDivisions],
33                                  SkScalar texYs[kSkBlurRRectMaxDivisions],
34                                  int* numXs, int* numYs, uint32_t* skipMask);
35 
36 extern void sk_register_blur_maskfilter_createproc();
37 
38 #endif
39