Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Functions | Variables
GrRRectEffect.cpp File Reference
#include "src/gpu/ganesh/effects/GrRRectEffect.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRRect.h"
#include "include/core/SkRect.h"
#include "include/core/SkScalar.h"
#include "include/core/SkString.h"
#include "include/private/base/SkAssert.h"
#include "include/private/gpu/ganesh/GrTypesPriv.h"
#include "src/base/SkRandom.h"
#include "src/base/SkTLazy.h"
#include "src/core/SkRRectPriv.h"
#include "src/core/SkSLTypeShared.h"
#include "src/gpu/KeyBuilder.h"
#include "src/gpu/ganesh/GrCaps.h"
#include "src/gpu/ganesh/GrFragmentProcessor.h"
#include "src/gpu/ganesh/GrProcessorUnitTest.h"
#include "src/gpu/ganesh/GrShaderCaps.h"
#include "src/gpu/ganesh/effects/GrOvalEffect.h"
#include "src/gpu/ganesh/glsl/GrGLSLFragmentShaderBuilder.h"
#include "src/gpu/ganesh/glsl/GrGLSLProgramDataManager.h"
#include "src/gpu/ganesh/glsl/GrGLSLUniformHandler.h"
#include <algorithm>
#include <cstdint>
#include <tuple>
#include <utility>

Go to the source code of this file.

Classes

class  CircularRRectEffect::Impl
 
class  EllipticalRRectEffect::Impl
 

Functions

static bool elliptical_effect_uses_scale (const GrShaderCaps &caps, const SkRRect &rrect)
 

Variables

static const SkScalar kRadiusMin = SK_ScalarHalf
 

Function Documentation

◆ elliptical_effect_uses_scale()

static bool elliptical_effect_uses_scale ( const GrShaderCaps caps,
const SkRRect rrect 
)
static

Definition at line 513 of file GrRRectEffect.cpp.

513 {
514 // Keep shaders consistent across varying radii when in reduced shader mode.
515 if (caps.fReducedShaderMode) {
516 return true;
517 }
518 // If we're on a device where float != fp32 then we'll do the distance computation in a space
519 // that is normalized by the largest radius. The scale uniform will be scale, 1/scale. The
520 // radii uniform values are already in this normalized space.
521 if (!caps.fFloatIs32Bits) {
522 return true;
523 }
524 // Additionally, even if we have fp32, large radii can underflow 1/radii^2 terms leading to
525 // blurry coverage. This effect applies to simple and nine-patch, so only need to check TL+BR
528 float maxRadius = std::max(std::max(r0.fX, r0.fY), std::max(r1.fX, r1.fY));
529 return SkScalarNearlyZero(1.f / (maxRadius * maxRadius));
530}
static bool SkScalarNearlyZero(SkScalar x, SkScalar tolerance=SK_ScalarNearlyZero)
Definition SkScalar.h:101
SkVector radii(Corner corner) const
Definition SkRRect.h:271
@ kUpperLeft_Corner
index of top-left corner radii
Definition SkRRect.h:252
@ kLowerRight_Corner
index of bottom-right corner radii
Definition SkRRect.h:254
SkRRect rrect
Definition SkRecords.h:232
bool fReducedShaderMode
float fX
x-axis value
float fY
y-axis value

Variable Documentation

◆ kRadiusMin

const SkScalar kRadiusMin = SK_ScalarHalf
static

Definition at line 37 of file GrRRectEffect.cpp.