本文整理汇总了C++中FloatPoint::moveBy方法的典型用法代码示例。如果您正苦于以下问题:C++ FloatPoint::moveBy方法的具体用法?C++ FloatPoint::moveBy怎么用?C++ FloatPoint::moveBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FloatPoint
的用法示例。
在下文中一共展示了FloatPoint::moveBy方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paint
void EllipsisBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
{
GraphicsContext* context = paintInfo.context;
RenderStyle* style = renderer().style(isFirstLineStyle());
const Font& font = style->font();
FloatPoint boxOrigin = locationIncludingFlipping();
boxOrigin.moveBy(FloatPoint(paintOffset));
if (!isHorizontal())
boxOrigin.move(0, -virtualLogicalHeight());
FloatRect boxRect(boxOrigin, LayoutSize(logicalWidth(), virtualLogicalHeight()));
GraphicsContextStateSaver stateSaver(*context);
if (!isHorizontal())
context->concatCTM(InlineTextBox::rotation(boxRect, InlineTextBox::Clockwise));
FloatPoint textOrigin(boxOrigin.x(), boxOrigin.y() + font.fontMetrics().ascent());
bool isPrinting = renderer().document().printing();
bool haveSelection = !isPrinting && paintInfo.phase != PaintPhaseTextClip && selectionState() != RenderObject::SelectionNone;
if (haveSelection)
paintSelection(context, boxOrigin, style, font);
else if (paintInfo.phase == PaintPhaseSelection)
return;
TextPainter::Style textStyle = TextPainter::textPaintingStyle(renderer(), style, paintInfo.forceBlackText(), isPrinting);
if (haveSelection)
textStyle = TextPainter::selectionPaintingStyle(renderer(), true, paintInfo.forceBlackText(), isPrinting, textStyle);
TextRun textRun = constructTextRun(&renderer(), font, m_str, style, TextRun::AllowTrailingExpansion);
TextPainter textPainter(context, font, textRun, textOrigin, boxRect, isHorizontal());
textPainter.paint(0, m_str.length(), m_str.length(), textStyle);
paintMarkupBox(paintInfo, paintOffset, lineTop, lineBottom, style);
}
示例2: rootFrameToViewport
FloatPoint VisualViewport::rootFrameToViewport(const FloatPoint& pointInRootFrame) const
{
FloatPoint pointInViewport = pointInRootFrame;
pointInViewport.moveBy(-location());
pointInViewport.scale(scale(), scale());
return pointInViewport;
}
示例3: nodeAtPoint
bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
{
LayoutPoint adjustedLocation = accumulatedOffset + roundedLayoutPoint(topLeft());
// Hit test the markup box.
if (InlineBox* markupBox = this->markupBox()) {
RenderStyle* style = renderer().style(isFirstLineStyle());
LayoutUnit mtx = adjustedLocation.x() + m_logicalWidth - markupBox->x();
LayoutUnit mty = adjustedLocation.y() + style->fontMetrics().ascent() - (markupBox->y() + markupBox->renderer().style(isFirstLineStyle())->fontMetrics().ascent());
if (markupBox->nodeAtPoint(request, result, locationInContainer, LayoutPoint(mtx, mty), lineTop, lineBottom)) {
renderer().updateHitTestResult(result, locationInContainer.point() - LayoutSize(mtx, mty));
return true;
}
}
FloatPoint boxOrigin = locationIncludingFlipping();
boxOrigin.moveBy(accumulatedOffset);
FloatRect boundsRect(boxOrigin, size());
if (visibleToHitTestRequest(request) && boundsRect.intersects(HitTestLocation::rectForPoint(locationInContainer.point(), 0, 0, 0, 0))) {
renderer().updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation));
if (!result.addNodeToRectBasedTestResult(renderer().node(), request, locationInContainer, boundsRect))
return true;
}
return false;
}
示例4: viewportCSSPixelsToRootFrame
FloatPoint VisualViewport::viewportCSSPixelsToRootFrame(const FloatPoint& point) const
{
// Note, this is in CSS Pixels so we don't apply scale.
FloatPoint pointInRootFrame = point;
pointInRootFrame.moveBy(location());
return pointInRootFrame;
}
示例5: viewportToRootFrame
FloatPoint VisualViewport::viewportToRootFrame(const FloatPoint& pointInViewport) const
{
FloatPoint pointInRootFrame = pointInViewport;
pointInRootFrame.scale(1 / scale(), 1 / scale());
pointInRootFrame.moveBy(location());
return pointInRootFrame;
}
示例6: paint
void EllipsisBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
{
GraphicsContext* context = paintInfo.context;
RenderStyle* style = renderer().style(isFirstLineStyle());
const Font& font = style->font();
FloatPoint boxOrigin = locationIncludingFlipping();
boxOrigin.moveBy(FloatPoint(paintOffset));
if (!isHorizontal())
boxOrigin.move(0, -virtualLogicalHeight());
FloatRect boxRect(boxOrigin, LayoutSize(logicalWidth(), virtualLogicalHeight()));
GraphicsContextStateSaver stateSaver(*context);
if (!isHorizontal())
context->concatCTM(InlineTextBox::rotation(boxRect, InlineTextBox::Clockwise));
FloatPoint textOrigin = FloatPoint(boxOrigin.x(), boxOrigin.y() + font.fontMetrics().ascent());
Color styleTextColor = renderer().resolveColor(style, CSSPropertyWebkitTextFillColor);
if (styleTextColor != context->fillColor())
context->setFillColor(styleTextColor);
if (selectionState() != RenderObject::SelectionNone) {
paintSelection(context, boxOrigin, style, font);
// Select the correct color for painting the text.
Color foreground = paintInfo.forceBlackText() ? Color::black : renderer().selectionForegroundColor();
if (foreground != styleTextColor)
context->setFillColor(foreground);
}
// Text shadows are disabled when printing. http://crbug.com/258321
const ShadowList* shadowList = context->printing() ? 0 : style->textShadow();
bool hasShadow = shadowList;
if (hasShadow) {
OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create();
for (size_t i = shadowList->shadows().size(); i--; ) {
const ShadowData& shadow = shadowList->shadows()[i];
float shadowX = isHorizontal() ? shadow.x() : shadow.y();
float shadowY = isHorizontal() ? shadow.y() : -shadow.x();
FloatSize offset(shadowX, shadowY);
drawLooperBuilder->addShadow(offset, shadow.blur(), shadow.color(),
DrawLooperBuilder::ShadowRespectsTransforms, DrawLooperBuilder::ShadowIgnoresAlpha);
}
drawLooperBuilder->addUnmodifiedContent();
context->setDrawLooper(drawLooperBuilder.release());
}
TextRun textRun = RenderBlockFlow::constructTextRun(&renderer(), font, m_str, style, TextRun::AllowTrailingExpansion);
TextRunPaintInfo textRunPaintInfo(textRun);
textRunPaintInfo.bounds = boxRect;
context->drawText(font, textRunPaintInfo, textOrigin);
// Restore the regular fill color.
if (styleTextColor != context->fillColor())
context->setFillColor(styleTextColor);
if (hasShadow)
context->clearDrawLooper();
paintMarkupBox(paintInfo, paintOffset, lineTop, lineBottom, style);
}
示例7: userScroll
ScrollResultOneDimensional ScrollAnimator::userScroll(
ScrollbarOrientation orientation, ScrollGranularity granularity, float step, float delta)
{
if (!m_scrollableArea->scrollAnimatorEnabled())
return ScrollAnimatorBase::userScroll(orientation, granularity, step, delta);
TRACE_EVENT0("blink", "ScrollAnimator::scroll");
if (granularity == ScrollByPrecisePixel)
return ScrollAnimatorBase::userScroll(orientation, granularity, step, delta);
float usedPixelDelta = computeDeltaToConsume(orientation, step * delta);
FloatPoint pixelDelta = (orientation == VerticalScrollbar
? FloatPoint(0, usedPixelDelta) : FloatPoint(usedPixelDelta, 0));
FloatPoint targetPos = desiredTargetPosition();
targetPos.moveBy(pixelDelta);
if (m_animationCurve) {
if ((targetPos - m_targetOffset).isZero()) {
// Report unused delta only if there is no animation running. See
// comment below regarding scroll latching.
return ScrollResultOneDimensional(/* didScroll */ true, /* unusedScrollDelta */ 0);
}
m_targetOffset = targetPos;
ASSERT(m_runState == RunState::RunningOnMainThread
|| m_runState == RunState::RunningOnCompositor
|| m_runState == RunState::RunningOnCompositorButNeedsUpdate);
if (m_runState == RunState::RunningOnCompositor
|| m_runState == RunState::RunningOnCompositorButNeedsUpdate) {
if (registerAndScheduleAnimation())
m_runState = RunState::RunningOnCompositorButNeedsUpdate;
return ScrollResultOneDimensional(/* didScroll */ true, /* unusedScrollDelta */ 0);
}
// Running on the main thread, simply update the target offset instead
// of sending to the compositor.
m_animationCurve->updateTarget(m_timeFunction() - m_startTime, targetPos);
return ScrollResultOneDimensional(/* didScroll */ true, /* unusedScrollDelta */ 0);
}
if ((targetPos - currentPosition()).isZero()) {
// Report unused delta only if there is no animation and we are not
// starting one. This ensures we latch for the duration of the
// animation rather than animating multiple scrollers at the same time.
return ScrollResultOneDimensional(/* didScroll */ false, delta);
}
m_targetOffset = targetPos;
m_startTime = m_timeFunction();
if (registerAndScheduleAnimation())
m_runState = RunState::WaitingToSendToCompositor;
return ScrollResultOneDimensional(/* didScroll */ true, /* unusedScrollDelta */ 0);
}
示例8: paint
void EllipsisBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
{
GraphicsContext* context = paintInfo.context;
RenderStyle* style = renderer().style(isFirstLineStyle());
const Font& font = style->font();
FloatPoint boxOrigin = locationIncludingFlipping();
boxOrigin.moveBy(FloatPoint(paintOffset));
FloatRect boxRect(boxOrigin, LayoutSize(logicalWidth(), virtualLogicalHeight()));
GraphicsContextStateSaver stateSaver(*context);
FloatPoint textOrigin = FloatPoint(boxOrigin.x(), boxOrigin.y() + font.fontMetrics().ascent());
Color styleTextColor = renderer().resolveColor(style, CSSPropertyWebkitTextFillColor);
if (styleTextColor != context->fillColor())
context->setFillColor(styleTextColor);
if (selectionState() != RenderObject::SelectionNone) {
paintSelection(context, boxOrigin, style, font);
// Select the correct color for painting the text.
Color foreground = paintInfo.forceBlackText() ? Color::black : renderer().selectionForegroundColor();
if (foreground != styleTextColor)
context->setFillColor(foreground);
}
const ShadowList* shadowList = style->textShadow();
bool hasShadow = shadowList;
if (hasShadow)
context->setDrawLooper(shadowList->createDrawLooper(DrawLooperBuilder::ShadowIgnoresAlpha));
TextRun textRun = constructTextRun(&renderer(), font, m_str, style, TextRun::AllowTrailingExpansion);
TextRunPaintInfo textRunPaintInfo(textRun);
textRunPaintInfo.bounds = boxRect;
context->drawText(font, textRunPaintInfo, textOrigin);
// Restore the regular fill color.
if (styleTextColor != context->fillColor())
context->setFillColor(styleTextColor);
if (hasShadow)
context->clearDrawLooper();
paintMarkupBox(paintInfo, paintOffset, lineTop, lineBottom, style);
}
示例9: blinkOffsetFromCompositorOffset
FloatPoint ScrollAnimatorCompositorCoordinator::blinkOffsetFromCompositorOffset(FloatPoint offset)
{
offset.moveBy(-scrollableArea()->scrollOrigin());
return offset;
}