Exemplo n.º 1
0
CImgFilterPluginHelperBase::CImgFilterPluginHelperBase(OfxImageEffectHandle handle,
                                                       bool supportsComponentRemapping, // true if the number and order of components of the image passed to render() has no importance
                                                       bool supportsTiles,
                                                       bool supportsMultiResolution,
                                                       bool supportsRenderScale,
                                                       bool defaultUnpremult/* = true*/,
                                                       bool defaultProcessAlphaOnRGBA/* = false*/,
                                                       bool isFilter/* = true*/)
: ImageEffect(handle)
, _dstClip(0)
, _srcClip(0)
, _maskClip(0)
, _processR(0)
, _processG(0)
, _processB(0)
, _processA(0)
, _premult(0)
, _premultChannel(0)
, _mix(0)
, _maskApply(0)
, _maskInvert(0)
, _supportsComponentRemapping(supportsComponentRemapping)
, _supportsTiles(supportsTiles)
, _supportsMultiResolution(supportsMultiResolution)
, _supportsRenderScale(supportsRenderScale)
, _defaultUnpremult(defaultUnpremult)
, _defaultProcessAlphaOnRGBA(defaultProcessAlphaOnRGBA)
, _premultChanged(0)
{
    _dstClip = fetchClip(kOfxImageEffectOutputClipName);
    assert(_dstClip && (_dstClip->getPixelComponents() == OFX::ePixelComponentRGB ||
                        _dstClip->getPixelComponents() == OFX::ePixelComponentRGBA));
    if (isFilter) {
        _srcClip = getContext() == OFX::eContextGenerator ? NULL : fetchClip(kOfxImageEffectSimpleSourceClipName);
        assert((!_srcClip && getContext() == OFX::eContextGenerator) ||
               (_srcClip && (_srcClip->getPixelComponents() == OFX::ePixelComponentRGB ||
                             _srcClip->getPixelComponents() == OFX::ePixelComponentRGBA)));
        _maskClip = fetchClip(getContext() == OFX::eContextPaint ? "Brush" : "Mask");
        assert(!_maskClip || _maskClip->getPixelComponents() == OFX::ePixelComponentAlpha);
    }

    if (paramExists(kNatronOfxParamProcessR)) {
        _processR = fetchBooleanParam(kNatronOfxParamProcessR);
        _processG = fetchBooleanParam(kNatronOfxParamProcessG);
        _processB = fetchBooleanParam(kNatronOfxParamProcessB);
        _processA = fetchBooleanParam(kNatronOfxParamProcessA);
        assert(_processR && _processG && _processB && _processA);
    }
    _premult = fetchBooleanParam(kParamPremult);
    _premultChannel = fetchChoiceParam(kParamPremultChannel);
    assert(_premult && _premultChannel);
    _mix = fetchDoubleParam(kParamMix);
    _maskApply = paramExists(kParamMaskApply) ? fetchBooleanParam(kParamMaskApply) : 0;
    _maskInvert = fetchBooleanParam(kParamMaskInvert);
    assert(_mix && _maskInvert);
    _premultChanged = fetchBooleanParam(kParamPremultChanged);
    assert(_premultChanged);
}
Exemplo n.º 2
0
bool Transport::decideCompression() {
  assert(m_compressionDecision == CompressionDecision::NotDecidedYet);

  if (!RuntimeOption::ForceCompressionURL.empty() &&
      getCommand() == RuntimeOption::ForceCompressionURL) {
    m_compressionDecision = CompressionDecision::HasTo;
    return true;
  }

  if (acceptEncoding("gzip") ||
      (!RuntimeOption::ForceCompressionCookie.empty() &&
       cookieExists(RuntimeOption::ForceCompressionCookie.c_str())) ||
      (!RuntimeOption::ForceCompressionParam.empty() &&
       paramExists(RuntimeOption::ForceCompressionParam.c_str()))) {
    m_compressionDecision = CompressionDecision::Should;
    return true;
  }

  m_compressionDecision = CompressionDecision::ShouldNot;
  return false;
}