本文整理汇总了C++中sk_sp::indexCount方法的典型用法代码示例。如果您正苦于以下问题:C++ sk_sp::indexCount方法的具体用法?C++ sk_sp::indexCount怎么用?C++ sk_sp::indexCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sk_sp
的用法示例。
在下文中一共展示了sk_sp::indexCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: INHERITED
GrDrawVerticesOp::GrDrawVerticesOp(const Helper::MakeArgs& helperArgs, GrColor color,
sk_sp<SkVertices> vertices, GrPrimitiveType primitiveType,
GrAAType aaType, bool gammaCorrect,
sk_sp<GrColorSpaceXform> colorSpaceXform,
const SkMatrix& viewMatrix)
: INHERITED(ClassID())
, fHelper(helperArgs, aaType)
, fPrimitiveType(primitiveType)
, fColorSpaceXform(std::move(colorSpaceXform)) {
SkASSERT(vertices);
fVertexCount = vertices->vertexCount();
fIndexCount = vertices->indexCount();
fColorArrayType = vertices->hasColors() ? ColorArrayType::kSkColor
: ColorArrayType::kPremulGrColor;
// GrColor is linearized (and gamut converted) during paint conversion, but SkColors need to be
// handled in the shader
fLinearizeColors = gammaCorrect && vertices->hasColors();
Mesh& mesh = fMeshes.push_back();
mesh.fColor = color;
mesh.fViewMatrix = viewMatrix;
mesh.fVertices = std::move(vertices);
mesh.fIgnoreTexCoords = false;
mesh.fIgnoreColors = false;
fFlags = 0;
if (mesh.hasPerVertexColors()) {
fFlags |= kRequiresPerVertexColors_Flag;
}
if (mesh.hasExplicitLocalCoords()) {
fFlags |= kAnyMeshHasExplicitLocalCoords;
}
IsZeroArea zeroArea;
if (GrIsPrimTypeLines(primitiveType) || GrPrimitiveType::kPoints == primitiveType) {
zeroArea = IsZeroArea::kYes;
} else {
zeroArea = IsZeroArea::kNo;
}
this->setTransformedBounds(mesh.fVertices->bounds(), viewMatrix, HasAABloat::kNo, zeroArea);
}
示例2: INHERITED
GrDrawVerticesOp::GrDrawVerticesOp(const Helper::MakeArgs& helperArgs, GrColor color,
sk_sp<SkVertices> vertices, const SkVertices::Bone bones[],
int boneCount, GrPrimitiveType primitiveType, GrAAType aaType,
sk_sp<GrColorSpaceXform> colorSpaceXform,
const SkMatrix& viewMatrix)
: INHERITED(ClassID())
, fHelper(helperArgs, aaType)
, fPrimitiveType(primitiveType)
, fColorSpaceXform(std::move(colorSpaceXform)) {
SkASSERT(vertices);
fVertexCount = vertices->vertexCount();
fIndexCount = vertices->indexCount();
fColorArrayType = vertices->hasColors() ? ColorArrayType::kSkColor
: ColorArrayType::kPremulGrColor;
Mesh& mesh = fMeshes.push_back();
mesh.fColor = color;
mesh.fViewMatrix = viewMatrix;
mesh.fVertices = std::move(vertices);
mesh.fIgnoreTexCoords = false;
mesh.fIgnoreColors = false;
mesh.fIgnoreBones = false;
if (mesh.fVertices->hasBones() && bones) {
// Perform the transformations on the CPU instead of the GPU.
mesh.fVertices = mesh.fVertices->applyBones(bones, boneCount);
} else {
if (bones && boneCount > 1) {
// NOTE: This should never be used. All bone transforms are being done on the CPU
// instead of the GPU.
// Copy the bone data.
fBones.assign(bones, bones + boneCount);
}
}
fFlags = 0;
if (mesh.hasPerVertexColors()) {
fFlags |= kRequiresPerVertexColors_Flag;
}
if (mesh.hasExplicitLocalCoords()) {
fFlags |= kAnyMeshHasExplicitLocalCoords_Flag;
}
if (mesh.hasBones()) {
fFlags |= kHasBones_Flag;
}
// Special case for meshes with a world transform but no bone weights.
// These will be considered normal vertices draws without bones.
if (!mesh.fVertices->hasBones() && boneCount == 1) {
SkMatrix worldTransform;
worldTransform.setAffine(bones[0].values);
mesh.fViewMatrix.preConcat(worldTransform);
}
IsZeroArea zeroArea;
if (GrIsPrimTypeLines(primitiveType) || GrPrimitiveType::kPoints == primitiveType) {
zeroArea = IsZeroArea::kYes;
} else {
zeroArea = IsZeroArea::kNo;
}
if (this->hasBones()) {
// We don't know the bounds if there are deformations involved, so attempt to calculate
// the maximum possible.
SkRect bounds = SkRect::MakeEmpty();
const SkRect originalBounds = bones[0].mapRect(mesh.fVertices->bounds());
for (int i = 1; i < boneCount; i++) {
const SkVertices::Bone& matrix = bones[i];
bounds.join(matrix.mapRect(originalBounds));
}
this->setTransformedBounds(bounds,
mesh.fViewMatrix,
HasAABloat::kNo,
zeroArea);
} else {
this->setTransformedBounds(mesh.fVertices->bounds(),
mesh.fViewMatrix,
HasAABloat::kNo,
zeroArea);
}
}