本文整理汇总了C++中Optional::canUseCache方法的典型用法代码示例。如果您正苦于以下问题:C++ Optional::canUseCache方法的具体用法?C++ Optional::canUseCache怎么用?C++ Optional::canUseCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Optional
的用法示例。
在下文中一共展示了Optional::canUseCache方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paint
void BlockPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
Optional<SubtreeRecorder> subtreeRecorder;
if (needsSubtreeRecorder(m_layoutBlock)) {
subtreeRecorder.emplace(*paintInfo.context, m_layoutBlock, paintInfo.phase);
if (subtreeRecorder->canUseCache())
return;
}
PaintInfo localPaintInfo(paintInfo);
LayoutPoint adjustedPaintOffset = paintOffset + m_layoutBlock.location();
PaintPhase originalPhase = localPaintInfo.phase;
// Check if we need to do anything at all.
LayoutRect overflowBox = overflowRectForPaintRejection();
m_layoutBlock.flipForWritingMode(overflowBox);
overflowBox.moveBy(adjustedPaintOffset);
if (!overflowBox.intersects(LayoutRect(localPaintInfo.rect)))
return;
// There are some cases where not all clipped visual overflow is accounted for.
// FIXME: reduce the number of such cases.
ContentsClipBehavior contentsClipBehavior = ForceContentsClip;
if (m_layoutBlock.hasOverflowClip() && !m_layoutBlock.hasControlClip() && !(m_layoutBlock.shouldPaintSelectionGaps() && originalPhase == PaintPhaseForeground) && !hasCaret())
contentsClipBehavior = SkipContentsClipIfPossible;
if (localPaintInfo.phase == PaintPhaseOutline) {
localPaintInfo.phase = PaintPhaseChildOutlines;
} else if (localPaintInfo.phase == PaintPhaseChildBlockBackground) {
localPaintInfo.phase = PaintPhaseBlockBackground;
m_layoutBlock.paintObject(localPaintInfo, adjustedPaintOffset);
localPaintInfo.phase = PaintPhaseChildBlockBackgrounds;
}
{
BoxClipper boxClipper(m_layoutBlock, localPaintInfo, adjustedPaintOffset, contentsClipBehavior);
m_layoutBlock.paintObject(localPaintInfo, adjustedPaintOffset);
}
if (originalPhase == PaintPhaseOutline) {
localPaintInfo.phase = PaintPhaseSelfOutline;
m_layoutBlock.paintObject(localPaintInfo, adjustedPaintOffset);
localPaintInfo.phase = originalPhase;
} else if (originalPhase == PaintPhaseChildBlockBackground) {
localPaintInfo.phase = originalPhase;
}
// Our scrollbar widgets paint exactly when we tell them to, so that they work properly with
// z-index. We paint after we painted the background/border, so that the scrollbars will
// sit above the background/border.
paintOverflowControlsIfNeeded(localPaintInfo, adjustedPaintOffset);
}