Flutter Engine
The Flutter Engine
SkPatchUtils.h
Go to the documentation of this file.
1/*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkPatchUtils_DEFINED
9#define SkPatchUtils_DEFINED
10
13
14class SkColorSpace;
15class SkMatrix;
16class SkVertices;
17struct SkISize;
18struct SkPoint;
19
21
22public:
23 // Enums for control points based on the order specified in the constructor (clockwise).
24 enum {
27 kNumPtsCubic = 4
28 };
29
30 /**
31 * Get the points corresponding to the top cubic of cubics.
32 */
33 static void GetTopCubic(const SkPoint cubics[12], SkPoint points[4]);
34
35 /**
36 * Get the points corresponding to the bottom cubic of cubics.
37 */
38 static void GetBottomCubic(const SkPoint cubics[12], SkPoint points[4]);
39
40 /**
41 * Get the points corresponding to the left cubic of cubics.
42 */
43 static void GetLeftCubic(const SkPoint cubics[12], SkPoint points[4]);
44
45 /**
46 * Get the points corresponding to the right cubic of cubics.
47 */
48 static void GetRightCubic(const SkPoint cubics[12], SkPoint points[4]);
49
50 /**
51 * Method that calculates a level of detail (number of subdivisions) for a patch in both axis.
52 */
53 static SkISize GetLevelOfDetail(const SkPoint cubics[12], const SkMatrix* matrix);
54
55 static sk_sp<SkVertices> MakeVertices(const SkPoint cubics[12], const SkColor colors[4],
56 const SkPoint texCoords[4], int lodX, int lodY,
57 SkColorSpace* colorSpace = nullptr);
58};
59
60#endif
static const int points[]
uint32_t SkColor
Definition: SkColor.h:37
static void GetTopCubic(const SkPoint cubics[12], SkPoint points[4])
static void GetRightCubic(const SkPoint cubics[12], SkPoint points[4])
static sk_sp< SkVertices > MakeVertices(const SkPoint cubics[12], const SkColor colors[4], const SkPoint texCoords[4], int lodX, int lodY, SkColorSpace *colorSpace=nullptr)
static void GetLeftCubic(const SkPoint cubics[12], SkPoint points[4])
static SkISize GetLevelOfDetail(const SkPoint cubics[12], const SkMatrix *matrix)
static void GetBottomCubic(const SkPoint cubics[12], SkPoint points[4])
unsigned useCenter Optional< SkMatrix > matrix
Definition: SkRecords.h:258
PODArray< SkColor > colors
Definition: SkRecords.h:276
Definition: SkSize.h:16