コード例 #1
0
bool SVGPaintContext::applyClipMaskAndFilterIfNecessary()
{
#if ENABLE(ASSERT)
    ASSERT(!m_applyClipMaskAndFilterIfNecessaryCalled);
    m_applyClipMaskAndFilterIfNecessaryCalled = true;
#endif

    SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObject(m_object);

    // When rendering clip paths as masks, only geometric operations should be included so skip
    // non-geometric operations such as compositing, masking, and filtering.
    if (m_paintInfo.isRenderingClipPathAsMaskImage()) {
        if (!applyClipIfNecessary(resources))
            return false;
        return true;
    }

    applyCompositingIfNecessary();

    if (!applyClipIfNecessary(resources))
        return false;

    if (!applyMaskIfNecessary(resources))
        return false;

    if (!applyFilterIfNecessary(resources))
        return false;

    if (!isIsolationInstalled() && SVGLayoutSupport::isIsolationRequired(m_object))
        m_compositingRecorder = adoptPtr(new CompositingRecorder(*m_paintInfo.context, *m_object, SkXfermode::kSrcOver_Mode, 1));

    return true;
}
コード例 #2
0
bool SVGPaintContext::applyClipMaskAndFilterIfNecessary() {
#if ENABLE(ASSERT)
  DCHECK(!m_applyClipMaskAndFilterIfNecessaryCalled);
  m_applyClipMaskAndFilterIfNecessaryCalled = true;
#endif

  // When rendering clip paths as masks, only geometric operations should be
  // included so skip non-geometric operations such as compositing, masking, and
  // filtering.
  if (paintInfo().isRenderingClipPathAsMaskImage()) {
    DCHECK(!m_object.isSVGRoot());
    applyClipIfNecessary();
    return true;
  }

  bool isSVGRoot = m_object.isSVGRoot();

  // Layer takes care of root opacity and blend mode.
  if (isSVGRoot) {
    DCHECK(!(m_object.isTransparent() || m_object.styleRef().hasBlendMode()) ||
           m_object.hasLayer());
  } else {
    applyCompositingIfNecessary();
  }

  if (isSVGRoot) {
    DCHECK(!m_object.styleRef().clipPath() || m_object.hasLayer());
  } else {
    applyClipIfNecessary();
  }

  SVGResources* resources =
      SVGResourcesCache::cachedResourcesForLayoutObject(&m_object);

  if (!applyMaskIfNecessary(resources))
    return false;

  if (isSVGRoot) {
    DCHECK(!m_object.styleRef().hasFilter() || m_object.hasLayer());
  } else if (!applyFilterIfNecessary(resources)) {
    return false;
  }

  if (!isIsolationInstalled() &&
      SVGLayoutSupport::isIsolationRequired(&m_object)) {
    m_compositingRecorder = WTF::wrapUnique(new CompositingRecorder(
        paintInfo().context, m_object, SkBlendMode::kSrcOver, 1));
  }

  return true;
}