本文整理汇总了C++中PaintLayer::paintsWithTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ PaintLayer::paintsWithTransform方法的具体用法?C++ PaintLayer::paintsWithTransform怎么用?C++ PaintLayer::paintsWithTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PaintLayer
的用法示例。
在下文中一共展示了PaintLayer::paintsWithTransform方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updatePaintOffsetTranslation
void PaintPropertyTreeBuilder::updatePaintOffsetTranslation(const LayoutObject& object, PaintPropertyTreeBuilderContext& context)
{
if (object.isBoxModelObject()) {
// TODO(trchen): Eliminate PaintLayer dependency.
PaintLayer* layer = toLayoutBoxModelObject(object).layer();
if (!layer || !layer->paintsWithTransform(GlobalPaintNormalPhase))
return;
}
if (context.paintOffset == LayoutPoint())
return;
// We should use the same subpixel paint offset values for snapping regardless of whether a
// transform is present. If there is a transform we round the paint offset but keep around
// the residual fractional component for the transformed content to paint with.
// In spv1 this was called "subpixel accumulation". For more information, see
// PaintLayer::subpixelAccumulation() and PaintLayerPainter::paintFragmentByApplyingTransform.
IntPoint roundedPaintOffset = roundedIntPoint(context.paintOffset);
LayoutPoint fractionalPaintOffset = LayoutPoint(context.paintOffset - roundedPaintOffset);
RefPtr<TransformPaintPropertyNode> paintOffsetTranslation = TransformPaintPropertyNode::create(
TransformationMatrix().translate(roundedPaintOffset.x(), roundedPaintOffset.y()),
FloatPoint3D(), context.currentTransform);
context.currentTransform = paintOffsetTranslation.get();
context.paintOffset = fractionalPaintOffset;
object.getMutableForPainting().ensureObjectPaintProperties().setPaintOffsetTranslation(paintOffsetTranslation.release());
}
示例2: updatePaintOffsetTranslation
void PaintPropertyTreeBuilder::updatePaintOffsetTranslation(
const LayoutObject& object,
PaintPropertyTreeBuilderContext& context) {
bool usesPaintOffsetTranslation = false;
if (RuntimeEnabledFeatures::rootLayerScrollingEnabled() &&
object.isLayoutView()) {
// Root layer scrolling always creates a translation node for LayoutView to
// ensure fixed and absolute contexts use the correct transform space.
usesPaintOffsetTranslation = true;
} else if (object.isBoxModelObject() &&
context.current.paintOffset != LayoutPoint()) {
// TODO(trchen): Eliminate PaintLayer dependency.
PaintLayer* layer = toLayoutBoxModelObject(object).layer();
if (layer && layer->paintsWithTransform(GlobalPaintNormalPhase))
usesPaintOffsetTranslation = true;
}
// We should use the same subpixel paint offset values for snapping
// regardless of whether a transform is present. If there is a transform
// we round the paint offset but keep around the residual fractional
// component for the transformed content to paint with. In spv1 this was
// called "subpixel accumulation". For more information, see
// PaintLayer::subpixelAccumulation() and
// PaintLayerPainter::paintFragmentByApplyingTransform.
IntPoint roundedPaintOffset = roundedIntPoint(context.current.paintOffset);
LayoutPoint fractionalPaintOffset =
LayoutPoint(context.current.paintOffset - roundedPaintOffset);
if (usesPaintOffsetTranslation) {
object.getMutableForPainting()
.ensurePaintProperties()
.updatePaintOffsetTranslation(
context.current.transform,
TransformationMatrix().translate(roundedPaintOffset.x(),
roundedPaintOffset.y()),
FloatPoint3D(), context.current.shouldFlattenInheritedTransform,
context.current.renderingContextID);
} else {
if (auto* properties = object.getMutableForPainting().paintProperties())
properties->clearPaintOffsetTranslation();
}
const auto* properties = object.paintProperties();
if (properties && properties->paintOffsetTranslation()) {
context.current.transform = properties->paintOffsetTranslation();
context.current.paintOffset = fractionalPaintOffset;
if (RuntimeEnabledFeatures::rootLayerScrollingEnabled() &&
object.isLayoutView()) {
context.absolutePosition.transform = properties->paintOffsetTranslation();
context.fixedPosition.transform = properties->paintOffsetTranslation();
context.absolutePosition.paintOffset = LayoutPoint();
context.fixedPosition.paintOffset = LayoutPoint();
}
}
}
示例3: updatePaintOffsetTranslation
void PaintPropertyTreeBuilder::updatePaintOffsetTranslation(
const LayoutObject& object,
PaintPropertyTreeBuilderContext& context) {
if (object.isBoxModelObject() &&
context.current.paintOffset != LayoutPoint()) {
// TODO(trchen): Eliminate PaintLayer dependency.
PaintLayer* layer = toLayoutBoxModelObject(object).layer();
if (layer && layer->paintsWithTransform(GlobalPaintNormalPhase)) {
// We should use the same subpixel paint offset values for snapping
// regardless of whether a transform is present. If there is a transform
// we round the paint offset but keep around the residual fractional
// component for the transformed content to paint with. In spv1 this was
// called "subpixel accumulation". For more information, see
// PaintLayer::subpixelAccumulation() and
// PaintLayerPainter::paintFragmentByApplyingTransform.
IntPoint roundedPaintOffset =
roundedIntPoint(context.current.paintOffset);
LayoutPoint fractionalPaintOffset =
LayoutPoint(context.current.paintOffset - roundedPaintOffset);
context.current.transform =
object.getMutableForPainting()
.ensurePaintProperties()
.updatePaintOffsetTranslation(
context.current.transform,
TransformationMatrix().translate(roundedPaintOffset.x(),
roundedPaintOffset.y()),
FloatPoint3D(),
context.current.shouldFlattenInheritedTransform,
context.current.renderingContextID);
context.current.paintOffset = fractionalPaintOffset;
return;
}
}
if (object.isLayoutView())
return;
if (auto* properties = object.getMutableForPainting().paintProperties())
properties->clearPaintOffsetTranslation();
}
示例4: createPaintOffsetTranslationIfNeeded
static PassRefPtr<TransformPaintPropertyNode> createPaintOffsetTranslationIfNeeded(const LayoutObject& object, PaintPropertyTreeBuilderContext& context)
{
bool shouldCreatePaintOffsetTranslationNode = false;
if (object.isSVGRoot()) {
// SVG doesn't use paint offset internally so emit a paint offset at the html->svg boundary.
shouldCreatePaintOffsetTranslationNode = true;
} else if (object.isBoxModelObject()) {
// TODO(trchen): Eliminate PaintLayer dependency.
PaintLayer* layer = toLayoutBoxModelObject(object).layer();
shouldCreatePaintOffsetTranslationNode = layer && layer->paintsWithTransform(GlobalPaintNormalPhase);
}
if (context.paintOffset == LayoutPoint() || !shouldCreatePaintOffsetTranslationNode)
return nullptr;
RefPtr<TransformPaintPropertyNode> newTransformNodeForPaintOffsetTranslation = TransformPaintPropertyNode::create(
TransformationMatrix().translate(context.paintOffset.x(), context.paintOffset.y()),
FloatPoint3D(), context.currentTransform);
context.currentTransform = newTransformNodeForPaintOffsetTranslation.get();
context.paintOffset = LayoutPoint();
return newTransformNodeForPaintOffsetTranslation.release();
}