FloatRect CCRenderSurface::drawableContentRect() const { FloatRect localContentRect(-0.5 * m_contentRect.width(), -0.5 * m_contentRect.height(), m_contentRect.width(), m_contentRect.height()); FloatRect drawableContentRect = m_drawTransform.mapRect(localContentRect); if (hasReplica()) drawableContentRect.unite(m_replicaDrawTransform.mapRect(localContentRect)); return drawableContentRect; }
void CCRenderSurface::drawReplica(LayerRendererChromium* layerRenderer) { ASSERT(hasReplica()); if (!hasReplica() || m_skipsDraw || !m_contentsTexture) return; // Apply filters to the contents texture. SkBitmap filterBitmap = applyFilters(layerRenderer, m_filters, m_contentsTexture.get()); // FIXME: By using the same RenderSurface for both the content and its reflection, // it's currently not possible to apply a separate mask to the reflection layer // or correctly handle opacity in reflections (opacity must be applied after drawing // both the layer and its reflection). The solution is to introduce yet another RenderSurface // to draw the layer and its reflection in. For now we only apply a separate reflection // mask if the contents don't have a mask of their own. CCLayerImpl* replicaMaskLayer = m_maskLayer; if (!m_maskLayer && m_owningLayer->replicaLayer()) replicaMaskLayer = m_owningLayer->replicaLayer()->maskLayer(); int contentsTextureId = getSkBitmapTextureId(filterBitmap, m_contentsTexture->textureId()); drawLayer(layerRenderer, replicaMaskLayer, m_replicaDrawTransform, contentsTextureId); }
bool RenderSurfaceChromium::replicaHasMask() const { return hasReplica() && (m_maskLayer || m_owningLayer->replicaLayer()->maskLayer()); }