本文整理汇总了C++中GrGLProgramDataManager::set1f方法的典型用法代码示例。如果您正苦于以下问题:C++ GrGLProgramDataManager::set1f方法的具体用法?C++ GrGLProgramDataManager::set1f怎么用?C++ GrGLProgramDataManager::set1f使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrGLProgramDataManager
的用法示例。
在下文中一共展示了GrGLProgramDataManager::set1f方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SkIntToScalar
void GrColorCubeEffect::GLProcessor::setData(const GrGLProgramDataManager& pdman,
const GrProcessor& proc) {
const GrColorCubeEffect& colorCube = proc.cast<GrColorCubeEffect>();
SkScalar size = SkIntToScalar(colorCube.colorCubeSize());
pdman.set1f(fColorCubeSizeUni, SkScalarToFloat(size));
pdman.set1f(fColorCubeInvSizeUni, SkScalarToFloat(SkScalarInvert(size)));
}
示例2: setData
virtual void setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& proc,
const GrBatchTracker& bt) override {
#ifdef SK_GAMMA_APPLY_TO_A8
const GrDistanceFieldA8TextGeoProc& dfTexEffect = proc.cast<GrDistanceFieldA8TextGeoProc>();
float distanceAdjust = dfTexEffect.getDistanceAdjust();
if (distanceAdjust != fDistanceAdjust) {
pdman.set1f(fDistanceAdjustUni, distanceAdjust);
fDistanceAdjust = distanceAdjust;
}
#endif
const GrDistanceFieldA8TextGeoProc& dfa8gp = proc.cast<GrDistanceFieldA8TextGeoProc>();
if (!dfa8gp.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dfa8gp.viewMatrix())) {
fViewMatrix = dfa8gp.viewMatrix();
GrGLfloat viewMatrix[3 * 3];
GrGLGetMatrix<3>(viewMatrix, fViewMatrix);
pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
}
if (dfa8gp.color() != fColor && !dfa8gp.hasVertexColor()) {
GrGLfloat c[4];
GrColorToRGBAFloat(dfa8gp.color(), c);
pdman.set4fv(fColorUniform, 1, c);
fColor = dfa8gp.color();
}
}
示例3: setData
void GrGLMorphologyEffect::setData(const GrGLProgramDataManager& pdman,
const GrProcessor& proc) {
const GrMorphologyEffect& m = proc.cast<GrMorphologyEffect>();
GrTexture& texture = *m.texture(0);
// the code we generated was for a specific kernel radius, direction and bound usage
SkASSERT(m.radius() == fRadius);
SkASSERT(m.direction() == fDirection);
SkASSERT(m.useRange() == fUseRange);
float pixelSize = 0.0f;
switch (fDirection) {
case Gr1DKernelEffect::kX_Direction:
pixelSize = 1.0f / texture.width();
break;
case Gr1DKernelEffect::kY_Direction:
pixelSize = 1.0f / texture.height();
break;
default:
SkFAIL("Unknown filter direction.");
}
pdman.set1f(fPixelSizeUni, pixelSize);
if (fUseRange) {
const float* range = m.range();
if (fDirection && texture.origin() == kBottomLeft_GrSurfaceOrigin) {
pdman.set2f(fRangeUni, 1.0f - range[1], 1.0f - range[0]);
} else {
pdman.set2f(fRangeUni, range[0], range[1]);
}
}
}
示例4: setData
virtual void setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& gp,
const GrBatchTracker& bt) override {
const DefaultGeoProc& dgp = gp.cast<DefaultGeoProc>();
if (!dgp.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dgp.viewMatrix())) {
fViewMatrix = dgp.viewMatrix();
GrGLfloat viewMatrix[3 * 3];
GrGLGetMatrix<3>(viewMatrix, fViewMatrix);
pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
}
if (dgp.color() != fColor && !dgp.hasVertexColor()) {
GrGLfloat c[4];
GrColorToRGBAFloat(dgp.color(), c);
pdman.set4fv(fColorUniform, 1, c);
fColor = dgp.color();
}
if (!dgp.coverageWillBeIgnored() &&
dgp.coverage() != fCoverage && !dgp.hasVertexCoverage()) {
pdman.set1f(fCoverageUniform, GrNormalizeByteToFloat(dgp.coverage()));
fCoverage = dgp.coverage();
}
}
示例5: setData
void GrGLPerlinNoise::setData(const GrGLProgramDataManager& pdman, const GrProcessor& processor) {
INHERITED::setData(pdman, processor);
const GrPerlinNoiseEffect& turbulence = processor.cast<GrPerlinNoiseEffect>();
const SkVector& baseFrequency = turbulence.baseFrequency();
pdman.set2f(fBaseFrequencyUni, baseFrequency.fX, baseFrequency.fY);
pdman.set1f(fAlphaUni, SkIntToScalar(turbulence.alpha()) / 255);
if (turbulence.stitchTiles()) {
const SkPerlinNoiseShader::StitchData& stitchData = turbulence.stitchData();
pdman.set2f(fStitchDataUni, SkIntToScalar(stitchData.fWidth),
SkIntToScalar(stitchData.fHeight));
}
}
示例6: setData
virtual void setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& primProc,
const GrBatchTracker& bt) override {
const GrConicEffect& ce = primProc.cast<GrConicEffect>();
this->setUniformViewMatrix(pdman, ce.viewMatrix());
const ConicBatchTracker& local = bt.cast<ConicBatchTracker>();
if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColor) {
GrGLfloat c[4];
GrColorToRGBAFloat(local.fColor, c);
pdman.set4fv(fColorUniform, 1, c);
fColor = local.fColor;
}
if (0xff != local.fCoverageScale && fCoverageScale != local.fCoverageScale) {
pdman.set1f(fCoverageScaleUniform, GrNormalizeByteToFloat(local.fCoverageScale));
fCoverageScale = local.fCoverageScale;
}
}
示例7: setData
virtual void setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& proc,
const GrBatchTracker& bt) override {
#ifdef SK_GAMMA_APPLY_TO_A8
const GrDistanceFieldTextureEffect& dfTexEffect =
proc.cast<GrDistanceFieldTextureEffect>();
float distanceAdjust = dfTexEffect.getDistanceAdjust();
if (distanceAdjust != fDistanceAdjust) {
pdman.set1f(fDistanceAdjustUni, distanceAdjust);
fDistanceAdjust = distanceAdjust;
}
#endif
this->setUniformViewMatrix(pdman, proc.viewMatrix());
const DistanceFieldBatchTracker& local = bt.cast<DistanceFieldBatchTracker>();
if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColor) {
GrGLfloat c[4];
GrColorToRGBAFloat(local.fColor, c);
pdman.set4fv(fColorUniform, 1, c);
fColor = local.fColor;
}
}
示例8: setData
void GLCircularRRectEffect::setData(const GrGLProgramDataManager& pdman,
const GrProcessor& processor) {
const CircularRRectEffect& crre = processor.cast<CircularRRectEffect>();
const SkRRect& rrect = crre.getRRect();
if (rrect != fPrevRRect) {
SkRect rect = rrect.getBounds();
SkScalar radius = 0;
switch (crre.getCircularCornerFlags()) {
case CircularRRectEffect::kAll_CornerFlags:
SkASSERT(rrect.isSimpleCircular());
radius = rrect.getSimpleRadii().fX;
SkASSERT(radius >= kRadiusMin);
rect.inset(radius, radius);
break;
case CircularRRectEffect::kTopLeft_CornerFlag:
radius = rrect.radii(SkRRect::kUpperLeft_Corner).fX;
rect.fLeft += radius;
rect.fTop += radius;
rect.fRight += 0.5f;
rect.fBottom += 0.5f;
break;
case CircularRRectEffect::kTopRight_CornerFlag:
radius = rrect.radii(SkRRect::kUpperRight_Corner).fX;
rect.fLeft -= 0.5f;
rect.fTop += radius;
rect.fRight -= radius;
rect.fBottom += 0.5f;
break;
case CircularRRectEffect::kBottomRight_CornerFlag:
radius = rrect.radii(SkRRect::kLowerRight_Corner).fX;
rect.fLeft -= 0.5f;
rect.fTop -= 0.5f;
rect.fRight -= radius;
rect.fBottom -= radius;
break;
case CircularRRectEffect::kBottomLeft_CornerFlag:
radius = rrect.radii(SkRRect::kLowerLeft_Corner).fX;
rect.fLeft += radius;
rect.fTop -= 0.5f;
rect.fRight += 0.5f;
rect.fBottom -= radius;
break;
case CircularRRectEffect::kLeft_CornerFlags:
radius = rrect.radii(SkRRect::kUpperLeft_Corner).fX;
rect.fLeft += radius;
rect.fTop += radius;
rect.fRight += 0.5f;
rect.fBottom -= radius;
break;
case CircularRRectEffect::kTop_CornerFlags:
radius = rrect.radii(SkRRect::kUpperLeft_Corner).fX;
rect.fLeft += radius;
rect.fTop += radius;
rect.fRight -= radius;
rect.fBottom += 0.5f;
break;
case CircularRRectEffect::kRight_CornerFlags:
radius = rrect.radii(SkRRect::kUpperRight_Corner).fX;
rect.fLeft -= 0.5f;
rect.fTop += radius;
rect.fRight -= radius;
rect.fBottom -= radius;
break;
case CircularRRectEffect::kBottom_CornerFlags:
radius = rrect.radii(SkRRect::kLowerLeft_Corner).fX;
rect.fLeft += radius;
rect.fTop -= 0.5f;
rect.fRight -= radius;
rect.fBottom -= radius;
break;
default:
SkFAIL("Should have been one of the above cases.");
}
pdman.set4f(fInnerRectUniform, rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
pdman.set1f(fRadiusPlusHalfUniform, radius + 0.5f);
fPrevRRect = rrect;
}
}