本文整理汇总了C++中GrDrawState::getCoverageColor方法的典型用法代码示例。如果您正苦于以下问题:C++ GrDrawState::getCoverageColor方法的具体用法?C++ GrDrawState::getCoverageColor怎么用?C++ GrDrawState::getCoverageColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrDrawState
的用法示例。
在下文中一共展示了GrDrawState::getCoverageColor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createLineGeom
bool GrAAHairLinePathRenderer::createLineGeom(const SkPath& path,
GrDrawTarget* target,
const PtArray& lines,
int lineCnt,
GrDrawTarget::AutoReleaseGeometry* arg,
SkRect* devBounds) {
GrDrawState* drawState = target->drawState();
const SkMatrix& viewM = drawState->getViewMatrix();
int vertCnt = kVertsPerLineSeg * lineCnt;
drawState->setVertexAttribs<gHairlineLineAttribs>(SK_ARRAY_COUNT(gHairlineLineAttribs),
sizeof(LineVertex));
if (!arg->set(target, vertCnt, 0)) {
return false;
}
LineVertex* verts = reinterpret_cast<LineVertex*>(arg->vertices());
const SkMatrix* toSrc = NULL;
SkMatrix ivm;
if (viewM.hasPerspective()) {
if (viewM.invert(&ivm)) {
toSrc = &ivm;
}
}
devBounds->set(lines.begin(), lines.count());
for (int i = 0; i < lineCnt; ++i) {
add_line(&lines[2*i], toSrc, drawState->getCoverageColor(), &verts);
}
// All the verts computed by add_line are within sqrt(1^2 + 0.5^2) of the end points.
static const SkScalar kSqrtOfOneAndAQuarter = 1.118f;
// Add a little extra to account for vector normalization precision.
static const SkScalar kOutset = kSqrtOfOneAndAQuarter + SK_Scalar1 / 20;
devBounds->outset(kOutset, kOutset);
return true;
}
示例2: Build
//.........这里部分代码省略.........
for (int s = firstEffectiveCoverageStage; s < drawState.numCoverageStages(); ++s) {
effectKeys[currEffectKey++] =
get_key_and_update_stats(drawState.getCoverageStage(s), gpu->glCaps(),
requiresLocalCoordAttrib, &readsDst, &readFragPosition,
&hasVertexCode);
}
}
header->fHasVertexCode = hasVertexCode || requiresLocalCoordAttrib;
header->fEmitsPointSize = isPoints;
// Currently the experimental GS will only work with triangle prims (and it doesn't do anything
// other than pass through values from the VS to the FS anyway).
#if GR_GL_EXPERIMENTAL_GS
#if 0
header->fExperimentalGS = gpu->caps().geometryShaderSupport();
#else
header->fExperimentalGS = false;
#endif
#endif
bool defaultToUniformInputs = GR_GL_NO_CONSTANT_ATTRIBUTES || gpu->caps()->pathRenderingSupport();
if (colorIsTransBlack) {
header->fColorInput = kTransBlack_ColorInput;
} else if (colorIsSolidWhite) {
header->fColorInput = kSolidWhite_ColorInput;
} else if (defaultToUniformInputs && !requiresColorAttrib) {
header->fColorInput = kUniform_ColorInput;
} else {
header->fColorInput = kAttribute_ColorInput;
header->fHasVertexCode = true;
}
bool covIsSolidWhite = !requiresCoverageAttrib && 0xffffffff == drawState.getCoverageColor();
if (skipCoverage) {
header->fCoverageInput = kTransBlack_ColorInput;
} else if (covIsSolidWhite || !inputCoverageIsUsed) {
header->fCoverageInput = kSolidWhite_ColorInput;
} else if (defaultToUniformInputs && !requiresCoverageAttrib) {
header->fCoverageInput = kUniform_ColorInput;
} else {
header->fCoverageInput = kAttribute_ColorInput;
header->fHasVertexCode = true;
}
if (readsDst) {
SkASSERT(NULL != dstCopy || gpu->caps()->dstReadInShaderSupport());
const GrTexture* dstCopyTexture = NULL;
if (NULL != dstCopy) {
dstCopyTexture = dstCopy->texture();
}
header->fDstReadKey = GrGLShaderBuilder::KeyForDstRead(dstCopyTexture, gpu->glCaps());
SkASSERT(0 != header->fDstReadKey);
} else {
header->fDstReadKey = 0;
}
if (readFragPosition) {
header->fFragPosKey = GrGLShaderBuilder::KeyForFragmentPosition(drawState.getRenderTarget(),
gpu->glCaps());
} else {
header->fFragPosKey = 0;
}
// Record attribute indices
示例3: Build
//.........这里部分代码省略.........
}
}
if (!effectKeySuccess) {
desc->fKey.reset();
return false;
}
// Because header is a pointer into the dynamic array, we can't push any new data into the key
// below here.
header->fRequiresVertexShader = requiresVertexShader || requiresLocalCoordAttrib;
header->fEmitsPointSize = GrGpu::kDrawPoints_DrawType == drawType;
// Currently the experimental GS will only work with triangle prims (and it doesn't do anything
// other than pass through values from the VS to the FS anyway).
#if GR_GL_EXPERIMENTAL_GS
#if 0
header->fExperimentalGS = gpu->caps().geometryShaderSupport();
#else
header->fExperimentalGS = false;
#endif
#endif
bool defaultToUniformInputs = GR_GL_NO_CONSTANT_ATTRIBUTES || gpu->caps()->pathRenderingSupport();
if (!inputColorIsUsed && !skipColor) {
header->fColorInput = kAllOnes_ColorInput;
} else if (defaultToUniformInputs && !requiresColorAttrib && inputColorIsUsed) {
header->fColorInput = kUniform_ColorInput;
} else {
header->fColorInput = kAttribute_ColorInput;
header->fRequiresVertexShader = true;
}
bool covIsSolidWhite = !requiresCoverageAttrib && 0xffffffff == drawState.getCoverageColor();
if ((covIsSolidWhite || !inputCoverageIsUsed) && !skipCoverage) {
header->fCoverageInput = kAllOnes_ColorInput;
} else if (defaultToUniformInputs && !requiresCoverageAttrib && inputCoverageIsUsed) {
header->fCoverageInput = kUniform_ColorInput;
} else {
header->fCoverageInput = kAttribute_ColorInput;
header->fRequiresVertexShader = true;
}
if (readsDst) {
SkASSERT(NULL != dstCopy || gpu->caps()->dstReadInShaderSupport());
const GrTexture* dstCopyTexture = NULL;
if (NULL != dstCopy) {
dstCopyTexture = dstCopy->texture();
}
header->fDstReadKey = GrGLFragmentShaderBuilder::KeyForDstRead(dstCopyTexture,
gpu->glCaps());
SkASSERT(0 != header->fDstReadKey);
} else {
header->fDstReadKey = 0;
}
if (readFragPosition) {
header->fFragPosKey = GrGLFragmentShaderBuilder::KeyForFragmentPosition(
drawState.getRenderTarget(), gpu->glCaps());
} else {
header->fFragPosKey = 0;
}
// Record attribute indices
header->fPositionAttributeIndex = drawState.positionAttributeIndex();