Flutter Engine
The Flutter Engine
Functions
SkLinearGradient.cpp File Reference
#include "src/shaders/gradients/SkLinearGradient.h"
#include "include/core/SkColor.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkScalar.h"
#include "include/core/SkShader.h"
#include "include/effects/SkGradientShader.h"
#include "include/private/base/SkFloatingPoint.h"
#include "include/private/base/SkTArray.h"
#include "src/core/SkReadBuffer.h"
#include "src/core/SkWriteBuffer.h"
#include "src/shaders/SkShaderBase.h"
#include <cstdint>
#include <utility>

Go to the source code of this file.

Functions

static SkMatrix pts_to_unit_matrix (const SkPoint pts[2])
 
void SkRegisterLinearGradientShaderFlattenable ()
 

Function Documentation

◆ pts_to_unit_matrix()

static SkMatrix pts_to_unit_matrix ( const SkPoint  pts[2])
static

Definition at line 30 of file SkLinearGradient.cpp.

30 {
31 SkVector vec = pts[1] - pts[0];
32 SkScalar mag = vec.length();
33 SkScalar inv = mag ? SkScalarInvert(mag) : 0;
34
35 vec.scale(inv);
37 matrix.setSinCos(-vec.fY, vec.fX, pts[0].fX, pts[0].fY);
38 matrix.postTranslate(-pts[0].fX, -pts[0].fY);
39 matrix.postScale(inv, inv);
40 return matrix;
41}
static SkM44 inv(const SkM44 &m)
Definition: 3d.cpp:26
#define SkScalarInvert(x)
Definition: SkScalar.h:73
float SkScalar
Definition: extension.cpp:12
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
float fX
x-axis value
Definition: SkPoint_impl.h:164
float length() const
Definition: SkPoint_impl.h:282
void scale(float scale, SkPoint *dst) const
Definition: SkPoint.cpp:17
float fY
y-axis value
Definition: SkPoint_impl.h:165

◆ SkRegisterLinearGradientShaderFlattenable()

void SkRegisterLinearGradientShaderFlattenable ( )

Definition at line 144 of file SkLinearGradient.cpp.

144 {
146}
#define SK_REGISTER_FLATTENABLE(type)