Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Functions | Variables
SkPatchUtils.cpp File Reference
#include "src/utils/SkPatchUtils.h"
#include "include/core/SkAlphaType.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkColorType.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPoint.h"
#include "include/core/SkScalar.h"
#include "include/core/SkSize.h"
#include "include/core/SkTypes.h"
#include "include/core/SkVertices.h"
#include "include/private/SkColorData.h"
#include "include/private/base/SkFloatingPoint.h"
#include "include/private/base/SkMath.h"
#include "include/private/base/SkTPin.h"
#include "include/private/base/SkTo.h"
#include "src/base/SkArenaAlloc.h"
#include "src/base/SkVx.h"
#include "src/core/SkColorSpacePriv.h"
#include "src/core/SkConvertPixels.h"
#include "src/core/SkGeometry.h"
#include <algorithm>
#include <cstdint>
#include <cstring>

Go to the source code of this file.

Classes

class  FwDCubicEvaluator
 

Functions

static SkScalar approx_arc_length (const SkPoint points[], int count)
 
static SkScalar bilerp (SkScalar tx, SkScalar ty, SkScalar c00, SkScalar c10, SkScalar c01, SkScalar c11)
 
static skvx::float4 bilerp (SkScalar tx, SkScalar ty, const skvx::float4 &c00, const skvx::float4 &c10, const skvx::float4 &c01, const skvx::float4 &c11)
 
static void skcolor_to_float (SkPMColor4f *dst, const SkColor *src, int count, SkColorSpace *dstCS)
 
static void float_to_skcolor (SkColor *dst, const SkPMColor4f *src, int count, SkColorSpace *srcCS)
 

Variables

static const int kPartitionSize = 10
 

Function Documentation

◆ approx_arc_length()

static SkScalar approx_arc_length ( const SkPoint  points[],
int  count 
)
static

Calculate the approximate arc length given a bezier curve's control points. Returns -1 if bad calc (i.e. non-finite)

Definition at line 154 of file SkPatchUtils.cpp.

154 {
155 if (count < 2) {
156 return 0;
157 }
158 SkScalar arcLength = 0;
159 for (int i = 0; i < count - 1; i++) {
160 arcLength += SkPoint::Distance(points[i], points[i + 1]);
161 }
162 return SkIsFinite(arcLength) ? arcLength : -1;
163}
int count
static const int points[]
static bool SkIsFinite(T x, Pack... values)
float SkScalar
Definition extension.cpp:12
static float Distance(const SkPoint &a, const SkPoint &b)

◆ bilerp() [1/2]

static skvx::float4 bilerp ( SkScalar  tx,
SkScalar  ty,
const skvx::float4 c00,
const skvx::float4 c10,
const skvx::float4 c01,
const skvx::float4 c11 
)
static

Definition at line 172 of file SkPatchUtils.cpp.

176 {
177 auto a = c00 * (1.f - tx) + c10 * tx;
178 auto b = c01 * (1.f - tx) + c11 * tx;
179 return a * (1.f - ty) + b * ty;
180}
static bool b
struct MyStruct a[10]

◆ bilerp() [2/2]

static SkScalar bilerp ( SkScalar  tx,
SkScalar  ty,
SkScalar  c00,
SkScalar  c10,
SkScalar  c01,
SkScalar  c11 
)
static

Definition at line 165 of file SkPatchUtils.cpp.

166 {
167 SkScalar a = c00 * (1.f - tx) + c10 * tx;
168 SkScalar b = c01 * (1.f - tx) + c11 * tx;
169 return a * (1.f - ty) + b * ty;
170}

◆ float_to_skcolor()

static void float_to_skcolor ( SkColor dst,
const SkPMColor4f src,
int  count,
SkColorSpace srcCS 
)
static

Definition at line 248 of file SkPatchUtils.cpp.

248 {
253 SkAssertResult(SkConvertPixels(dstInfo, dst, 0, srcInfo, src, 0));
254}
kUnpremul_SkAlphaType
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition SkAlphaType.h:29
#define SkAssertResult(cond)
Definition SkAssert.h:123
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
Definition SkColorType.h:26
@ kRGBA_F32_SkColorType
pixel using C float for red, green, blue, alpha; in 128-bit word
Definition SkColorType.h:40
bool SkConvertPixels(const SkImageInfo &dstInfo, void *dstPixels, size_t dstRB, const SkImageInfo &srcInfo, const void *srcPixels, size_t srcRB)
sk_sp< T > sk_ref_sp(T *obj)
Definition SkRefCnt.h:381
static sk_sp< SkColorSpace > MakeSRGB()
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)

◆ skcolor_to_float()

static void skcolor_to_float ( SkPMColor4f dst,
const SkColor src,
int  count,
SkColorSpace dstCS 
)
static

Definition at line 240 of file SkPatchUtils.cpp.

Variable Documentation

◆ kPartitionSize

const int kPartitionSize = 10
static

Definition at line 148 of file SkPatchUtils.cpp.