Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
SkRRect.cpp File Reference
#include "include/core/SkRRect.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRect.h"
#include "include/core/SkScalar.h"
#include "include/core/SkString.h"
#include "include/core/SkTypes.h"
#include "include/private/base/SkDebug.h"
#include "include/private/base/SkFloatingPoint.h"
#include "src/base/SkBuffer.h"
#include "src/core/SkRRectPriv.h"
#include "src/core/SkRectPriv.h"
#include "src/core/SkScaleToSides.h"
#include "src/core/SkStringUtils.h"
#include <algorithm>
#include <cstring>
#include <iterator>

Go to the source code of this file.

Functions

static bool clamp_to_zero (SkVector radii[4])
 
static bool radii_are_nine_patch (const SkVector radii[4])
 
static double compute_min_scale (double rad1, double rad2, double limit, double curMin)
 
static void flush_to_zero (SkScalar &a, SkScalar &b)
 
static bool are_radius_check_predicates_valid (SkScalar rad, SkScalar min, SkScalar max)
 

Function Documentation

◆ are_radius_check_predicates_valid()

static bool are_radius_check_predicates_valid ( SkScalar  rad,
SkScalar  min,
SkScalar  max 
)
static

We need all combinations of predicates to be true to have a "safe" radius value.

Definition at line 658 of file SkRRect.cpp.

658 {
659 return (min <= max) && (rad <= max - min) && (min + rad <= max) && (max - rad >= min) &&
660 rad >= 0;
661}
static float max(float r, float g, float b)
Definition hsl.cpp:49
static float min(float r, float g, float b)
Definition hsl.cpp:48

◆ clamp_to_zero()

static bool clamp_to_zero ( SkVector  radii[4])
static

Definition at line 88 of file SkRRect.cpp.

88 {
89 bool allCornersSquare = true;
90
91 // Clamp negative radii to zero
92 for (int i = 0; i < 4; ++i) {
93 if (radii[i].fX <= 0 || radii[i].fY <= 0) {
94 // In this case we are being a little fast & loose. Since one of
95 // the radii is 0 the corner is square. However, the other radii
96 // could still be non-zero and play in the global scale factor
97 // computation.
98 radii[i].fX = 0;
99 radii[i].fY = 0;
100 } else {
101 allCornersSquare = false;
102 }
103 }
104
105 return allCornersSquare;
106}
float fX
x-axis value
float fY
y-axis value

◆ compute_min_scale()

static double compute_min_scale ( double  rad1,
double  rad2,
double  limit,
double  curMin 
)
static

Definition at line 182 of file SkRRect.cpp.

182 {
183 if ((rad1 + rad2) > limit) {
184 return std::min(curMin, limit / (rad1 + rad2));
185 }
186 return curMin;
187}

◆ flush_to_zero()

static void flush_to_zero ( SkScalar a,
SkScalar b 
)
static

Definition at line 232 of file SkRRect.cpp.

232 {
233 SkASSERT(a >= 0);
234 SkASSERT(b >= 0);
235 if (a + b == a) {
236 b = 0;
237 } else if (a + b == b) {
238 a = 0;
239 }
240}
#define SkASSERT(cond)
Definition SkAssert.h:116
static bool b
struct MyStruct a[10]

◆ radii_are_nine_patch()

static bool radii_are_nine_patch ( const SkVector  radii[4])
static

Definition at line 108 of file SkRRect.cpp.

108 {
113}
@ 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