if (!inputCS && !outputCS && !workInUnpremul) { // A null input is the final dst CS, and a null output is the input CS, so if both are null // then there's no additional conversion for children and no additional conversion // applied to the shader's output. return shader;
} else { // Otherwise there's some conversion that has to happen on the input side or the output side // that makes this not a no-op. return sk_sp(new SkWorkingColorSpaceShader(std::move(shader),
std::move(inputCS),
std::move(outputCS),
workInUnpremul));
}
}
// TODO(b/431253455): Should get the dstAT from `rec` const SkAlphaType dstAT = kPremul_SkAlphaType; auto [inputCS, outputCS, workingAT] = this->workingSpace(dstCS, dstAT);
constauto* dstToInput = rec.fAlloc->make<SkColorSpaceXformSteps>(dst, input); constauto* outputToDst = rec.fAlloc->make<SkColorSpaceXformSteps>(output, dst); // NOTE: There is no inputToOutput steps to apply because it is assumed that the child shader // is responsible for such conversion (or input == output and it's a no-op).
// Alpha-only image shaders reference the paint color, which is already in the destination // color space. We need to transform it to the working space for consistency.
SkColor4f paintColorInWorkingSpace = rec.fPaintColor.makeOpaque();
dstToInput->apply(paintColorInWorkingSpace.vec());
// TODO(b/431253455): The working rec should have its alpha type set to `workingAT`
SkStageRec workingRec = {rec.fPipeline,
rec.fAlloc,
rec.fDstColorType,
fInputSpace.get(),
paintColorInWorkingSpace,
rec.fSurfaceProps,
rec.fDstBounds};
if (!as_SB(fShader)->appendStages(workingRec, mRec)) { returnfalse;
}
// If true, will not work in unpremul and assume inputSpace will be non-null and the outputSpace // will be null. constbool legacyWorkingCS = buffer.isVersionLT(SkPicturePriv::kWorkingColorSpaceOutput);
// The input/output spaces are allowed to be null, but if we think we have a non-null CS, then // it better be deserializable.
sk_sp<SkColorSpace> inputSpace; if (legacyWorkingCS || buffer.readBool()) { auto data = buffer.readByteArrayAsData(); if (!buffer.validate(data != nullptr)) { return nullptr;
}
inputSpace = SkColorSpace::Deserialize(data->data(), data->size()); if (!buffer.validate(inputSpace != nullptr)) { return nullptr;
}
}
sk_sp<SkColorSpace> outputSpace; if (!legacyWorkingCS && buffer.readBool()) { auto data = buffer.readByteArrayAsData(); if (!buffer.validate(data != nullptr)) { return nullptr;
}
outputSpace = SkColorSpace::Deserialize(data->data(), data->size()); if (!buffer.validate(outputSpace != nullptr)) { return nullptr;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.