本文整理汇总了C++中GrGLProgramDataManager类的典型用法代码示例。如果您正苦于以下问题:C++ GrGLProgramDataManager类的具体用法?C++ GrGLProgramDataManager怎么用?C++ GrGLProgramDataManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GrGLProgramDataManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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& 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();
}
}
示例3: 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();
}
}
示例4: setData
void setData(const GrGLProgramDataManager& pdman, const GrProcessor& proc) override {
const LightingFP& lightingFP = proc.cast<LightingFP>();
SkVector3 lightDir = lightingFP.lightDir();
if (lightDir != fLightDir) {
pdman.set3fv(fLightDirUni, 1, &lightDir.fX);
fLightDir = lightDir;
}
GrColor lightColor = lightingFP.lightColor();
if (lightColor != fLightColor) {
GrGLfloat c[4];
GrColorToRGBAFloat(lightColor, c);
pdman.set4fv(fLightColorUni, 1, c);
fLightColor = lightColor;
}
GrColor ambientColor = lightingFP.ambientColor();
if (ambientColor != fAmbientColor) {
GrGLfloat c[4];
GrColorToRGBAFloat(ambientColor, c);
pdman.set4fv(fAmbientColorUni, 1, c);
fAmbientColor = ambientColor;
}
}
示例5: setData
void GrGLMagnifierEffect::setData(const GrGLProgramDataManager& pdman,
const GrProcessor& effect) {
const GrMagnifierEffect& zoom = effect.cast<GrMagnifierEffect>();
pdman.set2f(fOffsetVar, zoom.x_offset(), zoom.y_offset());
pdman.set2f(fInvZoomVar, zoom.x_inv_zoom(), zoom.y_inv_zoom());
pdman.set2f(fInvInsetVar, zoom.x_inv_inset(), zoom.y_inv_inset());
pdman.set4f(fBoundsVar, zoom.bounds().x(), zoom.bounds().y(),
zoom.bounds().width(), zoom.bounds().height());
}
示例6: onSetData
void GrGLBicubicEffect::onSetData(const GrGLProgramDataManager& pdman,
const GrProcessor& processor) {
const GrBicubicEffect& bicubicEffect = processor.cast<GrBicubicEffect>();
const GrTexture& texture = *processor.texture(0);
float imageIncrement[2];
imageIncrement[0] = 1.0f / texture.width();
imageIncrement[1] = 1.0f / texture.height();
pdman.set2fv(fImageIncrementUni, 1, imageIncrement);
pdman.setMatrix4f(fCoefficientsUni, bicubicEffect.coefficients());
fDomain.setData(pdman, bicubicEffect.domain(), texture.origin());
}
示例7: onSetData
void GrGLPerlinNoise::onSetData(const GrGLProgramDataManager& pdman, const GrProcessor& processor) {
INHERITED::onSetData(pdman, processor);
const GrPerlinNoiseEffect& turbulence = processor.cast<GrPerlinNoiseEffect>();
const SkVector& baseFrequency = turbulence.baseFrequency();
pdman.set2f(fBaseFrequencyUni, baseFrequency.fX, baseFrequency.fY);
if (turbulence.stitchTiles()) {
const SkPerlinNoiseShader::StitchData& stitchData = turbulence.stitchData();
pdman.set2f(fStitchDataUni, SkIntToScalar(stitchData.fWidth),
SkIntToScalar(stitchData.fHeight));
}
}
示例8: setData
void GrGLConvexPolyEffect::setData(const GrGLProgramDataManager& pdman, const GrProcessor& effect) {
const GrConvexPolyEffect& cpe = effect.cast<GrConvexPolyEffect>();
size_t byteSize = 3 * cpe.getEdgeCount() * sizeof(SkScalar);
if (0 != memcmp(fPrevEdges, cpe.getEdges(), byteSize)) {
pdman.set3fv(fEdgeUniform, cpe.getEdgeCount(), cpe.getEdges());
memcpy(fPrevEdges, cpe.getEdges(), byteSize);
}
}
示例9: setData
virtual void setData(const GrGLProgramDataManager& pdman,
const GrProcessor& fp) override {
if (fFilterColorUni.isValid()) {
const ModeColorFilterEffect& colorModeFilter = fp.cast<ModeColorFilterEffect>();
GrGLfloat c[4];
GrColorToRGBAFloat(colorModeFilter.color(), c);
pdman.set4fv(fFilterColorUni, 1, c);
}
}
示例10: 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;
}
}
示例11: onSetData
void GLEllipseEffect::onSetData(const GrGLProgramDataManager& pdman, const GrProcessor& effect) {
const EllipseEffect& ee = effect.cast<EllipseEffect>();
if (ee.getRadii() != fPrevRadii || ee.getCenter() != fPrevCenter) {
SkScalar invRXSqd = 1.f / (ee.getRadii().fX * ee.getRadii().fX);
SkScalar invRYSqd = 1.f / (ee.getRadii().fY * ee.getRadii().fY);
pdman.set4f(fEllipseUniform, ee.getCenter().fX, ee.getCenter().fY, invRXSqd, invRYSqd);
fPrevCenter = ee.getCenter();
fPrevRadii = ee.getRadii();
}
}
示例12: setData
void GrGLPathProcessor::setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& primProc,
const GrBatchTracker& bt) {
const PathBatchTracker& local = bt.cast<PathBatchTracker>();
if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColor) {
GrGLfloat c[4];
GrColorToRGBAFloat(local.fColor, c);
pdman.set4fv(fColorUniform, 1, c);
fColor = local.fColor;
}
}
示例13: setData
void GrGLDisplacementMapEffect::setData(const GrGLProgramDataManager& pdman,
const GrProcessor& proc) {
const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMapEffect>();
GrTexture* colorTex = displacementMap.texture(1);
SkScalar scaleX = SkScalarDiv(displacementMap.scale().fX, SkIntToScalar(colorTex->width()));
SkScalar scaleY = SkScalarDiv(displacementMap.scale().fY, SkIntToScalar(colorTex->height()));
pdman.set2f(fScaleUni, SkScalarToFloat(scaleX),
colorTex->origin() == kTopLeft_GrSurfaceOrigin ?
SkScalarToFloat(scaleY) : SkScalarToFloat(-scaleY));
fGLDomain.setData(pdman, displacementMap.domain(), colorTex->origin());
}
示例14: setData
virtual void setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& gp,
const GrBatchTracker& bt) override {
const GrBitmapTextGeoProc& btgp = gp.cast<GrBitmapTextGeoProc>();
if (btgp.color() != fColor && !btgp.hasVertexColor()) {
GrGLfloat c[4];
GrColorToRGBAFloat(btgp.color(), c);
pdman.set4fv(fColorUniform, 1, c);
fColor = btgp.color();
}
}
示例15: setData
virtual void setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& gp,
const GrBatchTracker& bt) override {
this->setUniformViewMatrix(pdman, gp.viewMatrix());
const BitmapTextBatchTracker& local = bt.cast<BitmapTextBatchTracker>();
if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColor) {
GrGLfloat c[4];
GrColorToRGBAFloat(local.fColor, c);
pdman.set4fv(fColorUniform, 1, c);
fColor = local.fColor;
}
}