本文整理汇总了C++中GrPipelineBuilder::setFromPaint方法的典型用法代码示例。如果您正苦于以下问题:C++ GrPipelineBuilder::setFromPaint方法的具体用法?C++ GrPipelineBuilder::setFromPaint怎么用?C++ GrPipelineBuilder::setFromPaint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrPipelineBuilder
的用法示例。
在下文中一共展示了GrPipelineBuilder::setFromPaint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: flush
void GrDistanceFieldTextContext::flush() {
if (NULL == fDrawTarget) {
return;
}
if (fCurrVertex > 0) {
GrPipelineBuilder pipelineBuilder;
pipelineBuilder.setFromPaint(fPaint, fRenderTarget, fClip);
// setup our sampler state for our text texture/atlas
SkASSERT(SkIsAlign4(fCurrVertex));
// get our current color
SkColor filteredColor;
SkColorFilter* colorFilter = fSkPaint.getColorFilter();
if (colorFilter) {
filteredColor = colorFilter->filterColor(fSkPaint.getColor());
} else {
filteredColor = fSkPaint.getColor();
}
this->setupCoverageEffect(filteredColor);
// Set draw state
if (fUseLCDText) {
// TODO: move supportsRGBCoverage check to setupCoverageEffect and only add LCD
// processor if the xp can support it. For now we will simply assume that if
// fUseLCDText is true, then we have a known color output.
const GrXPFactory* xpFactory = pipelineBuilder.getXPFactory();
if (!xpFactory->supportsRGBCoverage(0, kRGBA_GrColorComponentFlags)) {
SkDebugf("LCD Text will not draw correctly.\n");
}
SkASSERT(!fCachedGeometryProcessor->hasVertexColor());
} else {
// We're using per-vertex color.
SkASSERT(fCachedGeometryProcessor->hasVertexColor());
}
int nGlyphs = fCurrVertex / kVerticesPerGlyph;
fDrawTarget->setIndexSourceToBuffer(fContext->getQuadIndexBuffer());
fDrawTarget->drawIndexedInstances(&pipelineBuilder,
fCachedGeometryProcessor.get(),
kTriangles_GrPrimitiveType,
nGlyphs,
kVerticesPerGlyph,
kIndicesPerGlyph,
&fVertexBounds);
fDrawTarget->resetVertexSource();
fVertices = NULL;
fTotalVertexCount -= fCurrVertex;
fCurrVertex = 0;
SkSafeSetNull(fCurrTexture);
fVertexBounds.setLargestInverted();
}
}