本文整理汇总了C++中FloatPoint::move方法的典型用法代码示例。如果您正苦于以下问题:C++ FloatPoint::move方法的具体用法?C++ FloatPoint::move怎么用?C++ FloatPoint::move使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FloatPoint
的用法示例。
在下文中一共展示了FloatPoint::move方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: blendAnimatedFloatPoint
FloatPoint SVGPathBlender::blendAnimatedFloatPoint(const FloatPoint& fromPoint, const FloatPoint& toPoint)
{
if (m_fromMode == m_toMode)
return blendFloatPoint(fromPoint, toPoint, m_progress);
// Transform toPoint to the coordinate mode of fromPoint
FloatPoint animatedPoint = toPoint;
if (m_fromMode == AbsoluteCoordinates)
animatedPoint += m_toCurrentPoint;
else
animatedPoint.move(-m_toCurrentPoint.x(), -m_toCurrentPoint.y());
animatedPoint = blendFloatPoint(fromPoint, animatedPoint, m_progress);
if (m_isInFirstHalfOfAnimation)
return animatedPoint;
// Transform the animated point to the coordinate mode, needed for the current progress.
FloatPoint currentPoint = blendFloatPoint(m_fromCurrentPoint, m_toCurrentPoint, m_progress);
if (m_toMode == AbsoluteCoordinates)
return animatedPoint + currentPoint;
animatedPoint.move(-currentPoint.x(), -currentPoint.y());
return animatedPoint;
}
示例2: getScreenCTM
TransformationMatrix SVGSVGElement::getScreenCTM() const
{
document()->updateLayoutIgnorePendingStylesheets();
FloatPoint rootLocation;
if (RenderObject* renderer = this->renderer()) {
if (isOutermostSVG()) {
// FIXME: This doesn't work correctly with CSS transforms.
FloatPoint point;
if (renderer->parent())
point = renderer->localToAbsolute(point, true);
rootLocation.move(point.x(), point.y());
} else
rootLocation.move(x().value(this), y().value(this));
}
TransformationMatrix mat = SVGStyledLocatableElement::getScreenCTM();
mat.translate(rootLocation.x(), rootLocation.y());
if (attributes()->getAttributeItem(SVGNames::viewBoxAttr)) {
TransformationMatrix viewBox = viewBoxToViewTransform(width().value(this), height().value(this));
mat = viewBox * mat;
}
return mat;
}
示例3: blendAnimatedFloatPointSameCoordinates
FloatPoint SVGPathBlender::BlendState::blendAnimatedFloatPoint(
const FloatPoint& fromPoint,
const FloatPoint& toPoint) {
if (m_typesAreEqual)
return blendAnimatedFloatPointSameCoordinates(fromPoint, toPoint);
// Transform toPoint to the coordinate mode of fromPoint
FloatPoint animatedPoint = toPoint;
if (m_fromIsAbsolute)
animatedPoint += m_toCurrentPoint;
else
animatedPoint.move(-m_toCurrentPoint.x(), -m_toCurrentPoint.y());
animatedPoint = blendFloatPoint(fromPoint, animatedPoint, m_progress);
// If we're in the first half of the animation, we should use the type of the
// from segment.
if (m_isInFirstHalfOfAnimation)
return animatedPoint;
// Transform the animated point to the coordinate mode, needed for the current
// progress.
FloatPoint currentPoint =
blendFloatPoint(m_fromCurrentPoint, m_toCurrentPoint, m_progress);
if (!m_fromIsAbsolute)
return animatedPoint + currentPoint;
animatedPoint.move(-currentPoint.x(), -currentPoint.y());
return animatedPoint;
}
示例4: advance
void SVGGlyphToPathTranslator::advance()
{
do {
if (m_glyph) {
float advance = m_glyphBuffer.advanceAt(m_index).width();
if (m_isVerticalText)
m_currentPoint.move(0, advance);
else
m_currentPoint.move(advance, 0);
}
++m_index;
if (m_index >= m_stoppingPoint || !m_glyphBuffer.fontDataAt(m_index)->isSVGFont())
break;
m_glyph = m_glyphBuffer.glyphAt(m_index);
if (!m_glyph)
continue;
m_svgGlyph = m_fontElement.svgGlyphForGlyph(m_glyph);
ASSERT(!m_svgGlyph.isPartOfLigature);
ASSERT(m_svgGlyph.tableEntry == m_glyph);
SVGGlyphElement::inheritUnspecifiedAttributes(m_svgGlyph, &m_svgFontData);
} while ((!m_glyph || m_svgGlyph.pathData.isEmpty()) && m_index < m_stoppingPoint);
if (containsMorePaths() && m_isVerticalText) {
m_glyphOrigin.setX(m_svgGlyph.verticalOriginX * m_scale);
m_glyphOrigin.setY(m_svgGlyph.verticalOriginY * m_scale);
}
}
示例5: combinedTextSize
Optional<FloatPoint> RenderCombineText::computeTextOrigin(const FloatRect& boxRect) const
{
if (!m_isCombined)
return Nullopt;
// Visually center m_combinedTextWidth/Ascent/Descent within boxRect
FloatPoint result = boxRect.minXMaxYCorner();
FloatSize combinedTextSize(m_combinedTextWidth, m_combinedTextAscent + m_combinedTextDescent);
result.move((boxRect.size().transposedSize() - combinedTextSize) / 2);
result.move(0, m_combinedTextAscent);
return result;
}
示例6: updateWidgetPosition
void RenderWidget::updateWidgetPosition()
{
if (!m_widget)
return;
// FIXME: This doesn't work correctly with transforms.
FloatPoint absPos = localToAbsolute();
absPos.move(borderLeft() + paddingLeft(), borderTop() + paddingTop());
int w = width() - borderLeft() - borderRight() - paddingLeft() - paddingRight();
int h = height() - borderTop() - borderBottom() - paddingTop() - paddingBottom();
IntRect newBounds(absPos.x(), absPos.y(), w, h);
IntRect oldBounds(m_widget->frameRect());
if (newBounds != oldBounds) {
// The widget changed positions. Update the frame geometry.
if (checkForRepaintDuringLayout()) {
RenderView* v = view();
if (!v->printing()) {
// FIXME: do container-relative repaint
v->repaintRectangleInViewAndCompositedLayers(oldBounds);
v->repaintRectangleInViewAndCompositedLayers(newBounds);
}
}
RenderArena* arena = ref();
element()->ref();
m_widget->setFrameRect(newBounds);
element()->deref();
deref(arena);
}
}
示例7: updateWidgetPosition
void RenderWidget::updateWidgetPosition()
{
if (!m_widget)
return;
// FIXME: This doesn't work correctly with transforms.
FloatPoint absPos = localToAbsolute();
absPos.move(borderLeft() + paddingLeft(), borderTop() + paddingTop());
int w = width() - borderLeft() - borderRight() - paddingLeft() - paddingRight();
int h = height() - borderTop() - borderBottom() - paddingTop() - paddingBottom();
IntRect newBounds(absPos.x(), absPos.y(), w, h);
IntRect oldBounds(m_widget->frameRect());
bool boundsChanged = newBounds != oldBounds;
if (boundsChanged) {
RenderArena* arena = ref();
node()->ref();
m_widget->setFrameRect(newBounds);
node()->deref();
deref(arena);
}
// if the frame bounds got changed, or if view needs layout (possibly indicating
// content size is wrong) we have to do a layout to set the right widget size
if (m_widget->isFrameView()) {
FrameView* frameView = static_cast<FrameView*>(m_widget.get());
if (boundsChanged || frameView->needsLayout())
frameView->layout();
}
}
示例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));
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);
}
示例9: parseCurveToQuadraticSmoothSegment
bool SVGPathParser::parseCurveToQuadraticSmoothSegment()
{
FloatPoint targetPoint;
if (!m_source.parseCurveToQuadraticSmoothSegment(targetPoint))
return false;
if (m_lastCommand != PathSegCurveToQuadraticAbs
&& m_lastCommand != PathSegCurveToQuadraticRel
&& m_lastCommand != PathSegCurveToQuadraticSmoothAbs
&& m_lastCommand != PathSegCurveToQuadraticSmoothRel)
m_controlPoint = m_currentPoint;
if (m_pathParsingMode == NormalizedParsing) {
FloatPoint cubicPoint = m_currentPoint;
cubicPoint.scale(2);
cubicPoint.move(-m_controlPoint.x(), -m_controlPoint.y());
FloatPoint point1(m_currentPoint.x() + 2 * cubicPoint.x(), m_currentPoint.y() + 2 * cubicPoint.y());
FloatPoint point2(targetPoint.x() + 2 * cubicPoint.x(), targetPoint.y() + 2 * cubicPoint.y());
if (m_mode == RelativeCoordinates) {
point2 += m_currentPoint;
targetPoint += m_currentPoint;
}
point1.scale(gOneOverThree);
point2.scale(gOneOverThree);
m_consumer.curveToCubic(point1, point2, targetPoint, AbsoluteCoordinates);
m_controlPoint = cubicPoint;
m_currentPoint = targetPoint;
} else
m_consumer.curveToQuadraticSmooth(targetPoint, m_mode);
return true;
}
示例10: drawBidiText
void GraphicsContext::drawBidiText(const Font& font, const TextRun& run, const FloatPoint& point)
{
if (paintingDisabled())
return;
BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver;
bidiResolver.setStatus(BidiStatus(run.direction(), run.directionalOverride()));
bidiResolver.setPosition(TextRunIterator(&run, 0));
// FIXME: This ownership should be reversed. We should pass BidiRunList
// to BidiResolver in createBidiRunsForLine.
BidiRunList<BidiCharacterRun>& bidiRuns = bidiResolver.runs();
bidiResolver.createBidiRunsForLine(TextRunIterator(&run, run.length()));
if (!bidiRuns.runCount())
return;
FloatPoint currPoint = point;
BidiCharacterRun* bidiRun = bidiRuns.firstRun();
while (bidiRun) {
TextRun subrun = run;
subrun.setText(run.data(bidiRun->start()), bidiRun->stop() - bidiRun->start());
bool isRTL = bidiRun->level() % 2;
subrun.setDirection(isRTL ? RTL : LTR);
subrun.setDirectionalOverride(bidiRun->dirOverride(false));
font.drawText(this, subrun, currPoint);
bidiRun = bidiRun->next();
// FIXME: Have Font::drawText return the width of what it drew so that we don't have to re-measure here.
if (bidiRun)
currPoint.move(font.width(subrun), 0);
}
bidiRuns.deleteRuns();
}
示例11: 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);
}
示例12: drawBidiText
void GraphicsContext::drawBidiText(const Font& font, const TextRun& run, const FloatPoint& point)
{
if (paintingDisabled())
return;
BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver;
WTF::Unicode::Direction paragraphDirection = run.ltr() ? WTF::Unicode::LeftToRight : WTF::Unicode::RightToLeft;
bidiResolver.setStatus(BidiStatus(paragraphDirection, paragraphDirection, paragraphDirection, new BidiContext(run.ltr() ? 0 : 1, paragraphDirection, run.directionalOverride())));
bidiResolver.setPosition(TextRunIterator(&run, 0));
bidiResolver.createBidiRunsForLine(TextRunIterator(&run, run.length()));
if (!bidiResolver.runCount())
return;
FloatPoint currPoint = point;
BidiCharacterRun* bidiRun = bidiResolver.firstRun();
while (bidiRun) {
TextRun subrun = run;
subrun.setText(run.data(bidiRun->start()), bidiRun->stop() - bidiRun->start());
subrun.setRTL(bidiRun->level() % 2);
subrun.setDirectionalOverride(bidiRun->dirOverride(false));
font.drawText(this, subrun, currPoint);
bidiRun = bidiRun->next();
// FIXME: Have Font::drawText return the width of what it drew so that we don't have to re-measure here.
if (bidiRun)
currPoint.move(font.floatWidth(subrun), 0.f);
}
bidiResolver.deleteRuns();
}
示例13: drawBidiText
void GraphicsContext::drawBidiText(const FontCascade& font, const TextRun& run, const FloatPoint& point, FontCascade::CustomFontNotReadyAction customFontNotReadyAction)
{
if (paintingDisabled())
return;
BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver;
bidiResolver.setStatus(BidiStatus(run.direction(), run.directionalOverride()));
bidiResolver.setPositionIgnoringNestedIsolates(TextRunIterator(&run, 0));
// FIXME: This ownership should be reversed. We should pass BidiRunList
// to BidiResolver in createBidiRunsForLine.
BidiRunList<BidiCharacterRun>& bidiRuns = bidiResolver.runs();
bidiResolver.createBidiRunsForLine(TextRunIterator(&run, run.length()));
if (!bidiRuns.runCount())
return;
FloatPoint currPoint = point;
BidiCharacterRun* bidiRun = bidiRuns.firstRun();
while (bidiRun) {
TextRun subrun = run.subRun(bidiRun->start(), bidiRun->stop() - bidiRun->start());
bool isRTL = bidiRun->level() % 2;
subrun.setDirection(isRTL ? RTL : LTR);
subrun.setDirectionalOverride(bidiRun->dirOverride(false));
float width = font.drawText(*this, subrun, currPoint, 0, -1, customFontNotReadyAction);
currPoint.move(width, 0);
bidiRun = bidiRun->next();
}
bidiRuns.deleteRuns();
}
示例14: glyphSize
static inline void calculateGlyphBoundaries(const QueryData* queryData, const SVGTextFragment& fragment, int startPosition, FloatRect& extent)
{
float scalingFactor = queryData->textLayoutObject->scalingFactor();
ASSERT(scalingFactor);
FloatPoint glyphPosition = calculateGlyphPositionWithoutTransform(queryData, fragment, startPosition);
glyphPosition.move(0, -queryData->textLayoutObject->scaledFont().fontMetrics().floatAscent() / scalingFactor);
extent.setLocation(glyphPosition);
// Use the SVGTextMetrics computed by SVGTextMetricsBuilder (which spends
// time attempting to compute more correct glyph bounds already, handling
// cursive scripts to some degree.)
const Vector<SVGTextMetrics>& textMetricsValues = queryData->textLayoutObject->layoutAttributes()->textMetricsValues();
const SVGTextMetrics& metrics = findMetricsForCharacter(textMetricsValues, fragment, startPosition);
// TODO(fs): Negative glyph extents seems kind of weird to have, but
// presently it can occur in some cases (like Arabic.)
FloatSize glyphSize(std::max<float>(metrics.width(), 0), std::max<float>(metrics.height(), 0));
extent.setSize(glyphSize);
// If RTL, adjust the starting point to align with the LHS of the glyph bounding box.
if (!queryData->textBox->isLeftToRightDirection()) {
if (queryData->isVerticalText)
extent.move(0, -glyphSize.height());
else
extent.move(-glyphSize.width(), 0);
}
AffineTransform fragmentTransform;
fragment.buildFragmentTransform(fragmentTransform, SVGTextFragment::TransformIgnoringTextLength);
extent = fragmentTransform.mapRect(extent);
}
示例15: getPhase
static inline FloatPoint getPhase(const FloatRect& dest, const FloatRect& tile)
{
FloatPoint phase = dest.location();
phase.move(-tile.x(), -tile.y());
return phase;
}