本文整理汇总了C++中GrTexture::getUniqueID方法的典型用法代码示例。如果您正苦于以下问题:C++ GrTexture::getUniqueID方法的具体用法?C++ GrTexture::getUniqueID怎么用?C++ GrTexture::getUniqueID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrTexture
的用法示例。
在下文中一共展示了GrTexture::getUniqueID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: flushGlyphs
void GrBitmapTextContext::flushGlyphs() {
if (NULL == fDrawTarget) {
return;
}
GrDrawState* drawState = fDrawTarget->drawState();
GrDrawState::AutoRestoreEffects are(drawState);
drawState->setFromPaint(fPaint, SkMatrix::I(), fContext->getRenderTarget());
if (fCurrVertex > 0) {
// setup our sampler state for our text texture/atlas
SkASSERT(SkIsAlign4(fCurrVertex));
GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kNone_FilterMode);
GrTexture* currTexture = fStrike->getTexture();
SkASSERT(currTexture);
uint32_t textureUniqueID = currTexture->getUniqueID();
if (textureUniqueID != fEffectTextureUniqueID) {
fCachedEffect.reset(GrCustomCoordsTextureEffect::Create(currTexture, params));
fEffectTextureUniqueID = textureUniqueID;
}
// This effect could be stored with one of the cache objects (atlas?)
int coordsIdx = drawState->hasColorVertexAttribute() ? kGlyphCoordsWithColorAttributeIndex :
kGlyphCoordsNoColorAttributeIndex;
drawState->addCoverageEffect(fCachedEffect.get(), coordsIdx);
SkASSERT(NULL != fStrike);
switch (fStrike->getMaskFormat()) {
// Color bitmap text
case kARGB_GrMaskFormat:
SkASSERT(!drawState->hasColorVertexAttribute());
drawState->setBlendFunc(fPaint.getSrcBlendCoeff(), fPaint.getDstBlendCoeff());
drawState->setColor(0xffffffff);
break;
// LCD text
case kA888_GrMaskFormat:
case kA565_GrMaskFormat: {
if (kOne_GrBlendCoeff != fPaint.getSrcBlendCoeff() ||
kISA_GrBlendCoeff != fPaint.getDstBlendCoeff() ||
fPaint.numColorStages()) {
GrPrintf("LCD Text will not draw correctly.\n");
}
SkASSERT(!drawState->hasColorVertexAttribute());
// We don't use the GrPaint's color in this case because it's been premultiplied by
// alpha. Instead we feed in a non-premultiplied color, and multiply its alpha by
// the mask texture color. The end result is that we get
// mask*paintAlpha*paintColor + (1-mask*paintAlpha)*dstColor
int a = SkColorGetA(fSkPaint.getColor());
// paintAlpha
drawState->setColor(SkColorSetARGB(a, a, a, a));
// paintColor
drawState->setBlendConstant(skcolor_to_grcolor_nopremultiply(fSkPaint.getColor()));
drawState->setBlendFunc(kConstC_GrBlendCoeff, kISC_GrBlendCoeff);
break;
}
// Grayscale/BW text
case kA8_GrMaskFormat:
// set back to normal in case we took LCD path previously.
drawState->setBlendFunc(fPaint.getSrcBlendCoeff(), fPaint.getDstBlendCoeff());
//drawState->setColor(fPaint.getColor());
// We're using per-vertex color.
SkASSERT(drawState->hasColorVertexAttribute());
drawState->setColor(0xFFFFFFFF);
break;
default:
SkFAIL("Unexepected mask format.");
}
int nGlyphs = fCurrVertex / 4;
fDrawTarget->setIndexSourceToBuffer(fContext->getQuadIndexBuffer());
fDrawTarget->drawIndexedInstances(kTriangles_GrPrimitiveType,
nGlyphs,
4, 6, &fVertexBounds);
fCurrVertex = 0;
fVertexBounds.setLargestInverted();
}
fDrawTarget->resetVertexSource();
fVertices = NULL;
}