本文整理汇总了C++中PlatformCALayer::setNeedsDisplay方法的典型用法代码示例。如果您正苦于以下问题:C++ PlatformCALayer::setNeedsDisplay方法的具体用法?C++ PlatformCALayer::setNeedsDisplay怎么用?C++ PlatformCALayer::setNeedsDisplay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlatformCALayer
的用法示例。
在下文中一共展示了PlatformCALayer::setNeedsDisplay方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: revalidateTiles
void TileGrid::revalidateTiles(TileValidationPolicy validationPolicy)
{
FloatRect coverageRect = m_controller.coverageRect();
IntRect bounds = m_controller.bounds();
if (coverageRect.isEmpty() || bounds.isEmpty())
return;
FloatRect scaledRect(coverageRect);
scaledRect.scale(m_scale);
IntRect coverageRectInTileCoords(enclosingIntRect(scaledRect));
TileCohort currCohort = nextTileCohort();
unsigned tilesInCohort = 0;
double minimumRevalidationTimerDuration = std::numeric_limits<double>::max();
bool needsTileRevalidation = false;
// Move tiles newly outside the coverage rect into the cohort map.
for (TileMap::iterator it = m_tiles.begin(), end = m_tiles.end(); it != end; ++it) {
TileInfo& tileInfo = it->value;
TileIndex tileIndex = it->key;
PlatformCALayer* tileLayer = tileInfo.layer.get();
IntRect tileRect = rectForTileIndex(tileIndex);
if (tileRect.intersects(coverageRectInTileCoords)) {
tileInfo.cohort = VisibleTileCohort;
if (tileInfo.hasStaleContent) {
// FIXME: store a dirty region per layer?
tileLayer->setNeedsDisplay();
tileInfo.hasStaleContent = false;
}
} else {
// Add to the currentCohort if not already in one.
if (tileInfo.cohort == VisibleTileCohort) {
tileInfo.cohort = currCohort;
++tilesInCohort;
if (m_controller.unparentsOffscreenTiles())
tileLayer->removeFromSuperlayer();
} else if (m_controller.unparentsOffscreenTiles() && m_controller.shouldAggressivelyRetainTiles() && tileLayer->superlayer()) {
// Aggressive tile retention means we'll never remove cohorts, but we need to make sure they're unparented.
// We can't immediately unparent cohorts comprised of secondary tiles that never touch the primary coverage rect,
// because that would defeat the usefulness of prepopulateRect(); instead, age prepopulated tiles out as if they were being removed.
for (auto& cohort : m_cohortList) {
if (cohort.cohort != tileInfo.cohort)
continue;
double timeUntilCohortExpires = cohort.timeUntilExpiration();
if (timeUntilCohortExpires > 0) {
minimumRevalidationTimerDuration = std::min(minimumRevalidationTimerDuration, timeUntilCohortExpires);
needsTileRevalidation = true;
} else
tileLayer->removeFromSuperlayer();
break;
}
}
}
}
if (needsTileRevalidation)
m_controller.scheduleTileRevalidation(minimumRevalidationTimerDuration);
if (tilesInCohort)
startedNewCohort(currCohort);
if (!m_controller.shouldAggressivelyRetainTiles()) {
if (m_controller.shouldTemporarilyRetainTileCohorts())
scheduleCohortRemoval();
else if (tilesInCohort)
removeTilesInCohort(currCohort);
}
// Ensure primary tile coverage tiles.
m_primaryTileCoverageRect = ensureTilesForRect(coverageRect, CoverageType::PrimaryTiles);
if (validationPolicy & PruneSecondaryTiles) {
removeAllSecondaryTiles();
m_cohortList.clear();
} else {
for (auto& secondaryCoverageRect : m_secondaryTileCoverageRects) {
FloatRect secondaryRectInLayerCoordinates(secondaryCoverageRect);
secondaryRectInLayerCoordinates.scale(1 / m_scale);
ensureTilesForRect(secondaryRectInLayerCoordinates, CoverageType::SecondaryTiles);
}
m_secondaryTileCoverageRects.clear();
}
if (m_controller.unparentsOffscreenTiles() && (validationPolicy & UnparentAllTiles)) {
for (TileMap::iterator it = m_tiles.begin(), end = m_tiles.end(); it != end; ++it)
it->value.layer->removeFromSuperlayer();
}
auto boundsAtLastRevalidate = m_controller.boundsAtLastRevalidate();
if (boundsAtLastRevalidate != bounds) {
// If there are margin tiles and the bounds have grown taller or wider, then the tiles that used to
// be bottom or right margin tiles need to be invalidated.
if (m_controller.hasMargins()) {
if (bounds.width() > boundsAtLastRevalidate.width() || bounds.height() > boundsAtLastRevalidate.height()) {
IntRect boundsWithoutMargin = m_controller.boundsWithoutMargin();
IntRect oldBoundsWithoutMargin = m_controller.boundsAtLastRevalidateWithoutMargin();
//.........这里部分代码省略.........