IntRect TextureMapperLayer::intermediateSurfaceRect(const TransformationMatrix& matrix) { IntRect rect; TransformationMatrix localTransform = TransformationMatrix(matrix).multiply(m_transform.combined()); rect = enclosingIntRect(localTransform.mapRect(layerRect())); if (!m_state.masksToBounds && !m_state.maskLayer) { for (size_t i = 0; i < m_children.size(); ++i) rect.unite(m_children[i]->intermediateSurfaceRect(matrix)); } #if ENABLE(CSS_FILTERS) if (m_filters.hasOutsets()) { int leftOutset; int topOutset; int bottomOutset; int rightOutset; m_filters.getOutsets(topOutset, rightOutset, bottomOutset, leftOutset); IntRect unfilteredTargetRect(rect); rect.move(std::max(0, -leftOutset), std::max(0, -topOutset)); rect.expand(leftOutset + rightOutset, topOutset + bottomOutset); rect.unite(unfilteredTargetRect); } #endif if (m_state.replicaLayer) rect.unite(m_state.replicaLayer->intermediateSurfaceRect(matrix)); return rect; }
IntRect CCRenderSurface::computeReadbackDeviceBoundingBox(LayerRendererChromium* layerRenderer, const TransformationMatrix& drawTransform) const { IntRect deviceRect = computeDeviceBoundingBox(layerRenderer, drawTransform); if (m_backgroundFilters.isEmpty()) return deviceRect; int top, right, bottom, left; m_backgroundFilters.getOutsets(top, right, bottom, left); deviceRect.move(-left, -top); deviceRect.expand(left + right, top + bottom); return deviceRect; }
static PassRefPtr<BitmapTexture> applyFilters(const FilterOperations& filters, TextureMapper* textureMapper, BitmapTexture* source, IntRect& targetRect) { if (!filters.size()) return source; RefPtr<BitmapTexture> filterSurface(source); int leftOutset, topOutset, bottomOutset, rightOutset; if (filters.hasOutsets()) { filters.getOutsets(topOutset, rightOutset, bottomOutset, leftOutset); IntRect unfilteredTargetRect(targetRect); targetRect.move(std::max(0, -leftOutset), std::max(0, -topOutset)); targetRect.expand(leftOutset + rightOutset, topOutset + bottomOutset); targetRect.unite(unfilteredTargetRect); filterSurface = textureMapper->acquireTextureFromPool(targetRect.size()); } return filterSurface->applyFilters(*source, filters); }