本文整理汇总了C++中SkPath::isVolatile方法的典型用法代码示例。如果您正苦于以下问题:C++ SkPath::isVolatile方法的具体用法?C++ SkPath::isVolatile怎么用?C++ SkPath::isVolatile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkPath
的用法示例。
在下文中一共展示了SkPath::isVolatile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: canDrawPath
bool GrAADistanceFieldPathRenderer::canDrawPath(const GrDrawTarget* target,
const GrPipelineBuilder* pipelineBuilder,
const SkMatrix& viewMatrix,
const SkPath& path,
const GrStrokeInfo& stroke,
bool antiAlias) const {
// TODO: Support inverse fill
// TODO: Support strokes
if (!target->caps()->shaderCaps()->shaderDerivativeSupport() || !antiAlias
|| path.isInverseFillType() || path.isVolatile() || !stroke.isFillStyle()) {
return false;
}
// currently don't support perspective
if (viewMatrix.hasPerspective()) {
return false;
}
// only support paths smaller than 64x64, scaled to less than 256x256
// the goal is to accelerate rendering of lots of small paths that may be scaling
SkScalar maxScale = viewMatrix.getMaxScale();
const SkRect& bounds = path.getBounds();
SkScalar maxDim = SkMaxScalar(bounds.width(), bounds.height());
return maxDim < 64.f && maxDim * maxScale < 256.f;
}
示例2: drawPathWithMaskFilter
void GrBlurUtils::drawPathWithMaskFilter(GrContext* context,
GrDrawContext* drawContext,
const GrClip& clip,
const SkPath& origPath,
const SkPaint& paint,
const SkMatrix& origViewMatrix,
const SkMatrix* prePathMatrix,
const SkIRect& clipBounds,
bool pathIsMutable) {
SkASSERT(!pathIsMutable || origPath.isVolatile());
GrStyle style(paint);
// If we have a prematrix, apply it to the path, optimizing for the case
// where the original path can in fact be modified in place (even though
// its parameter type is const).
const SkPath* path = &origPath;
SkTLazy<SkPath> tmpPath;
SkMatrix viewMatrix = origViewMatrix;
if (prePathMatrix) {
// Styling, blurs, and shading are supposed to be applied *after* the prePathMatrix.
if (!paint.getMaskFilter() && !paint.getShader() && !style.applies()) {
viewMatrix.preConcat(*prePathMatrix);
} else {
SkPath* result = pathIsMutable ? const_cast<SkPath*>(path) : tmpPath.init();
pathIsMutable = true;
path->transform(*prePathMatrix, result);
path = result;
result->setIsVolatile(true);
}
}
// at this point we're done with prePathMatrix
SkDEBUGCODE(prePathMatrix = (const SkMatrix*)0x50FF8001;)
示例3: drawPathWithMaskFilter
void GrBlurUtils::drawPathWithMaskFilter(GrContext* context,
GrDrawContext* drawContext,
const GrClip& clip,
const SkPath& origSrcPath,
const SkPaint& paint,
const SkMatrix& origViewMatrix,
const SkMatrix* prePathMatrix,
const SkIRect& clipBounds,
bool pathIsMutable) {
SkASSERT(!pathIsMutable || origSrcPath.isVolatile());
GrStrokeInfo strokeInfo(paint);
// comment out the line below to determine if it is the reason that the chrome mac perf bot
// has begun crashing
// strokeInfo.setResScale(SkDraw::ComputeResScaleForStroking(origViewMatrix));
// If we have a prematrix, apply it to the path, optimizing for the case
// where the original path can in fact be modified in place (even though
// its parameter type is const).
SkPath* pathPtr = const_cast<SkPath*>(&origSrcPath);
SkTLazy<SkPath> tmpPath;
SkTLazy<SkPath> effectPath;
SkPathEffect* pathEffect = paint.getPathEffect();
SkMatrix viewMatrix = origViewMatrix;
if (prePathMatrix) {
// stroking, path effects, and blurs are supposed to be applied *after* the prePathMatrix.
// The pre-path-matrix also should not affect shading.
if (!paint.getMaskFilter() && !pathEffect && !paint.getShader() &&
(strokeInfo.isFillStyle() || strokeInfo.isHairlineStyle())) {
viewMatrix.preConcat(*prePathMatrix);
} else {
SkPath* result = pathPtr;
if (!pathIsMutable) {
result = tmpPath.init();
result->setIsVolatile(true);
pathIsMutable = true;
}
// should I push prePathMatrix on our MV stack temporarily, instead
// of applying it here? See SkDraw.cpp
pathPtr->transform(*prePathMatrix, result);
pathPtr = result;
}
}
// at this point we're done with prePathMatrix
SkDEBUGCODE(prePathMatrix = (const SkMatrix*)0x50FF8001;)
示例4: ComputeKey
void GrPath::ComputeKey(const SkPath& path, const GrStrokeInfo& stroke, GrUniqueKey* key,
bool* outIsVolatile) {
if (compute_key_for_line_path(path, stroke, key)) {
*outIsVolatile = false;
return;
}
if (compute_key_for_oval_path(path, stroke, key)) {
*outIsVolatile = false;
return;
}
if (compute_key_for_simple_path(path, stroke, key)) {
*outIsVolatile = false;
return;
}
compute_key_for_general_path(path, stroke, key);
*outIsVolatile = path.isVolatile();
}