hide most details of SkPatchUtils
relies on https://googleplex-android-review.git.corp.google.com/#/c/2060523/ landing first Bug: skia: Change-Id: Ic6dc8e53656a7190a32cfb3b0b2abd9ee6dbebf0 Reviewed-on: https://skia-review.googlesource.com/11351 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
ee805329bf
commit
4ebb43e94f
@ -24,13 +24,13 @@ static void draw_control_points(SkCanvas* canvas, const SkPoint cubics[12]) {
|
||||
//draw control points
|
||||
SkPaint paint;
|
||||
SkPoint bottom[SkPatchUtils::kNumPtsCubic];
|
||||
SkPatchUtils::getBottomCubic(cubics, bottom);
|
||||
SkPatchUtils::GetBottomCubic(cubics, bottom);
|
||||
SkPoint top[SkPatchUtils::kNumPtsCubic];
|
||||
SkPatchUtils::getTopCubic(cubics, top);
|
||||
SkPatchUtils::GetTopCubic(cubics, top);
|
||||
SkPoint left[SkPatchUtils::kNumPtsCubic];
|
||||
SkPatchUtils::getLeftCubic(cubics, left);
|
||||
SkPatchUtils::GetLeftCubic(cubics, left);
|
||||
SkPoint right[SkPatchUtils::kNumPtsCubic];
|
||||
SkPatchUtils::getRightCubic(cubics, right);
|
||||
SkPatchUtils::GetRightCubic(cubics, right);
|
||||
|
||||
paint.setColor(SK_ColorBLACK);
|
||||
paint.setStrokeWidth(0.5f);
|
||||
|
@ -16,13 +16,13 @@ static void draw_control_points(SkCanvas* canvas, const SkPoint cubics[12]) {
|
||||
//draw control points
|
||||
SkPaint paint;
|
||||
SkPoint bottom[SkPatchUtils::kNumPtsCubic];
|
||||
SkPatchUtils::getBottomCubic(cubics, bottom);
|
||||
SkPatchUtils::GetBottomCubic(cubics, bottom);
|
||||
SkPoint top[SkPatchUtils::kNumPtsCubic];
|
||||
SkPatchUtils::getTopCubic(cubics, top);
|
||||
SkPatchUtils::GetTopCubic(cubics, top);
|
||||
SkPoint left[SkPatchUtils::kNumPtsCubic];
|
||||
SkPatchUtils::getLeftCubic(cubics, left);
|
||||
SkPatchUtils::GetLeftCubic(cubics, left);
|
||||
SkPoint right[SkPatchUtils::kNumPtsCubic];
|
||||
SkPatchUtils::getRightCubic(cubics, right);
|
||||
SkPatchUtils::GetRightCubic(cubics, right);
|
||||
|
||||
paint.setColor(SK_ColorBLACK);
|
||||
paint.setStrokeWidth(0.5f);
|
||||
|
@ -126,8 +126,6 @@ void SkBaseDevice::drawDRRect(const SkRRect& outer,
|
||||
|
||||
void SkBaseDevice::drawPatch(const SkPoint cubics[12], const SkColor colors[4],
|
||||
const SkPoint texCoords[4], SkBlendMode bmode, const SkPaint& paint) {
|
||||
SkPatchUtils::VertexData data;
|
||||
|
||||
SkISize lod = SkPatchUtils::GetLevelOfDetail(cubics, &this->ctm());
|
||||
auto vertices = SkPatchUtils::MakeVertices(cubics, colors, texCoords, lod.width(), lod.height());
|
||||
if (vertices) {
|
||||
|
@ -478,14 +478,10 @@ void SkDumpCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4]
|
||||
this->dump(kDrawPatch_Verb, &paint, "drawPatch(Vertices{[%f, %f], [%f, %f], [%f, %f], [%f, %f]}\
|
||||
| Colors{[0x%x], [0x%x], [0x%x], [0x%x]} | TexCoords{[%f,%f], [%f,%f], [%f,%f], \
|
||||
[%f,%f]})",
|
||||
cubics[SkPatchUtils::kTopP0_CubicCtrlPts].fX,
|
||||
cubics[SkPatchUtils::kTopP0_CubicCtrlPts].fY,
|
||||
cubics[SkPatchUtils::kTopP3_CubicCtrlPts].fX,
|
||||
cubics[SkPatchUtils::kTopP3_CubicCtrlPts].fY,
|
||||
cubics[SkPatchUtils::kBottomP3_CubicCtrlPts].fX,
|
||||
cubics[SkPatchUtils::kBottomP3_CubicCtrlPts].fY,
|
||||
cubics[SkPatchUtils::kBottomP0_CubicCtrlPts].fX,
|
||||
cubics[SkPatchUtils::kBottomP0_CubicCtrlPts].fY,
|
||||
cubics[0].fX, cubics[0].fY,
|
||||
cubics[3].fX, cubics[3].fY,
|
||||
cubics[6].fX, cubics[6].fY,
|
||||
cubics[9].fX, cubics[9].fY,
|
||||
colors[0], colors[1], colors[2], colors[3],
|
||||
texCoords[0].x(), texCoords[0].y(), texCoords[1].x(), texCoords[1].y(),
|
||||
texCoords[2].x(), texCoords[2].y(), texCoords[3].x(), texCoords[3].y());
|
||||
|
@ -10,6 +10,38 @@
|
||||
#include "SkColorPriv.h"
|
||||
#include "SkGeometry.h"
|
||||
|
||||
namespace {
|
||||
enum CubicCtrlPts {
|
||||
kTopP0_CubicCtrlPts = 0,
|
||||
kTopP1_CubicCtrlPts = 1,
|
||||
kTopP2_CubicCtrlPts = 2,
|
||||
kTopP3_CubicCtrlPts = 3,
|
||||
|
||||
kRightP0_CubicCtrlPts = 3,
|
||||
kRightP1_CubicCtrlPts = 4,
|
||||
kRightP2_CubicCtrlPts = 5,
|
||||
kRightP3_CubicCtrlPts = 6,
|
||||
|
||||
kBottomP0_CubicCtrlPts = 9,
|
||||
kBottomP1_CubicCtrlPts = 8,
|
||||
kBottomP2_CubicCtrlPts = 7,
|
||||
kBottomP3_CubicCtrlPts = 6,
|
||||
|
||||
kLeftP0_CubicCtrlPts = 0,
|
||||
kLeftP1_CubicCtrlPts = 11,
|
||||
kLeftP2_CubicCtrlPts = 10,
|
||||
kLeftP3_CubicCtrlPts = 9,
|
||||
};
|
||||
|
||||
// Enum for corner also clockwise.
|
||||
enum Corner {
|
||||
kTopLeft_Corner = 0,
|
||||
kTopRight_Corner,
|
||||
kBottomRight_Corner,
|
||||
kBottomLeft_Corner
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluator to sample the values of a cubic bezier using forward differences.
|
||||
* Forward differences is a method for evaluating a nth degree polynomial at a uniform step by only
|
||||
@ -118,19 +150,19 @@ SkISize SkPatchUtils::GetLevelOfDetail(const SkPoint cubics[12], const SkMatrix*
|
||||
|
||||
// Approximate length of each cubic.
|
||||
SkPoint pts[kNumPtsCubic];
|
||||
SkPatchUtils::getTopCubic(cubics, pts);
|
||||
SkPatchUtils::GetTopCubic(cubics, pts);
|
||||
matrix->mapPoints(pts, kNumPtsCubic);
|
||||
SkScalar topLength = approx_arc_length(pts, kNumPtsCubic);
|
||||
|
||||
SkPatchUtils::getBottomCubic(cubics, pts);
|
||||
SkPatchUtils::GetBottomCubic(cubics, pts);
|
||||
matrix->mapPoints(pts, kNumPtsCubic);
|
||||
SkScalar bottomLength = approx_arc_length(pts, kNumPtsCubic);
|
||||
|
||||
SkPatchUtils::getLeftCubic(cubics, pts);
|
||||
SkPatchUtils::GetLeftCubic(cubics, pts);
|
||||
matrix->mapPoints(pts, kNumPtsCubic);
|
||||
SkScalar leftLength = approx_arc_length(pts, kNumPtsCubic);
|
||||
|
||||
SkPatchUtils::getRightCubic(cubics, pts);
|
||||
SkPatchUtils::GetRightCubic(cubics, pts);
|
||||
matrix->mapPoints(pts, kNumPtsCubic);
|
||||
SkScalar rightLength = approx_arc_length(pts, kNumPtsCubic);
|
||||
|
||||
@ -141,177 +173,34 @@ SkISize SkPatchUtils::GetLevelOfDetail(const SkPoint cubics[12], const SkMatrix*
|
||||
return SkISize::Make(SkMax32(8, lodX), SkMax32(8, lodY));
|
||||
}
|
||||
|
||||
void SkPatchUtils::getTopCubic(const SkPoint cubics[12], SkPoint points[4]) {
|
||||
void SkPatchUtils::GetTopCubic(const SkPoint cubics[12], SkPoint points[4]) {
|
||||
points[0] = cubics[kTopP0_CubicCtrlPts];
|
||||
points[1] = cubics[kTopP1_CubicCtrlPts];
|
||||
points[2] = cubics[kTopP2_CubicCtrlPts];
|
||||
points[3] = cubics[kTopP3_CubicCtrlPts];
|
||||
}
|
||||
|
||||
void SkPatchUtils::getBottomCubic(const SkPoint cubics[12], SkPoint points[4]) {
|
||||
void SkPatchUtils::GetBottomCubic(const SkPoint cubics[12], SkPoint points[4]) {
|
||||
points[0] = cubics[kBottomP0_CubicCtrlPts];
|
||||
points[1] = cubics[kBottomP1_CubicCtrlPts];
|
||||
points[2] = cubics[kBottomP2_CubicCtrlPts];
|
||||
points[3] = cubics[kBottomP3_CubicCtrlPts];
|
||||
}
|
||||
|
||||
void SkPatchUtils::getLeftCubic(const SkPoint cubics[12], SkPoint points[4]) {
|
||||
void SkPatchUtils::GetLeftCubic(const SkPoint cubics[12], SkPoint points[4]) {
|
||||
points[0] = cubics[kLeftP0_CubicCtrlPts];
|
||||
points[1] = cubics[kLeftP1_CubicCtrlPts];
|
||||
points[2] = cubics[kLeftP2_CubicCtrlPts];
|
||||
points[3] = cubics[kLeftP3_CubicCtrlPts];
|
||||
}
|
||||
|
||||
void SkPatchUtils::getRightCubic(const SkPoint cubics[12], SkPoint points[4]) {
|
||||
void SkPatchUtils::GetRightCubic(const SkPoint cubics[12], SkPoint points[4]) {
|
||||
points[0] = cubics[kRightP0_CubicCtrlPts];
|
||||
points[1] = cubics[kRightP1_CubicCtrlPts];
|
||||
points[2] = cubics[kRightP2_CubicCtrlPts];
|
||||
points[3] = cubics[kRightP3_CubicCtrlPts];
|
||||
}
|
||||
|
||||
bool SkPatchUtils::getVertexData(SkPatchUtils::VertexData* data, const SkPoint cubics[12],
|
||||
const SkColor colors[4], const SkPoint texCoords[4], int lodX, int lodY) {
|
||||
if (lodX < 1 || lodY < 1 || nullptr == cubics || nullptr == data) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// check for overflow in multiplication
|
||||
const int64_t lodX64 = (lodX + 1),
|
||||
lodY64 = (lodY + 1),
|
||||
mult64 = lodX64 * lodY64;
|
||||
if (mult64 > SK_MaxS32) {
|
||||
return false;
|
||||
}
|
||||
data->fVertexCount = SkToS32(mult64);
|
||||
|
||||
// it is recommended to generate draw calls of no more than 65536 indices, so we never generate
|
||||
// more than 60000 indices. To accomplish that we resize the LOD and vertex count
|
||||
if (data->fVertexCount > 10000 || lodX > 200 || lodY > 200) {
|
||||
SkScalar weightX = static_cast<SkScalar>(lodX) / (lodX + lodY);
|
||||
SkScalar weightY = static_cast<SkScalar>(lodY) / (lodX + lodY);
|
||||
|
||||
// 200 comes from the 100 * 2 which is the max value of vertices because of the limit of
|
||||
// 60000 indices ( sqrt(60000 / 6) that comes from data->fIndexCount = lodX * lodY * 6)
|
||||
lodX = static_cast<int>(weightX * 200);
|
||||
lodY = static_cast<int>(weightY * 200);
|
||||
data->fVertexCount = (lodX + 1) * (lodY + 1);
|
||||
}
|
||||
data->fIndexCount = lodX * lodY * 6;
|
||||
|
||||
data->fPoints = new SkPoint[data->fVertexCount];
|
||||
data->fIndices = new uint16_t[data->fIndexCount];
|
||||
|
||||
// if colors is not null then create array for colors
|
||||
SkPMColor colorsPM[kNumCorners];
|
||||
if (colors) {
|
||||
// premultiply colors to avoid color bleeding.
|
||||
for (int i = 0; i < kNumCorners; i++) {
|
||||
colorsPM[i] = SkPreMultiplyColor(colors[i]);
|
||||
}
|
||||
data->fColors = new uint32_t[data->fVertexCount];
|
||||
}
|
||||
|
||||
// if texture coordinates are not null then create array for them
|
||||
if (texCoords) {
|
||||
data->fTexCoords = new SkPoint[data->fVertexCount];
|
||||
}
|
||||
|
||||
SkPoint pts[kNumPtsCubic];
|
||||
SkPatchUtils::getBottomCubic(cubics, pts);
|
||||
FwDCubicEvaluator fBottom(pts);
|
||||
SkPatchUtils::getTopCubic(cubics, pts);
|
||||
FwDCubicEvaluator fTop(pts);
|
||||
SkPatchUtils::getLeftCubic(cubics, pts);
|
||||
FwDCubicEvaluator fLeft(pts);
|
||||
SkPatchUtils::getRightCubic(cubics, pts);
|
||||
FwDCubicEvaluator fRight(pts);
|
||||
|
||||
fBottom.restart(lodX);
|
||||
fTop.restart(lodX);
|
||||
|
||||
SkScalar u = 0.0f;
|
||||
int stride = lodY + 1;
|
||||
for (int x = 0; x <= lodX; x++) {
|
||||
SkPoint bottom = fBottom.next(), top = fTop.next();
|
||||
fLeft.restart(lodY);
|
||||
fRight.restart(lodY);
|
||||
SkScalar v = 0.f;
|
||||
for (int y = 0; y <= lodY; y++) {
|
||||
int dataIndex = x * (lodY + 1) + y;
|
||||
|
||||
SkPoint left = fLeft.next(), right = fRight.next();
|
||||
|
||||
SkPoint s0 = SkPoint::Make((1.0f - v) * top.x() + v * bottom.x(),
|
||||
(1.0f - v) * top.y() + v * bottom.y());
|
||||
SkPoint s1 = SkPoint::Make((1.0f - u) * left.x() + u * right.x(),
|
||||
(1.0f - u) * left.y() + u * right.y());
|
||||
SkPoint s2 = SkPoint::Make(
|
||||
(1.0f - v) * ((1.0f - u) * fTop.getCtrlPoints()[0].x()
|
||||
+ u * fTop.getCtrlPoints()[3].x())
|
||||
+ v * ((1.0f - u) * fBottom.getCtrlPoints()[0].x()
|
||||
+ u * fBottom.getCtrlPoints()[3].x()),
|
||||
(1.0f - v) * ((1.0f - u) * fTop.getCtrlPoints()[0].y()
|
||||
+ u * fTop.getCtrlPoints()[3].y())
|
||||
+ v * ((1.0f - u) * fBottom.getCtrlPoints()[0].y()
|
||||
+ u * fBottom.getCtrlPoints()[3].y()));
|
||||
data->fPoints[dataIndex] = s0 + s1 - s2;
|
||||
|
||||
if (colors) {
|
||||
uint8_t a = uint8_t(bilerp(u, v,
|
||||
SkScalar(SkColorGetA(colorsPM[kTopLeft_Corner])),
|
||||
SkScalar(SkColorGetA(colorsPM[kTopRight_Corner])),
|
||||
SkScalar(SkColorGetA(colorsPM[kBottomLeft_Corner])),
|
||||
SkScalar(SkColorGetA(colorsPM[kBottomRight_Corner]))));
|
||||
uint8_t r = uint8_t(bilerp(u, v,
|
||||
SkScalar(SkColorGetR(colorsPM[kTopLeft_Corner])),
|
||||
SkScalar(SkColorGetR(colorsPM[kTopRight_Corner])),
|
||||
SkScalar(SkColorGetR(colorsPM[kBottomLeft_Corner])),
|
||||
SkScalar(SkColorGetR(colorsPM[kBottomRight_Corner]))));
|
||||
uint8_t g = uint8_t(bilerp(u, v,
|
||||
SkScalar(SkColorGetG(colorsPM[kTopLeft_Corner])),
|
||||
SkScalar(SkColorGetG(colorsPM[kTopRight_Corner])),
|
||||
SkScalar(SkColorGetG(colorsPM[kBottomLeft_Corner])),
|
||||
SkScalar(SkColorGetG(colorsPM[kBottomRight_Corner]))));
|
||||
uint8_t b = uint8_t(bilerp(u, v,
|
||||
SkScalar(SkColorGetB(colorsPM[kTopLeft_Corner])),
|
||||
SkScalar(SkColorGetB(colorsPM[kTopRight_Corner])),
|
||||
SkScalar(SkColorGetB(colorsPM[kBottomLeft_Corner])),
|
||||
SkScalar(SkColorGetB(colorsPM[kBottomRight_Corner]))));
|
||||
data->fColors[dataIndex] = SkPackARGB32(a,r,g,b);
|
||||
}
|
||||
|
||||
if (texCoords) {
|
||||
data->fTexCoords[dataIndex] = SkPoint::Make(
|
||||
bilerp(u, v, texCoords[kTopLeft_Corner].x(),
|
||||
texCoords[kTopRight_Corner].x(),
|
||||
texCoords[kBottomLeft_Corner].x(),
|
||||
texCoords[kBottomRight_Corner].x()),
|
||||
bilerp(u, v, texCoords[kTopLeft_Corner].y(),
|
||||
texCoords[kTopRight_Corner].y(),
|
||||
texCoords[kBottomLeft_Corner].y(),
|
||||
texCoords[kBottomRight_Corner].y()));
|
||||
|
||||
}
|
||||
|
||||
if(x < lodX && y < lodY) {
|
||||
int i = 6 * (x * lodY + y);
|
||||
data->fIndices[i] = x * stride + y;
|
||||
data->fIndices[i + 1] = x * stride + 1 + y;
|
||||
data->fIndices[i + 2] = (x + 1) * stride + 1 + y;
|
||||
data->fIndices[i + 3] = data->fIndices[i];
|
||||
data->fIndices[i + 4] = data->fIndices[i + 2];
|
||||
data->fIndices[i + 5] = (x + 1) * stride + y;
|
||||
}
|
||||
v = SkScalarClampMax(v + 1.f / lodY, 1);
|
||||
}
|
||||
u = SkScalarClampMax(u + 1.f / lodX, 1);
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
sk_sp<SkVertices> SkPatchUtils::MakeVertices(const SkPoint cubics[12], const SkColor srcColors[4],
|
||||
const SkPoint srcTexCoords[4], int lodX, int lodY) {
|
||||
if (lodX < 1 || lodY < 1 || nullptr == cubics) {
|
||||
@ -365,13 +254,13 @@ sk_sp<SkVertices> SkPatchUtils::MakeVertices(const SkPoint cubics[12], const SkC
|
||||
}
|
||||
|
||||
SkPoint pts[kNumPtsCubic];
|
||||
SkPatchUtils::getBottomCubic(cubics, pts);
|
||||
SkPatchUtils::GetBottomCubic(cubics, pts);
|
||||
FwDCubicEvaluator fBottom(pts);
|
||||
SkPatchUtils::getTopCubic(cubics, pts);
|
||||
SkPatchUtils::GetTopCubic(cubics, pts);
|
||||
FwDCubicEvaluator fTop(pts);
|
||||
SkPatchUtils::getLeftCubic(cubics, pts);
|
||||
SkPatchUtils::GetLeftCubic(cubics, pts);
|
||||
FwDCubicEvaluator fLeft(pts);
|
||||
SkPatchUtils::getRightCubic(cubics, pts);
|
||||
SkPatchUtils::GetRightCubic(cubics, pts);
|
||||
FwDCubicEvaluator fRight(pts);
|
||||
|
||||
fBottom.restart(lodX);
|
||||
|
@ -15,110 +15,37 @@
|
||||
class SK_API SkPatchUtils {
|
||||
|
||||
public:
|
||||
// DEPRECATED -- use MakeVertices()
|
||||
/**
|
||||
* Structure that holds the vertex data related to the tessellation of a patch. It is passed
|
||||
* as a parameter to the function getVertexData which sets the points, colors and texture
|
||||
* coordinates of the vertices and the indices for them to be drawn as triangles.
|
||||
*/
|
||||
struct VertexData {
|
||||
int fVertexCount, fIndexCount;
|
||||
SkPoint* fPoints;
|
||||
SkPoint* fTexCoords;
|
||||
uint32_t* fColors;
|
||||
uint16_t* fIndices;
|
||||
|
||||
VertexData()
|
||||
: fVertexCount(0)
|
||||
, fIndexCount(0)
|
||||
, fPoints(nullptr)
|
||||
, fTexCoords(nullptr)
|
||||
, fColors(nullptr)
|
||||
, fIndices(nullptr) { }
|
||||
|
||||
~VertexData() {
|
||||
delete[] fPoints;
|
||||
delete[] fTexCoords;
|
||||
delete[] fColors;
|
||||
delete[] fIndices;
|
||||
}
|
||||
};
|
||||
|
||||
// Enums for control points based on the order specified in the constructor (clockwise).
|
||||
enum CubicCtrlPts {
|
||||
kTopP0_CubicCtrlPts = 0,
|
||||
kTopP1_CubicCtrlPts = 1,
|
||||
kTopP2_CubicCtrlPts = 2,
|
||||
kTopP3_CubicCtrlPts = 3,
|
||||
|
||||
kRightP0_CubicCtrlPts = 3,
|
||||
kRightP1_CubicCtrlPts = 4,
|
||||
kRightP2_CubicCtrlPts = 5,
|
||||
kRightP3_CubicCtrlPts = 6,
|
||||
|
||||
kBottomP0_CubicCtrlPts = 9,
|
||||
kBottomP1_CubicCtrlPts = 8,
|
||||
kBottomP2_CubicCtrlPts = 7,
|
||||
kBottomP3_CubicCtrlPts = 6,
|
||||
|
||||
kLeftP0_CubicCtrlPts = 0,
|
||||
kLeftP1_CubicCtrlPts = 11,
|
||||
kLeftP2_CubicCtrlPts = 10,
|
||||
kLeftP3_CubicCtrlPts = 9,
|
||||
};
|
||||
|
||||
// Enum for corner also clockwise.
|
||||
enum Corner {
|
||||
kTopLeft_Corner = 0,
|
||||
kTopRight_Corner,
|
||||
kBottomRight_Corner,
|
||||
kBottomLeft_Corner
|
||||
};
|
||||
|
||||
enum {
|
||||
kNumCtrlPts = 12,
|
||||
kNumCorners = 4,
|
||||
kNumPtsCubic = 4
|
||||
};
|
||||
|
||||
/**
|
||||
* Method that calculates a level of detail (number of subdivisions) for a patch in both axis.
|
||||
*/
|
||||
static SkISize GetLevelOfDetail(const SkPoint cubics[12], const SkMatrix* matrix);
|
||||
|
||||
/**
|
||||
* Get the points corresponding to the top cubic of cubics.
|
||||
*/
|
||||
static void getTopCubic(const SkPoint cubics[12], SkPoint points[4]);
|
||||
static void GetTopCubic(const SkPoint cubics[12], SkPoint points[4]);
|
||||
|
||||
/**
|
||||
* Get the points corresponding to the bottom cubic of cubics.
|
||||
*/
|
||||
static void getBottomCubic(const SkPoint cubics[12], SkPoint points[4]);
|
||||
static void GetBottomCubic(const SkPoint cubics[12], SkPoint points[4]);
|
||||
|
||||
/**
|
||||
* Get the points corresponding to the left cubic of cubics.
|
||||
*/
|
||||
static void getLeftCubic(const SkPoint cubics[12], SkPoint points[4]);
|
||||
static void GetLeftCubic(const SkPoint cubics[12], SkPoint points[4]);
|
||||
|
||||
/**
|
||||
* Get the points corresponding to the right cubic of cubics.
|
||||
*/
|
||||
static void getRightCubic(const SkPoint cubics[12], SkPoint points[4]);
|
||||
static void GetRightCubic(const SkPoint cubics[12], SkPoint points[4]);
|
||||
|
||||
// DEPRECATED -- use MakeVertices()
|
||||
/**
|
||||
* Function that evaluates the coons patch interpolation.
|
||||
* data refers to the pointer of the PatchData struct in which the tessellation data is set.
|
||||
* cubics refers to the points of the cubics.
|
||||
* lod refers the level of detail for each axis.
|
||||
* colors refers to the corner colors that will be bilerp across the patch (optional parameter)
|
||||
* texCoords refers to the corner texture coordinates that will be bilerp across the patch
|
||||
(optional parameter)
|
||||
* Method that calculates a level of detail (number of subdivisions) for a patch in both axis.
|
||||
*/
|
||||
static bool getVertexData(SkPatchUtils::VertexData* data, const SkPoint cubics[12],
|
||||
const SkColor colors[4], const SkPoint texCoords[4],
|
||||
int lodX, int lodY);
|
||||
static SkISize GetLevelOfDetail(const SkPoint cubics[12], const SkMatrix* matrix);
|
||||
|
||||
static sk_sp<SkVertices> MakeVertices(const SkPoint cubics[12], const SkColor colors[4],
|
||||
const SkPoint texCoords[4], int lodX, int lodY);
|
||||
|
Loading…
Reference in New Issue
Block a user