Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
SkShadowUtils.cpp File Reference
#include "include/utils/SkShadowUtils.h"
#include "include/core/SkBlendMode.h"
#include "include/core/SkBlender.h"
#include "include/core/SkBlurTypes.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColorFilter.h"
#include "include/core/SkMaskFilter.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPath.h"
#include "include/core/SkPoint.h"
#include "include/core/SkPoint3.h"
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkVertices.h"
#include "include/private/SkIDChangeListener.h"
#include "include/private/base/SkFloatingPoint.h"
#include "include/private/base/SkTPin.h"
#include "include/private/base/SkTemplates.h"
#include "include/private/base/SkTo.h"
#include "src/base/SkRandom.h"
#include "src/core/SkBlurMask.h"
#include "src/core/SkColorFilterPriv.h"
#include "src/core/SkDevice.h"
#include "src/core/SkDrawShadowInfo.h"
#include "src/core/SkPathPriv.h"
#include "src/core/SkResourceCache.h"
#include "src/core/SkVerticesPriv.h"
#include "src/utils/SkShadowTessellator.h"
#include <algorithm>
#include <cstring>
#include <functional>
#include <memory>
#include <new>
#include <utility>

Go to the source code of this file.

Functions

static bool tilted (const SkPoint3 &zPlaneParams)
 
static bool fill_shadow_rec (const SkPath &path, const SkPoint3 &zPlaneParams, const SkPoint3 &lightPos, SkScalar lightRadius, SkColor ambientColor, SkColor spotColor, uint32_t flags, const SkMatrix &ctm, SkDrawShadowRec *rec)
 
static bool validate_rec (const SkDrawShadowRec &rec)
 

Function Documentation

◆ fill_shadow_rec()

static bool fill_shadow_rec ( const SkPath path,
const SkPoint3 zPlaneParams,
const SkPoint3 lightPos,
SkScalar  lightRadius,
SkColor  ambientColor,
SkColor  spotColor,
uint32_t  flags,
const SkMatrix ctm,
SkDrawShadowRec rec 
)
static

Definition at line 533 of file SkShadowUtils.cpp.

536 {
537 SkPoint pt = { lightPos.fX, lightPos.fY };
539 // If light position is in device space, need to transform to local space
540 // before applying to SkCanvas.
541 SkMatrix inverse;
542 if (!ctm.invert(&inverse)) {
543 return false;
544 }
545 inverse.mapPoints(&pt, 1);
546 }
547
548 rec->fZPlaneParams = zPlaneParams;
549 rec->fLightPos = { pt.fX, pt.fY, lightPos.fZ };
550 rec->fLightRadius = lightRadius;
551 rec->fAmbientColor = ambientColor;
552 rec->fSpotColor = spotColor;
553 rec->fFlags = flags;
554
555 return true;
556}
@ kDirectionalLight_ShadowFlag
static constexpr bool SkToBool(const T &x)
Definition SkTo.h:35
void mapPoints(SkPoint dst[], const SkPoint src[], int count) const
Definition SkMatrix.cpp:770
bool invert(SkMatrix *inverse) const
Definition SkMatrix.h:1206
FlutterSemanticsFlag flags
SkScalar fX
Definition SkPoint3.h:16
SkScalar fZ
Definition SkPoint3.h:16
SkScalar fY
Definition SkPoint3.h:16
float fX
x-axis value
float fY
y-axis value

◆ tilted()

static bool tilted ( const SkPoint3 zPlaneParams)
static

Definition at line 473 of file SkShadowUtils.cpp.

473 {
474 return !SkScalarNearlyZero(zPlaneParams.fX) || !SkScalarNearlyZero(zPlaneParams.fY);
475}
static bool SkScalarNearlyZero(SkScalar x, SkScalar tolerance=SK_ScalarNearlyZero)
Definition SkScalar.h:101

◆ validate_rec()

static bool validate_rec ( const SkDrawShadowRec rec)
static

Definition at line 588 of file SkShadowUtils.cpp.

588 {
589 return rec.fLightPos.isFinite() && rec.fZPlaneParams.isFinite() &&
591}
static bool SkIsFinite(T x, Pack... values)
bool isFinite() const
Definition SkPoint3.h:116