IntRect LayerAndroid::visibleContentArea(bool force3dContentVisible) const { IntRect area = fullContentArea(); if (subclassType() == LayerAndroid::FixedBackgroundImageLayer) return area; // If transform isn't limited to 2D space, return the entire content area. // Transforming from layers to content coordinates and back doesn't // preserve 3D. if (force3dContentVisible && GLUtils::has3dTransform(m_drawTransform)) return area; // First, we get the transformed area of the layer, // in content coordinates IntRect rect = m_drawTransform.mapRect(area); // Then we apply the clipping IntRect clip(m_clippingRect); rect.intersect(clip); // Now clip with the viewport in content coordinate IntRect contentViewport(TilesManager::instance()->shader()->contentViewport()); rect.intersect(contentViewport); // Finally, let's return the visible area, in layers coordinate return m_drawTransform.inverse().mapRect(rect); }
void Surface::computeTexturesAmount(TexturesResult* result) { if (!m_surfaceBacking || isBase()) return; LayerAndroid* layer = 0; if (singleLayer()) layer = getFirstLayer(); m_surfaceBacking->computeTexturesAmount(result, visibleContentArea(), fullContentArea(), layer); }
IntRect Surface::computePrepareArea() { IntRect area; if (!getFirstLayer()->contentIsScrollable() && !isBase() && getFirstLayer()->state()->layersRenderingMode() == GLWebViewState::kAllTextures) { area = fullContentArea(); double total = ((double) area.width()) * ((double) area.height()); if (total > MAX_FULL_CONTENT_AREA) area = visibleContentArea(); } else area = visibleContentArea(); return area; }
IntRect Surface::computePrepareArea() { IntRect area; if (!getFirstLayer()->contentIsScrollable() && !isBase() && getFirstLayer()->state()->layersRenderingMode() == GLWebViewState::kAllTextures) { area = fullContentArea(); double total = ((double) area.width()) * ((double) area.height()); // CAPP_WEB_PREPARE_VISIBLE_AREA if (total > MAX_FULL_CONTENT_AREA|| m_drawTransform.isIdentityOrTranslation()) area = visibleContentArea(); } else area = visibleContentArea(); return area; }
void Surface::prepareGL(bool layerTilesDisabled, bool updateWithBlit) { bool tilesDisabled = layerTilesDisabled && !isBase(); if (!m_surfaceBacking) { ALOGV("prepareGL on Surf %p, no SurfBack, needsTexture? %d", this, m_surfaceBacking, needsTexture()); if (needsTexture() || (isBase() && layerTilesDisabled)) m_surfaceBacking = new SurfaceBacking(isBase()); else return; } if (tilesDisabled) { m_surfaceBacking->discardTextures(); } else { bool allowZoom = hasText(); // only allow for scale > 1 if painting vectors IntRect prepareArea = computePrepareArea(); IntRect fullArea = fullContentArea(); ALOGV("prepareGL on Surf %p with SurfBack %p, %d layers, first layer %s (%d) " "prepareArea(%d, %d - %d x %d) fullArea(%d, %d - %d x %d)", this, m_surfaceBacking, m_layers.size(), getFirstLayer()->subclassName().ascii().data(), getFirstLayer()->uniqueId(), prepareArea.x(), prepareArea.y(), prepareArea.width(), prepareArea.height(), fullArea.x(), fullArea.y(), fullArea.width(), fullArea.height()); m_surfaceBacking->prepareGL(getFirstLayer()->state(), allowZoom, prepareArea, fullArea, this, useAggressiveRendering(), updateWithBlit); } for (size_t i = 0; i < m_layers.size(); i++) { LayerContent* content = m_layers[i]->content(); if (content) content->clearPrerenders(); } }