本文整理汇总了C++中GrGLSLProgramDataManager::set4fv方法的典型用法代码示例。如果您正苦于以下问题:C++ GrGLSLProgramDataManager::set4fv方法的具体用法?C++ GrGLSLProgramDataManager::set4fv怎么用?C++ GrGLSLProgramDataManager::set4fv使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrGLSLProgramDataManager
的用法示例。
在下文中一共展示了GrGLSLProgramDataManager::set4fv方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setData
void setData(const GrGLSLProgramDataManager& pdman,
const GrPrimitiveProcessor& gp,
FPCoordTransformIter&& transformIter) override {
const DefaultGeoProc& dgp = gp.cast<DefaultGeoProc>();
if (!dgp.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dgp.viewMatrix())) {
fViewMatrix = dgp.viewMatrix();
float viewMatrix[3 * 3];
GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix);
pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
}
if (dgp.color() != fColor && !dgp.hasVertexColor()) {
float c[4];
GrColorToRGBAFloat(dgp.color(), c);
pdman.set4fv(fColorUniform, 1, c);
fColor = dgp.color();
}
if (dgp.coverage() != fCoverage && !dgp.hasVertexCoverage()) {
pdman.set1f(fCoverageUniform, GrNormalizeByteToFloat(dgp.coverage()));
fCoverage = dgp.coverage();
}
this->setTransformDataHelper(dgp.fLocalMatrix, pdman, &transformIter);
if (dgp.linearizeColor() && dgp.fColorSpaceXform) {
fColorSpaceHelper.setData(pdman, dgp.fColorSpaceXform.get());
}
}
示例2: setData
void setData(const GrGLSLProgramDataManager& pdman, const GrPrimitiveProcessor& primProc,
FPCoordTransformIter&& transformIter) override {
const GrCubicEffect& ce = primProc.cast<GrCubicEffect>();
if (!ce.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(ce.viewMatrix())) {
fViewMatrix = ce.viewMatrix();
float viewMatrix[3 * 3];
GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix);
pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
}
if (!fDevKLMMatrix.cheapEqualTo(ce.devKLMMatrix())) {
fDevKLMMatrix = ce.devKLMMatrix();
float devKLMMatrix[3 * 3];
GrGLSLGetMatrix<3>(devKLMMatrix, fDevKLMMatrix);
pdman.setMatrix3f(fDevKLMUniform, devKLMMatrix);
}
if (ce.color() != fColor) {
float c[4];
GrColorToRGBAFloat(ce.color(), c);
pdman.set4fv(fColorUniform, 1, c);
fColor = ce.color();
}
this->setTransformDataHelper(SkMatrix::I(), pdman, &transformIter);
}
示例3: onSetData
void GrGLConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrProcessor& processor) {
const GrConvolutionEffect& conv = processor.cast<GrConvolutionEffect>();
GrTexture& texture = *conv.texture(0);
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]);
}
}
int width = Gr1DKernelEffect::WidthFromRadius(conv.radius());
int arrayCount = (width + 3) / 4;
SkASSERT(4 * arrayCount >= width);
pdman.set4fv(fKernelUni, arrayCount, conv.kernel());
}
示例4: onSetData
void onSetData(const GrGLSLProgramDataManager& pdman,
const GrFragmentProcessor& fp) override {
GrColor4f color = fp.cast<ReplaceInputFragmentProcessor>().fColor;
if (!fHaveSetColor || color != fPreviousColor) {
pdman.set4fv(fColorUni, 1, color.fRGBA);
fPreviousColor = color;
fHaveSetColor = true;
}
}
示例5: setData
void setData(const GrGLSLProgramDataManager& pdman,
const GrPrimitiveProcessor& gp) override {
const QuadEdgeEffect& qe = gp.cast<QuadEdgeEffect>();
if (qe.color() != fColor) {
float c[4];
GrColorToRGBAFloat(qe.color(), c);
pdman.set4fv(fColorUniform, 1, c);
fColor = qe.color();
}
}
示例6: setData
void setData(const GrGLSLProgramDataManager& pd,
const GrPrimitiveProcessor& primProc) override {
const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>();
if (pathProc.overrides().readsColor() && pathProc.color() != fColor) {
float c[4];
GrColorToRGBAFloat(pathProc.color(), c);
pd.set4fv(fColorUniform, 1, c);
fColor = pathProc.color();
}
}
示例7: setData
virtual void setData(const GrGLSLProgramDataManager& pdman,
const GrPrimitiveProcessor& gp) override {
const PLSFinishEffect& fe = gp.cast<PLSFinishEffect>();
pdman.set1f(fUseEvenOdd, fe.fUseEvenOdd);
if (fe.color() != fColor && !fe.colorIgnored()) {
GrGLfloat c[4];
GrColorToRGBAFloat(fe.color(), c);
pdman.set4fv(fColorUniform, 1, c);
fColor = fe.color();
}
}
示例8: setData
void setData(const GrGLSLProgramDataManager& pdman, const GrPrimitiveProcessor& gp,
FPCoordTransformIter&& transformIter) override {
const GrBitmapTextGeoProc& btgp = gp.cast<GrBitmapTextGeoProc>();
if (btgp.color() != fColor && !btgp.hasVertexColor()) {
float c[4];
GrColorToRGBAFloat(btgp.color(), c);
pdman.set4fv(fColorUniform, 1, c);
fColor = btgp.color();
}
this->setTransformDataHelper(btgp.localMatrix(), pdman, &transformIter);
}
示例9: onSetData
void onSetData(const GrGLSLProgramDataManager& pdm, const GrProcessor& processor) override {
GrColor color = processor.cast<GrConstColorProcessor>().color();
// We use the "illegal" color value as an uninit sentinel. However, ut isn't inherently
// illegal to use this processor with unpremul colors. So we correctly handle the case
// when the "illegal" color is used but we will always upload it.
if (GrColor_ILLEGAL == color || fPrevColor != color) {
static const float scale = 1.f / 255.f;
float floatColor[4] = {
GrColorUnpackR(color) * scale,
GrColorUnpackG(color) * scale,
GrColorUnpackB(color) * scale,
GrColorUnpackA(color) * scale,
};
pdm.set4fv(fColorUniform, 1, floatColor);
fPrevColor = color;
}
}
示例10: onSetData
void onSetData(const GrGLSLProgramDataManager& uniManager,
const GrProcessor& proc) override {
const ColorMatrixEffect& cme = proc.cast<ColorMatrixEffect>();
const float* m = cme.fMatrix;
// The GL matrix is transposed from SkColorMatrix.
float mt[] = {
m[0], m[5], m[10], m[15],
m[1], m[6], m[11], m[16],
m[2], m[7], m[12], m[17],
m[3], m[8], m[13], m[18],
};
static const float kScale = 1.0f / 255.0f;
float vec[] = {
m[4] * kScale, m[9] * kScale, m[14] * kScale, m[19] * kScale,
};
uniManager.setMatrix4fv(fMatrixHandle, 1, mt);
uniManager.set4fv(fVectorHandle, 1, vec);
}
示例11: setData
void setData(const GrGLSLProgramDataManager& pdman,
const GrPrimitiveProcessor& primProc) override {
const GrCubicEffect& ce = primProc.cast<GrCubicEffect>();
if (!ce.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(ce.viewMatrix())) {
fViewMatrix = ce.viewMatrix();
float viewMatrix[3 * 3];
GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix);
pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
}
if (ce.color() != fColor) {
float c[4];
GrColorToRGBAFloat(ce.color(), c);
pdman.set4fv(fColorUniform, 1, c);
fColor = ce.color();
}
}
示例12: setData
void setData(const GrGLSLProgramDataManager& pdman, const GrPrimitiveProcessor& gp,
FPCoordTransformIter&& transformIter) override {
const GrBitmapTextGeoProc& btgp = gp.cast<GrBitmapTextGeoProc>();
if (btgp.color() != fColor && !btgp.hasVertexColor()) {
float c[4];
GrColorToRGBAFloat(btgp.color(), c);
pdman.set4fv(fColorUniform, 1, c);
fColor = btgp.color();
}
const SkISize& atlasSize = btgp.atlasSize();
SkASSERT(SkIsPow2(atlasSize.fWidth) && SkIsPow2(atlasSize.fHeight));
if (fAtlasSize != atlasSize) {
pdman.set2f(fAtlasSizeInvUniform, 1.0f / atlasSize.fWidth, 1.0f / atlasSize.fHeight);
fAtlasSize = atlasSize;
}
this->setTransformDataHelper(btgp.localMatrix(), pdman, &transformIter);
}
示例13: onSetData
void GrGLMatrixConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrFragmentProcessor& processor) {
const GrMatrixConvolutionEffect& conv = processor.cast<GrMatrixConvolutionEffect>();
GrSurfaceProxy* proxy = conv.textureSampler(0).proxy();
GrTexture* texture = proxy->priv().peekTexture();
float imageIncrement[2];
float ySign = proxy->origin() == kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;
imageIncrement[0] = 1.0f / texture->width();
imageIncrement[1] = ySign / texture->height();
pdman.set2fv(fImageIncrementUni, 1, imageIncrement);
pdman.set2fv(fKernelOffsetUni, 1, conv.kernelOffset());
int kernelCount = conv.kernelSize().width() * conv.kernelSize().height();
int arrayCount = (kernelCount + 3) / 4;
SkASSERT(4 * arrayCount >= kernelCount);
pdman.set4fv(fKernelUni, arrayCount, conv.kernel());
pdman.set1f(fGainUni, conv.gain());
pdman.set1f(fBiasUni, conv.bias());
fDomain.setData(pdman, conv.domain(), proxy);
}
示例14: onSetData
void onSetData(const GrGLSLProgramDataManager& pdman,
const GrFragmentProcessor& _proc) override {
const GrRectBlurEffect& _outer = _proc.cast<GrRectBlurEffect>();
{
const SkRect rectValue = _outer.rect();
pdman.set4fv(fRectVar, 1, (float*)&rectValue);
}
UniformHandle& rect = fRectVar;
(void)rect;
auto sigma = _outer.sigma();
(void)sigma;
GrSurfaceProxy& blurProfileProxy = *_outer.textureSampler(0).proxy();
GrTexture& blurProfile = *blurProfileProxy.priv().peekTexture();
(void)blurProfile;
UniformHandle& proxyRectHalf = fProxyRectHalfVar;
(void)proxyRectHalf;
UniformHandle& proxyRectFloat = fProxyRectFloatVar;
(void)proxyRectFloat;
UniformHandle& profileSize = fProfileSizeVar;
(void)profileSize;
pdman.set1f(profileSize, SkScalarCeilToScalar(6 * sigma));
}
示例15: setData
void setData(const GrGLSLProgramDataManager& pdman, const GrPrimitiveProcessor& primProc,
FPCoordTransformIter&& transformIter) override {
const GrConicEffect& ce = primProc.cast<GrConicEffect>();
if (!ce.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(ce.viewMatrix())) {
fViewMatrix = ce.viewMatrix();
float viewMatrix[3 * 3];
GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix);
pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
}
if (ce.color() != fColor) {
float c[4];
GrColorToRGBAFloat(ce.color(), c);
pdman.set4fv(fColorUniform, 1, c);
fColor = ce.color();
}
if (ce.coverageScale() != 0xff && ce.coverageScale() != fCoverageScale) {
pdman.set1f(fCoverageScaleUniform, GrNormalizeByteToFloat(ce.coverageScale()));
fCoverageScale = ce.coverageScale();
}
this->setTransformDataHelper(ce.localMatrix(), pdman, &transformIter);
}