本文整理汇总了C++中roundedIntPoint函数的典型用法代码示例。如果您正苦于以下问题:C++ roundedIntPoint函数的具体用法?C++ roundedIntPoint怎么用?C++ roundedIntPoint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了roundedIntPoint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: toLayoutBoxModelObject
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: LayoutUnit
void BackgroundImageGeometry::useFixedAttachment(
const LayoutPoint& attachmentPoint) {
LayoutPoint alignedPoint = attachmentPoint;
m_phase.move(std::max(alignedPoint.x() - m_destRect.x(), LayoutUnit()),
std::max(alignedPoint.y() - m_destRect.y(), LayoutUnit()));
setPhase(LayoutPoint(roundedIntPoint(m_phase)));
}
示例3: roundedIntPoint
void RenderWidget::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
IntPoint contentPaintOffset = roundedIntPoint(paintOffset + location() + contentBoxRect().location());
// Tell the widget to paint now. This is the only time the widget is allowed
// to paint itself. That way it will composite properly with z-indexed layers.
LayoutRect paintRect = paintInfo.rect;
IntPoint widgetLocation = m_widget->frameRect().location();
IntSize widgetPaintOffset = contentPaintOffset - widgetLocation;
// When painting widgets into compositing layers, tx and ty are relative to the enclosing compositing layer,
// not the root. In this case, shift the CTM and adjust the paintRect to be root-relative to fix plug-in drawing.
if (!widgetPaintOffset.isZero()) {
paintInfo.context->translate(widgetPaintOffset);
paintRect.move(-widgetPaintOffset);
}
// FIXME: Remove repaintrect encolsing/integral snapping when RenderWidget becomes device pixel snapped.
m_widget->paint(paintInfo.context, snappedIntRect(paintRect));
if (!widgetPaintOffset.isZero())
paintInfo.context->translate(-widgetPaintOffset);
if (is<FrameView>(*m_widget)) {
FrameView& frameView = downcast<FrameView>(*m_widget);
bool runOverlapTests = !frameView.useSlowRepaintsIfNotOverlapped();
if (paintInfo.overlapTestRequests && runOverlapTests) {
ASSERT(!paintInfo.overlapTestRequests->contains(this));
paintInfo.overlapTestRequests->set(this, m_widget->frameRect());
}
}
}
示例4: if
// Generate a synthetic WebMouseEvent given a TouchEvent (eg. for emulating a mouse
// with touch input for plugins that don't support touch input).
WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const LayoutObject* layoutObject, const TouchEvent& event)
{
if (!event.touches())
return;
if (event.touches()->length() != 1) {
if (event.touches()->length() || event.type() != EventTypeNames::touchend || !event.changedTouches() || event.changedTouches()->length() != 1)
return;
}
const Touch* touch = event.touches()->length() == 1 ? event.touches()->item(0) : event.changedTouches()->item(0);
if (touch->identifier())
return;
if (event.type() == EventTypeNames::touchstart)
type = MouseDown;
else if (event.type() == EventTypeNames::touchmove)
type = MouseMove;
else if (event.type() == EventTypeNames::touchend)
type = MouseUp;
else
return;
timeStampSeconds = event.platformTimeStamp();
modifiers = event.modifiers();
// The mouse event co-ordinates should be generated from the co-ordinates of the touch point.
FrameView* view = toFrameView(widget->parent());
// FIXME: if view == nullptr, pointInRootFrame will really be pointInRootContent.
IntPoint pointInRootFrame = roundedIntPoint(touch->absoluteLocation());
if (view)
pointInRootFrame = view->contentsToRootFrame(pointInRootFrame);
IntPoint screenPoint = roundedIntPoint(touch->screenLocation());
globalX = screenPoint.x();
globalY = screenPoint.y();
windowX = pointInRootFrame.x();
windowY = pointInRootFrame.y();
button = WebMouseEvent::ButtonLeft;
modifiers |= WebInputEvent::LeftButtonDown;
clickCount = (type == MouseDown || type == MouseUp);
IntPoint localPoint = convertAbsoluteLocationForLayoutObject(touch->absoluteLocation(), *layoutObject);
x = localPoint.x();
y = localPoint.y();
pointerType = WebPointerProperties::PointerType::Touch;
}
示例5: convertToRenderer
IntRect FrameView::convertToRenderer(const RenderObject& renderer, const IntRect& viewRect) const
{
IntRect rect = viewRect;
// FIXME: we don't have a way to map an absolute rect down to a local quad, so just
// move the rect for now.
rect.setLocation(roundedIntPoint(renderer.absoluteToLocal(rect.location(), UseTransforms)));
return rect;
}
示例6: flowThreadPortionRect
void RenderRegion::adjustRegionBoundsFromFlowThreadPortionRect(const IntPoint& layerOffset, IntRect& regionBounds)
{
LayoutRect flippedFlowThreadPortionRect = flowThreadPortionRect();
flowThread()->flipForWritingMode(flippedFlowThreadPortionRect);
regionBounds.moveBy(roundedIntPoint(flippedFlowThreadPortionRect.location()));
UNUSED_PARAM(layerOffset);
}
示例7: toRenderBox
bool RenderTheme::hitTestMediaControlPart(RenderObject* o, const IntPoint& absPoint)
{
if (!o->isBox())
return false;
FloatPoint localPoint = o->absoluteToLocal(absPoint, false, true); // respect transforms
return toRenderBox(o)->borderBoxRect().contains(roundedIntPoint(localPoint));
}
示例8: roundedIntPoint
void ThreadedCoordinatedLayerTreeHost::setVisibleContentsRect(const FloatRect& rect, const FloatPoint& trajectoryVector, float scale)
{
m_coordinator->setVisibleContentsRect(rect, trajectoryVector);
if (m_lastScrollPosition != roundedIntPoint(rect.location())) {
m_lastScrollPosition = roundedIntPoint(rect.location());
if (!m_webPage->corePage()->mainFrame().view()->useFixedLayout())
m_webPage->corePage()->mainFrame().view()->notifyScrollPositionChanged(m_lastScrollPosition);
}
if (m_lastScaleFactor != scale) {
m_lastScaleFactor = scale;
didScaleFactorChanged(m_lastScaleFactor, m_lastScrollPosition);
}
scheduleLayerFlush();
}
示例9: toSVGSVGElement
void RenderSVGRoot::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
// An empty viewport disables rendering.
if (pixelSnappedBorderBoxRect().isEmpty())
return;
// Don't paint, if the context explicitly disabled it.
if (paintInfo.context->paintingDisabled())
return;
// SVG outlines are painted during PaintPhaseForeground.
if (paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline)
return;
// An empty viewBox also disables rendering.
// (http://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute)
SVGSVGElement* svg = toSVGSVGElement(node());
ASSERT(svg);
if (svg->hasEmptyViewBox())
return;
// Don't paint if we don't have kids, except if we have filters we should paint those.
if (!firstChild()) {
SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this);
if (!resources || !resources->filter())
return;
}
// Make a copy of the PaintInfo because applyTransform will modify the damage rect.
PaintInfo childPaintInfo(paintInfo);
childPaintInfo.context->save();
// Apply initial viewport clip
if (shouldApplyViewportClip())
childPaintInfo.context->clip(pixelSnappedIntRect(overflowClipRect(paintOffset)));
// Convert from container offsets (html renderers) to a relative transform (svg renderers).
// Transform from our paint container's coordinate system to our local coords.
IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset);
childPaintInfo.applyTransform(AffineTransform::translation(adjustedPaintOffset.x(), adjustedPaintOffset.y()) * localToBorderBoxTransform());
// SVGRenderingContext must be destroyed before we restore the childPaintInfo.context, because a filter may have
// changed the context and it is only reverted when the SVGRenderingContext destructor finishes applying the filter.
{
SVGRenderingContext renderingContext;
bool continueRendering = true;
if (childPaintInfo.phase == PaintPhaseForeground) {
renderingContext.prepareToRenderSVGContent(this, childPaintInfo);
continueRendering = renderingContext.isRenderingPrepared();
}
if (continueRendering)
RenderBox::paint(childPaintInfo, LayoutPoint());
}
childPaintInfo.context->restore();
}
示例10: result
VisiblePosition WebLocalFrameImpl::visiblePositionForWindowPoint(const WebPoint& point)
{
HitTestRequest request = HitTestRequest::Move | HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::IgnoreClipping;
HitTestResult result(frame()->view()->windowToContents(roundedIntPoint(FloatPoint(point))));
frame()->document()->renderView()->hitTest(request, result.hitTestLocation(), result);
if (Node* node = result.targetNode())
return frame()->selection().selection().visiblePositionRespectingEditingBoundary(result.localPoint(), node);
return VisiblePosition();
}
示例11: if
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();
}
}
}
示例12: convertTargetSpaceQuadToCompositedLayer
static void convertTargetSpaceQuadToCompositedLayer(const FloatQuad& targetSpaceQuad, LayoutObject* targetLayoutObject, const LayoutBoxModelObject& paintInvalidationContainer, FloatQuad& compositedSpaceQuad)
{
DCHECK(targetLayoutObject);
for (unsigned i = 0; i < 4; ++i) {
IntPoint point;
switch (i) {
case 0:
point = roundedIntPoint(targetSpaceQuad.p1());
break;
case 1:
point = roundedIntPoint(targetSpaceQuad.p2());
break;
case 2:
point = roundedIntPoint(targetSpaceQuad.p3());
break;
case 3:
point = roundedIntPoint(targetSpaceQuad.p4());
break;
}
// FIXME: this does not need to be absolute, just in the paint invalidation container's space.
point = targetLayoutObject->frame()->view()->contentsToRootFrame(point);
point = paintInvalidationContainer.frame()->view()->rootFrameToContents(point);
FloatPoint floatPoint = paintInvalidationContainer.absoluteToLocal(point, UseTransforms);
PaintLayer::mapPointInPaintInvalidationContainerToBacking(paintInvalidationContainer, floatPoint);
switch (i) {
case 0:
compositedSpaceQuad.setP1(floatPoint);
break;
case 1:
compositedSpaceQuad.setP2(floatPoint);
break;
case 2:
compositedSpaceQuad.setP3(floatPoint);
break;
case 3:
compositedSpaceQuad.setP4(floatPoint);
break;
}
}
}
示例13: localTransform
bool RenderSVGForeignObject::nodeAtFloatPoint(const HitTestRequest& request, HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction)
{
FloatPoint localPoint = localTransform().inverse().mapPoint(pointInParent);
// Early exit if local point is not contained in clipped viewport area
if (SVGRenderSupport::isOverflowHidden(this) && !m_viewport.contains(localPoint))
return false;
IntPoint roundedLocalPoint = roundedIntPoint(localPoint);
return RenderBlock::nodeAtPoint(request, result, roundedLocalPoint.x(), roundedLocalPoint.y(), 0, 0, hitTestAction);
}
示例14:
WebVector<WebFloatQuad> WebRange::textQuads() const
{
if (isNull())
return WebVector<WebFloatQuad>();
Frame* frame = m_private->ownerDocument() ? m_private->ownerDocument()->frame() : 0;
if (!frame)
return WebVector<WebFloatQuad>();
Vector<FloatQuad> quads;
m_private->textQuads(quads);
for (unsigned i = 0; i < quads.size(); ++i) {
quads[i].setP1(frame->view()->contentsToWindow(roundedIntPoint(quads[i].p1())));
quads[i].setP2(frame->view()->contentsToWindow(roundedIntPoint(quads[i].p2())));
quads[i].setP3(frame->view()->contentsToWindow(roundedIntPoint(quads[i].p3())));
quads[i].setP4(frame->view()->contentsToWindow(roundedIntPoint(quads[i].p4())));
}
return quads;
}
示例15: location
void RenderWidget::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
if (!shouldPaint(paintInfo, paintOffset))
return;
LayoutPoint adjustedPaintOffset = paintOffset + location();
if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection))
paintBoxDecorations(paintInfo, adjustedPaintOffset);
if (paintInfo.phase == PaintPhaseMask) {
paintMask(paintInfo, adjustedPaintOffset);
return;
}
if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && hasOutline())
paintOutline(paintInfo, LayoutRect(adjustedPaintOffset, size()));
if (paintInfo.phase != PaintPhaseForeground)
return;
#if PLATFORM(MAC)
if (style().highlight() != nullAtom && !paintInfo.context->paintingDisabled())
paintCustomHighlight(paintOffset, style().highlight(), true);
#endif
if (style().hasBorderRadius()) {
LayoutRect borderRect = LayoutRect(adjustedPaintOffset, size());
if (borderRect.isEmpty())
return;
// Push a clip if we have a border radius, since we want to round the foreground content that gets painted.
paintInfo.context->save();
RoundedRect roundedInnerRect = style().getRoundedInnerBorderFor(borderRect,
paddingTop() + borderTop(), paddingBottom() + borderBottom(), paddingLeft() + borderLeft(), paddingRight() + borderRight(), true, true);
clipRoundedInnerRect(paintInfo.context, borderRect, roundedInnerRect);
}
if (m_widget)
paintContents(paintInfo, paintOffset);
if (style().hasBorderRadius())
paintInfo.context->restore();
// Paint a partially transparent wash over selected widgets.
if (isSelected() && !document().printing()) {
// FIXME: selectionRect() is in absolute, not painting coordinates.
paintInfo.context->fillRect(pixelSnappedIntRect(selectionRect()), selectionBackgroundColor(), style().colorSpace());
}
if (hasLayer() && layer()->canResize())
layer()->paintResizer(paintInfo.context, roundedIntPoint(adjustedPaintOffset), paintInfo.rect);
}