本文整理汇总了C++中GrGLProgramDataManager::set2f方法的典型用法代码示例。如果您正苦于以下问题:C++ GrGLProgramDataManager::set2f方法的具体用法?C++ GrGLProgramDataManager::set2f怎么用?C++ GrGLProgramDataManager::set2f使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrGLProgramDataManager
的用法示例。
在下文中一共展示了GrGLProgramDataManager::set2f方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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());
}
示例2: 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]);
}
}
}
示例3: setData
void GrGLConvolutionEffect::setData(const GrGLProgramDataManager& pdman,
const GrProcessor& processor) {
const GrConvolutionEffect& conv = processor.cast<GrConvolutionEffect>();
GrTexture& texture = *conv.texture(0);
// the code we generated was for a specific kernel radius
SkASSERT(conv.radius() == fRadius);
float imageIncrement[2] = { 0 };
float ySign = texture.origin() != kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;
switch (conv.direction()) {
case Gr1DKernelEffect::kX_Direction:
imageIncrement[0] = 1.0f / texture.width();
break;
case Gr1DKernelEffect::kY_Direction:
imageIncrement[1] = ySign / texture.height();
break;
default:
SkFAIL("Unknown filter direction.");
}
pdman.set2fv(fImageIncrementUni, 1, imageIncrement);
if (conv.useBounds()) {
const float* bounds = conv.bounds();
if (Gr1DKernelEffect::kY_Direction == conv.direction() &&
texture.origin() != kTopLeft_GrSurfaceOrigin) {
pdman.set2f(fBoundsUni, 1.0f - bounds[1], 1.0f - bounds[0]);
} else {
pdman.set2f(fBoundsUni, bounds[0], bounds[1]);
}
}
pdman.set1fv(fKernelUni, this->width(), conv.kernel());
}
示例4: onSetData
void GrGLMagnifierEffect::onSetData(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());
}
示例5: 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));
}
}
示例6: setData
virtual void setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& proc,
const GrBatchTracker& bt) override {
SkASSERT(fTextureSizeUni.isValid());
GrTexture* texture = proc.texture(0);
if (texture->width() != fTextureSize.width() ||
texture->height() != fTextureSize.height()) {
fTextureSize = SkISize::Make(texture->width(), texture->height());
pdman.set2f(fTextureSizeUni,
SkIntToScalar(fTextureSize.width()),
SkIntToScalar(fTextureSize.height()));
}
const GrDistanceFieldPathGeoProc& dfpgp = proc.cast<GrDistanceFieldPathGeoProc>();
if (!dfpgp.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dfpgp.viewMatrix())) {
fViewMatrix = dfpgp.viewMatrix();
GrGLfloat viewMatrix[3 * 3];
GrGLGetMatrix<3>(viewMatrix, fViewMatrix);
pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
}
if (dfpgp.color() != fColor) {
GrGLfloat c[4];
GrColorToRGBAFloat(dfpgp.color(), c);
pdman.set4fv(fColorUniform, 1, c);
fColor = dfpgp.color();
}
}
示例7: 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());
}
示例8: setData
virtual void setData(const GrGLProgramDataManager& pdman,
const GrPrimitiveProcessor& proc,
const GrBatchTracker& bt) override {
SkASSERT(fTextureSizeUni.isValid());
GrTexture* texture = proc.texture(0);
if (texture->width() != fTextureSize.width() ||
texture->height() != fTextureSize.height()) {
fTextureSize = SkISize::Make(texture->width(), texture->height());
pdman.set2f(fTextureSizeUni,
SkIntToScalar(fTextureSize.width()),
SkIntToScalar(fTextureSize.height()));
}
this->setUniformViewMatrix(pdman, proc.viewMatrix());
const DistanceFieldNoGammaBatchTracker& local = bt.cast<DistanceFieldNoGammaBatchTracker>();
if (kUniform_GrGPInput == local.fInputColorType && local.fColor != fColor) {
GrGLfloat c[4];
GrColorToRGBAFloat(local.fColor, c);
pdman.set4fv(fColorUniform, 1, c);
fColor = local.fColor;
}
}
示例9: setData
void GLEllipticalRRectEffect::setData(const GrGLProgramDataManager& pdman,
const GrProcessor& effect) {
const EllipticalRRectEffect& erre = effect.cast<EllipticalRRectEffect>();
const SkRRect& rrect = erre.getRRect();
if (rrect != fPrevRRect) {
SkRect rect = rrect.getBounds();
const SkVector& r0 = rrect.radii(SkRRect::kUpperLeft_Corner);
SkASSERT(r0.fX >= kRadiusMin);
SkASSERT(r0.fY >= kRadiusMin);
switch (erre.getRRect().getType()) {
case SkRRect::kSimple_Type:
rect.inset(r0.fX, r0.fY);
pdman.set2f(fInvRadiiSqdUniform, 1.f / (r0.fX * r0.fX),
1.f / (r0.fY * r0.fY));
break;
case SkRRect::kNinePatch_Type: {
const SkVector& r1 = rrect.radii(SkRRect::kLowerRight_Corner);
SkASSERT(r1.fX >= kRadiusMin);
SkASSERT(r1.fY >= kRadiusMin);
rect.fLeft += r0.fX;
rect.fTop += r0.fY;
rect.fRight -= r1.fX;
rect.fBottom -= r1.fY;
pdman.set4f(fInvRadiiSqdUniform, 1.f / (r0.fX * r0.fX),
1.f / (r0.fY * r0.fY),
1.f / (r1.fX * r1.fX),
1.f / (r1.fY * r1.fY));
break;
}
default:
SkFAIL("RRect should always be simple or nine-patch.");
}
pdman.set4f(fInnerRectUniform, rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
fPrevRRect = rrect;
}
}