2 * Copyright 2014 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef SkPatchUtils_DEFINED
9 #define SkPatchUtils_DEFINED
11 #include "include/core/SkColor.h"
12 #include "include/core/SkRefCnt.h"
23 // Enums for control points based on the order specified in the constructor (clockwise).
31 * Get the points corresponding to the top cubic of cubics.
33 static void GetTopCubic(const SkPoint cubics[12], SkPoint points[4]);
36 * Get the points corresponding to the bottom cubic of cubics.
38 static void GetBottomCubic(const SkPoint cubics[12], SkPoint points[4]);
41 * Get the points corresponding to the left cubic of cubics.
43 static void GetLeftCubic(const SkPoint cubics[12], SkPoint points[4]);
46 * Get the points corresponding to the right cubic of cubics.
48 static void GetRightCubic(const SkPoint cubics[12], SkPoint points[4]);
51 * Method that calculates a level of detail (number of subdivisions) for a patch in both axis.
53 static SkISize GetLevelOfDetail(const SkPoint cubics[12], const SkMatrix* matrix);
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);