Advertisement
Guest User

Untitled

a guest
May 2nd, 2012
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 10.19 KB | None | 0 0
  1. diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp
  2. index 0a3c2ed..56edff8 100644
  3. --- a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp
  4. +++ b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp
  5. @@ -169,7 +169,13 @@ static inline void reduceOcclusion(const IntRect& affectedArea, const IntRect& e
  6.          IntRect& occlusionRect = affectedOcclusionRects[j];
  7.  
  8.          // Shrink the rect by expanding the non-opaque pixels outside the rect.
  9. -        // To convert the expandedPixel IntRect to outsets:
  10. +
  11. +        // The expandedPixel is the IntRect for a single pixel after being
  12. +        // expanded by filters on the layer. The original pixel would be
  13. +        // IntRect(0, 0, 1, 1), and the expanded pixel is the rect, relative
  14. +        // to this original rect, that the original pixel can influence after
  15. +        // being filtered.
  16. +        // To convert the expandedPixel IntRect back to filter outsets:
  17.          // x = -leftOutset
  18.          // width = leftOutset + rightOutset
  19.          // maxX = x + width = -leftOutset + leftOutset + rightOutset = rightOutset
  20. @@ -189,9 +195,12 @@ static inline void reduceOcclusion(const IntRect& affectedArea, const IntRect& e
  21.  }
  22.  
  23.  template<typename RenderSurfaceType>
  24. -static void reduceOcclusionBelowSurface(RenderSurfaceType* surface, const TransformationMatrix& surfaceTransform, RenderSurfaceType* surfaceTarget, Region& occlusionInTarget, Region& occlusionInScreen)
  25. +static void reduceOcclusionBelowSurface(RenderSurfaceType* surface, const IntRect& surfaceRect, const TransformationMatrix& surfaceTransform, RenderSurfaceType* surfaceTarget, Region& occlusionInTarget, Region& occlusionInScreen)
  26.  {
  27. -    IntRect boundsInTarget = enclosingIntRect(CCMathUtil::mapClippedRect(surfaceTransform, FloatRect(surface->contentRect())));
  28. +    if (surfaceRect.isEmpty())
  29. +        return;
  30. +
  31. +    IntRect boundsInTarget = enclosingIntRect(CCMathUtil::mapClippedRect(surfaceTransform, FloatRect(surfaceRect)));
  32.      if (!surface->clipRect().isEmpty())
  33.          boundsInTarget.intersect(surface->clipRect());
  34.  
  35. @@ -225,6 +234,14 @@ void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::leaveToTargetRenderSu
  36.      if (oldTarget->hasReplica())
  37.          oldTargetOcclusionInNewTarget.unite(transformSurfaceOpaqueRegion<RenderSurfaceType>(oldTarget, m_stack[lastIndex].occlusionInTarget, oldTarget->replicaOriginTransform()));
  38.  
  39. +    IntRect unoccludedSurfaceRect;
  40. +    IntRect unoccludedReplicaRect;
  41. +    if (oldTarget->backgroundFilters().hasFilterThatMovesPixels()) {
  42. +        unoccludedSurfaceRect = unoccludedContributingSurfaceContentRect(oldTarget, false, oldTarget->contentRect());
  43. +        if (oldTarget->hasReplica())
  44. +            unoccludedReplicaRect = unoccludedContributingSurfaceContentRect(oldTarget, true, oldTarget->contentRect());
  45. +    }
  46. +
  47.      if (surfaceWillBeAtTopAfterPop) {
  48.          // Merge the top of the stack down.
  49.          m_stack[lastIndex - 1].occlusionInScreen.unite(m_stack[lastIndex].occlusionInScreen);
  50. @@ -237,9 +254,9 @@ void CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::leaveToTargetRenderSu
  51.      }
  52.  
  53.      if (oldTarget->backgroundFilters().hasFilterThatMovesPixels()) {
  54. -        reduceOcclusionBelowSurface(oldTarget, oldTarget->originTransform(), newTarget, m_stack.last().occlusionInTarget, m_stack.last().occlusionInScreen);
  55. +        reduceOcclusionBelowSurface(oldTarget, unoccludedSurfaceRect, oldTarget->originTransform(), newTarget, m_stack.last().occlusionInTarget, m_stack.last().occlusionInScreen);
  56.          if (oldTarget->hasReplica())
  57. -            reduceOcclusionBelowSurface(oldTarget, oldTarget->replicaOriginTransform(), newTarget, m_stack.last().occlusionInTarget, m_stack.last().occlusionInScreen);
  58. +            reduceOcclusionBelowSurface(oldTarget, unoccludedReplicaRect, oldTarget->replicaOriginTransform(), newTarget, m_stack.last().occlusionInTarget, m_stack.last().occlusionInScreen);
  59.      }
  60.  }
  61.  
  62. @@ -427,11 +444,11 @@ IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContentR
  63.  }
  64.  
  65.  template<typename LayerType, typename RenderSurfaceType>
  66. -IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContributingSurfaceContentRect(const LayerType* layer, bool forReplica, const IntRect& contentRect) const
  67. +IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContributingSurfaceContentRect(const RenderSurfaceType* surface, bool forReplica, const IntRect& contentRect) const
  68.  {
  69.      ASSERT(!m_stack.isEmpty());
  70.      // This should be called while the contributing render surface is still considered the current target in the occlusion tracker.
  71. -    ASSERT(layer->targetRenderSurface() == m_stack.last().surface);
  72. +    ASSERT(surface == m_stack.last().surface);
  73.  
  74.      // A contributing surface doesn't get occluded by things inside its own surface, so only things outside the surface can occlude it. That occlusion is
  75.      // found just below the top of the stack (if it exists).
  76. @@ -440,7 +457,6 @@ IntRect CCOcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContribu
  77.      if (contentRect.isEmpty())
  78.          return contentRect;
  79.  
  80. -    RenderSurfaceType* surface = layer->renderSurface();
  81.      const StackObject& secondLast = m_stack[m_stack.size() - 2];
  82.  
  83.      IntRect surfaceClipRect = surface->clipRect();
  84. @@ -486,7 +502,7 @@ template void CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::leav
  85.  template void CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::markOccludedBehindLayer(const LayerChromium*);
  86.  template bool CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::occluded(const LayerChromium*, const IntRect& contentRect) const;
  87.  template IntRect CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::unoccludedContentRect(const LayerChromium*, const IntRect& contentRect) const;
  88. -template IntRect CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::unoccludedContributingSurfaceContentRect(const LayerChromium*, bool forReplica, const IntRect& contentRect) const;
  89. +template IntRect CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::unoccludedContributingSurfaceContentRect(const RenderSurfaceChromium*, bool forReplica, const IntRect& contentRect) const;
  90.  template IntRect CCOcclusionTrackerBase<LayerChromium, RenderSurfaceChromium>::layerScissorRectInTargetSurface(const LayerChromium*) const;
  91.  
  92.  template CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::CCOcclusionTrackerBase(IntRect scissorRectInScreenSpace, bool recordMetricsForFrame);
  93. @@ -498,7 +514,7 @@ template void CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::leaveToTarge
  94.  template void CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::markOccludedBehindLayer(const CCLayerImpl*);
  95.  template bool CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::occluded(const CCLayerImpl*, const IntRect& contentRect) const;
  96.  template IntRect CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::unoccludedContentRect(const CCLayerImpl*, const IntRect& contentRect) const;
  97. -template IntRect CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::unoccludedContributingSurfaceContentRect(const CCLayerImpl*, bool forReplica, const IntRect& contentRect) const;
  98. +template IntRect CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::unoccludedContributingSurfaceContentRect(const CCRenderSurface*, bool forReplica, const IntRect& contentRect) const;
  99.  template IntRect CCOcclusionTrackerBase<CCLayerImpl, CCRenderSurface>::layerScissorRectInTargetSurface(const CCLayerImpl*) const;
  100.  
  101.  
  102. diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h
  103. index 2705c6b..b802cc6 100644
  104. --- a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h
  105. +++ b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h
  106. @@ -59,9 +59,9 @@ public:
  107.      // Gives an unoccluded sub-rect of |contentRect| in the content space of the layer. Used when considering occlusion for a layer that paints/draws something.
  108.      IntRect unoccludedContentRect(const LayerType*, const IntRect& contentRect) const;
  109.  
  110. -    // Gives an unoccluded sub-rect of |contentRect| in the content space of the surface owned by |layer|. Used when considering occlusion for a contributing surface
  111. +    // Gives an unoccluded sub-rect of |contentRect| in the content space of the surface. Used when considering occlusion for a contributing surface
  112.      // that is rendering into another target surface.
  113. -    IntRect unoccludedContributingSurfaceContentRect(const LayerType*, bool forReplica, const IntRect& contentRect) const;
  114. +    IntRect unoccludedContributingSurfaceContentRect(const RenderSurfaceType*, bool forReplica, const IntRect& contentRect) const;
  115.  
  116.      // Report operations for recording overdraw metrics.
  117.      CCOverdrawMetrics& overdrawMetrics() const { return *m_overdrawMetrics.get(); }
  118. diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp
  119. index 94d1d67..e5fd690 100644
  120. --- a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp
  121. +++ b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp
  122. @@ -71,13 +71,13 @@ bool CCQuadCuller::append(PassOwnPtr<CCDrawQuad> passDrawQuad)
  123.  
  124.  bool CCQuadCuller::appendSurface(PassOwnPtr<CCDrawQuad> passDrawQuad)
  125.  {
  126. -    IntRect culledRect = m_occlusionTracker->unoccludedContributingSurfaceContentRect(m_layer, false, passDrawQuad->quadRect());
  127. +    IntRect culledRect = m_occlusionTracker->unoccludedContributingSurfaceContentRect(m_layer->renderSurface(), false, passDrawQuad->quadRect());
  128.      return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusionTracker);
  129.  }
  130.  
  131.  bool CCQuadCuller::appendReplica(PassOwnPtr<CCDrawQuad> passDrawQuad)
  132.  {
  133. -    IntRect culledRect = m_occlusionTracker->unoccludedContributingSurfaceContentRect(m_layer, true, passDrawQuad->quadRect());
  134. +    IntRect culledRect = m_occlusionTracker->unoccludedContributingSurfaceContentRect(m_layer->renderSurface(), true, passDrawQuad->quadRect());
  135.      return appendQuadInternal(passDrawQuad, culledRect, m_quadList, *m_occlusionTracker);
  136.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement