本文整理汇总了C++中FloatRect::maxY方法的典型用法代码示例。如果您正苦于以下问题:C++ FloatRect::maxY方法的具体用法?C++ FloatRect::maxY怎么用?C++ FloatRect::maxY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FloatRect
的用法示例。
在下文中一共展示了FloatRect::maxY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unite
void FloatRect::unite(const FloatRect& other)
{
// Handle empty special cases first.
if (other.isEmpty())
return;
if (isEmpty()) {
*this = other;
return;
}
float l = min(x(), other.x());
float t = min(y(), other.y());
float r = max(maxX(), other.maxX());
float b = max(maxY(), other.maxY());
setLocationAndSizeFromEdges(l, t, r, b);
}
示例2: intersect
void FloatRect::intersect(const FloatRect& other)
{
float left = std::max(x(), other.x());
float top = std::max(y(), other.y());
float right = std::min(maxX(), other.maxX());
float bottom = std::min(maxY(), other.maxY());
// Return a clean empty rectangle for non-intersecting cases.
if (left >= right || top >= bottom) {
left = 0;
top = 0;
right = 0;
bottom = 0;
}
setLocationAndSizeFromEdges(left, top, right, bottom);
}
示例3: computeStickyOffset
FloatSize StickyPositionViewportConstraints::computeStickyOffset(const FloatRect& viewportRect) const
{
FloatRect boxRect = m_absoluteStickyBoxRect;
if (hasAnchorEdge(AnchorEdgeRight)) {
float rightLimit = viewportRect.maxX() - m_rightOffset;
float rightDelta = std::min<float>(0, rightLimit - m_absoluteStickyBoxRect.maxX());
float availableSpace = std::min<float>(0, m_absoluteContainingBlockRect.x() - m_absoluteStickyBoxRect.x());
if (rightDelta < availableSpace)
rightDelta = availableSpace;
boxRect.move(rightDelta, 0);
}
if (hasAnchorEdge(AnchorEdgeLeft)) {
float leftLimit = viewportRect.x() + m_leftOffset;
float leftDelta = std::max<float>(0, leftLimit - m_absoluteStickyBoxRect.x());
float availableSpace = std::max<float>(0, m_absoluteContainingBlockRect.maxX() - m_absoluteStickyBoxRect.maxX());
if (leftDelta > availableSpace)
leftDelta = availableSpace;
boxRect.move(leftDelta, 0);
}
if (hasAnchorEdge(AnchorEdgeBottom)) {
float bottomLimit = viewportRect.maxY() - m_bottomOffset;
float bottomDelta = std::min<float>(0, bottomLimit - m_absoluteStickyBoxRect.maxY());
float availableSpace = std::min<float>(0, m_absoluteContainingBlockRect.y() - m_absoluteStickyBoxRect.y());
if (bottomDelta < availableSpace)
bottomDelta = availableSpace;
boxRect.move(0, bottomDelta);
}
if (hasAnchorEdge(AnchorEdgeTop)) {
float topLimit = viewportRect.y() + m_topOffset;
float topDelta = std::max<float>(0, topLimit - m_absoluteStickyBoxRect.y());
float availableSpace = std::max<float>(0, m_absoluteContainingBlockRect.maxY() - m_absoluteStickyBoxRect.maxY());
if (topDelta > availableSpace)
topDelta = availableSpace;
boxRect.move(0, topDelta);
}
return boxRect.location() - m_absoluteStickyBoxRect.location();
}
示例4: uniteIfNonZero
void FloatRect::uniteIfNonZero(const FloatRect& other)
{
// Handle empty special cases first.
if (!other.width() && !other.height())
return;
if (!width() && !height()) {
*this = other;
return;
}
float left = min(x(), other.x());
float top = min(y(), other.y());
float right = max(maxX(), other.maxX());
float bottom = max(maxY(), other.maxY());
setLocationAndSizeFromEdges(left, top, right, bottom);
}
示例5: intersect
void FloatRect::intersect(const FloatRect& other)
{
float l = max(x(), other.x());
float t = max(y(), other.y());
float r = min(maxX(), other.maxX());
float b = min(maxY(), other.maxY());
// Return a clean empty rectangle for non-intersecting cases.
if (l >= r || t >= b) {
l = 0;
t = 0;
r = 0;
b = 0;
}
setLocationAndSizeFromEdges(l, t, r, b);
}
示例6: widthSet
WindowFeatures::WindowFeatures(const String& dialogFeaturesString, const FloatRect& screenAvailableRect)
: widthSet(true)
, heightSet(true)
, menuBarVisible(false)
, toolBarVisible(false)
, locationBarVisible(false)
, fullscreen(false)
, dialog(true)
{
DialogFeaturesMap features;
parseDialogFeatures(dialogFeaturesString, features);
const bool trusted = false;
// The following features from Microsoft's documentation are not implemented:
// - default font settings
// - width, height, left, and top specified in units other than "px"
// - edge (sunken or raised, default is raised)
// - dialogHide: trusted && boolFeature(features, "dialoghide"), makes dialog hide when you print
// - help: boolFeature(features, "help", true), makes help icon appear in dialog (what does it do on Windows?)
// - unadorned: trusted && boolFeature(features, "unadorned");
width = floatFeature(features, "dialogwidth", 100, screenAvailableRect.width(), 620); // default here came from frame size of dialog in MacIE
height = floatFeature(features, "dialogheight", 100, screenAvailableRect.height(), 450); // default here came from frame size of dialog in MacIE
x = floatFeature(features, "dialogleft", screenAvailableRect.x(), screenAvailableRect.maxX() - width, -1);
xSet = x > 0;
y = floatFeature(features, "dialogtop", screenAvailableRect.y(), screenAvailableRect.maxY() - height, -1);
ySet = y > 0;
if (boolFeature(features, "center", true)) {
if (!xSet) {
x = screenAvailableRect.x() + (screenAvailableRect.width() - width) / 2;
xSet = true;
}
if (!ySet) {
y = screenAvailableRect.y() + (screenAvailableRect.height() - height) / 2;
ySet = true;
}
}
resizable = boolFeature(features, "resizable");
scrollbarsVisible = boolFeature(features, "scroll", true);
statusBarVisible = boolFeature(features, "status", !trusted);
}
示例7: beginLayerClippedToImage
void PlatformContextSkia::beginLayerClippedToImage(const FloatRect& rect,
const ImageBuffer* imageBuffer)
{
SkRect bounds = { SkFloatToScalar(rect.x()), SkFloatToScalar(rect.y()),
SkFloatToScalar(rect.maxX()), SkFloatToScalar(rect.maxY()) };
if (imageBuffer->internalSize().isEmpty()) {
m_canvas->clipRect(bounds);
return;
}
// Skia doesn't support clipping to an image, so we create a layer. The next
// time restore is invoked the layer and |imageBuffer| are combined to
// create the resulting image.
m_state->m_clip = bounds;
// Get the absolute coordinates of the stored clipping rectangle to make it
// independent of any transform changes.
canvas()->getTotalMatrix().mapRect(&m_state->m_clip);
SkCanvas::SaveFlags saveFlags = static_cast<SkCanvas::SaveFlags>(SkCanvas::kHasAlphaLayer_SaveFlag | SkCanvas::kFullColorLayer_SaveFlag);
saveLayer(&bounds, 0, saveFlags);
const SkBitmap* bitmap = imageBuffer->context()->platformContext()->bitmap();
if (m_trackOpaqueRegion) {
SkRect opaqueRect = bitmap->isOpaque() ? m_state->m_clip : SkRect::MakeEmpty();
m_opaqueRegion.setImageMask(opaqueRect);
}
// Copy off the image as |imageBuffer| may be deleted before restore is invoked.
if (!bitmap->pixelRef()) {
// The bitmap owns it's pixels. This happens when we've allocated the
// pixels in some way and assigned them directly to the bitmap (as
// happens when we allocate a DIB). In this case the assignment operator
// does not copy the pixels, rather the copied bitmap ends up
// referencing the same pixels. As the pixels may not live as long as we
// need it to, we copy the image.
bitmap->copyTo(&m_state->m_imageBufferClip, SkBitmap::kARGB_8888_Config);
} else {
// If there is a pixel ref, we can safely use the assignment operator.
m_state->m_imageBufferClip = *bitmap;
}
}
示例8: parseDialogFeatures
WindowFeatures parseDialogFeatures(const String& dialogFeaturesString, const FloatRect& screenAvailableRect)
{
auto featuresMap = parseDialogFeaturesMap(dialogFeaturesString);
// The following features from Microsoft's documentation are not implemented:
// - default font settings
// - width, height, left, and top specified in units other than "px"
// - edge (sunken or raised, default is raised)
// - dialogHide: trusted && boolFeature(features, "dialoghide"), makes dialog hide when you print
// - help: boolFeature(features, "help", true), makes help icon appear in dialog (what does it do on Windows?)
// - unadorned: trusted && boolFeature(features, "unadorned");
WindowFeatures features;
features.menuBarVisible = false;
features.toolBarVisible = false;
features.locationBarVisible = false;
features.dialog = true;
float width = floatFeature(featuresMap, "dialogwidth", 100, screenAvailableRect.width()).valueOr(620); // default here came from frame size of dialog in MacIE
float height = floatFeature(featuresMap, "dialogheight", 100, screenAvailableRect.height()).valueOr(450); // default here came from frame size of dialog in MacIE
features.width = width;
features.height = height;
features.x = floatFeature(featuresMap, "dialogleft", screenAvailableRect.x(), screenAvailableRect.maxX() - width);
features.y = floatFeature(featuresMap, "dialogtop", screenAvailableRect.y(), screenAvailableRect.maxY() - height);
if (boolFeature(featuresMap, "center").valueOr(true)) {
if (!features.x)
features.x = screenAvailableRect.x() + (screenAvailableRect.width() - width) / 2;
if (!features.y)
features.y = screenAvailableRect.y() + (screenAvailableRect.height() - height) / 2;
}
features.resizable = boolFeature(featuresMap, "resizable").valueOr(false);
features.scrollbarsVisible = boolFeature(featuresMap, "scroll").valueOr(true);
features.statusBarVisible = boolFeature(featuresMap, "status").valueOr(false);
return features;
}
示例9: rightMostCornerToVector
static inline FloatPoint rightMostCornerToVector(const FloatRect& rect, const FloatSize& vector)
{
// Return the corner of the rectangle that if it is to the left of the vector
// would mean all of the rectangle is to the left of the vector.
// The vector here represents the side between two points in a clockwise convex polygon.
//
// Q XXX
// QQQ XXX If the lower left corner of X is left of the vector that goes from the top corner of Q to
// QQQ the right corner of Q, then all of X is left of the vector, and intersection impossible.
// Q
//
FloatPoint point;
if (vector.width() >= 0)
point.setY(rect.maxY());
else
point.setY(rect.y());
if (vector.height() >= 0)
point.setX(rect.x());
else
point.setX(rect.maxX());
return point;
}
示例10: paintMediaMuteButton
bool RenderThemeWinCE::paintMediaMuteButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
{
bool rc = paintButton(o, paintInfo, r);
HTMLMediaElement* mediaElement = mediaElementParent(o->node());
bool muted = !mediaElement || mediaElement->muted();
FloatRect imRect = r;
imRect.inflate(-2);
paintInfo.context->save();
paintInfo.context->setStrokeColor(Color::black);
paintInfo.context->setFillColor(Color::black);
FloatPoint pts[6] = {
FloatPoint(imRect.x() + 1, imRect.y() + imRect.height() / 3.0),
FloatPoint(imRect.x() + 1 + imRect.width() / 2.0, imRect.y() + imRect.height() / 3.0),
FloatPoint(imRect.maxX() - 1, imRect.y()),
FloatPoint(imRect.maxX() - 1, imRect.maxY()),
FloatPoint(imRect.x() + 1 + imRect.width() / 2.0, imRect.y() + 2.0 * imRect.height() / 3.0),
FloatPoint(imRect.x() + 1, imRect.y() + 2.0 * imRect.height() / 3.0)
};
paintInfo.context->drawConvexPolygon(6, pts);
if (muted)
paintInfo.context->drawLine(IntPoint(imRect.maxX(), imRect.y()), IntPoint(imRect.x(), imRect.maxY()));
paintInfo.context->restore();
return rc;
}
示例11: contains
bool FloatRect::contains(const FloatRect& other) const
{
return x() <= other.x() && maxX() >= other.maxX()
&& y() <= other.y() && maxY() >= other.maxY();
}
示例12: paintMediaPlayButton
bool RenderThemeWinCE::paintMediaPlayButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
{
bool rc = paintButton(o, paintInfo, r);
FloatRect imRect = r;
imRect.inflate(-3);
paintInfo.context->save();
paintInfo.context->setStrokeColor(Color::black);
paintInfo.context->setFillColor(Color::black);
HTMLMediaElement* mediaElement = mediaElementParent(o->node());
bool paused = !mediaElement || mediaElement->paused();
if (paused) {
float width = imRect.width();
imRect.setWidth(width / 3.0);
paintInfo.context->fillRect(imRect);
imRect.move(2.0 * width / 3.0, 0);
paintInfo.context->fillRect(imRect);
} else {
FloatPoint pts[3] = { FloatPoint(imRect.x(), imRect.y()), FloatPoint(imRect.maxX(), (imRect.y() + imRect.maxY()) / 2.0), FloatPoint(imRect.x(), imRect.maxY()) };
paintInfo.context->drawConvexPolygon(3, pts);
}
paintInfo.context->restore();
return rc;
}
示例13: computeTileCoverageRect
FloatRect TileController::computeTileCoverageRect(const FloatSize& newSize, const FloatRect& previousVisibleRect, const FloatRect& visibleRect, float contentsScale) const
{
// If the page is not in a window (for example if it's in a background tab), we limit the tile coverage rect to the visible rect.
if (!m_isInWindow)
return visibleRect;
#if PLATFORM(IOS)
// FIXME: unify the iOS and Mac code.
UNUSED_PARAM(previousVisibleRect);
if (m_tileCoverage == CoverageForVisibleArea || MemoryPressureHandler::singleton().isUnderMemoryPressure())
return visibleRect;
double horizontalMargin = tileSize().width() / contentsScale;
double verticalMargin = tileSize().height() / contentsScale;
double currentTime = monotonicallyIncreasingTime();
double timeDelta = currentTime - m_velocity.lastUpdateTime;
FloatRect futureRect = visibleRect;
futureRect.setLocation(FloatPoint(
futureRect.location().x() + timeDelta * m_velocity.horizontalVelocity,
futureRect.location().y() + timeDelta * m_velocity.verticalVelocity));
if (m_velocity.horizontalVelocity) {
futureRect.setWidth(futureRect.width() + horizontalMargin);
if (m_velocity.horizontalVelocity < 0)
futureRect.setX(futureRect.x() - horizontalMargin);
}
if (m_velocity.verticalVelocity) {
futureRect.setHeight(futureRect.height() + verticalMargin);
if (m_velocity.verticalVelocity < 0)
futureRect.setY(futureRect.y() - verticalMargin);
}
if (!m_velocity.horizontalVelocity && !m_velocity.verticalVelocity) {
if (m_velocity.scaleChangeRate > 0)
return visibleRect;
futureRect.setWidth(futureRect.width() + horizontalMargin);
futureRect.setHeight(futureRect.height() + verticalMargin);
futureRect.setX(futureRect.x() - horizontalMargin / 2);
futureRect.setY(futureRect.y() - verticalMargin / 2);
}
// Can't use m_tileCacheLayer->bounds() here, because the size of the underlying platform layer
// hasn't been updated for the current commit.
IntSize contentSize = expandedIntSize(newSize);
if (futureRect.maxX() > contentSize.width())
futureRect.setX(contentSize.width() - futureRect.width());
if (futureRect.maxY() > contentSize.height())
futureRect.setY(contentSize.height() - futureRect.height());
if (futureRect.x() < 0)
futureRect.setX(0);
if (futureRect.y() < 0)
futureRect.setY(0);
return futureRect;
#else
UNUSED_PARAM(contentsScale);
// FIXME: look at how far the document can scroll in each dimension.
float coverageHorizontalSize = visibleRect.width();
float coverageVerticalSize = visibleRect.height();
bool largeVisibleRectChange = !previousVisibleRect.isEmpty() && !visibleRect.intersects(previousVisibleRect);
// Inflate the coverage rect so that it covers 2x of the visible width and 3x of the visible height.
// These values were chosen because it's more common to have tall pages and to scroll vertically,
// so we keep more tiles above and below the current area.
if (m_tileCoverage & CoverageForHorizontalScrolling && !largeVisibleRectChange)
coverageHorizontalSize *= 2;
if (m_tileCoverage & CoverageForVerticalScrolling && !largeVisibleRectChange)
coverageVerticalSize *= 3;
coverageVerticalSize += topMarginHeight() + bottomMarginHeight();
coverageHorizontalSize += leftMarginWidth() + rightMarginWidth();
// Can't use m_tileCacheLayer->bounds() here, because the size of the underlying platform layer
// hasn't been updated for the current commit.
FloatRect coverageBounds = boundsForSize(newSize);
float coverageLeft = visibleRect.x() - (coverageHorizontalSize - visibleRect.width()) / 2;
coverageLeft = std::min(coverageLeft, coverageBounds.maxX() - coverageHorizontalSize);
coverageLeft = std::max(coverageLeft, coverageBounds.x());
float coverageTop = visibleRect.y() - (coverageVerticalSize - visibleRect.height()) / 2;
coverageTop = std::min(coverageTop, coverageBounds.maxY() - coverageVerticalSize);
coverageTop = std::max(coverageTop, coverageBounds.y());
return FloatRect(coverageLeft, coverageTop, coverageHorizontalSize, coverageVerticalSize);
#endif
}
示例14: intersects
bool FloatRect::intersects(const FloatRect& other) const {
// Checking emptiness handles negative widths as well as zero.
return !isEmpty() && !other.isEmpty() && x() < other.maxX() &&
other.x() < maxX() && y() < other.maxY() && other.y() < maxY();
}
示例15: advanceInternal
//.........这里部分代码省略.........
bool treatAsSpace = Font::treatAsSpace(character);
if (treatAsSpace || (expandAroundIdeographs && Font::isCJKIdeographOrSymbol(character))) {
// Distribute the run's total expansion evenly over all expansion opportunities in the run.
if (m_expansion) {
float previousExpansion = m_expansion;
if (!treatAsSpace && !m_isAfterExpansion) {
// Take the expansion opportunity before this ideograph.
m_expansion -= m_expansionPerOpportunity;
float expansionAtThisOpportunity = !m_run.applyWordRounding() ? m_expansionPerOpportunity : roundf(previousExpansion) - roundf(m_expansion);
m_runWidthSoFar += expansionAtThisOpportunity;
if (glyphBuffer) {
if (glyphBuffer->isEmpty())
glyphBuffer->add(fontData->spaceGlyph(), fontData, expansionAtThisOpportunity);
else
glyphBuffer->expandLastAdvance(expansionAtThisOpportunity);
}
previousExpansion = m_expansion;
}
if (m_run.allowsTrailingExpansion() || (m_run.ltr() && textIterator.currentCharacter() + advanceLength < static_cast<size_t>(m_run.length()))
|| (m_run.rtl() && textIterator.currentCharacter())) {
m_expansion -= m_expansionPerOpportunity;
width += !m_run.applyWordRounding() ? m_expansionPerOpportunity : roundf(previousExpansion) - roundf(m_expansion);
m_isAfterExpansion = true;
}
} else
m_isAfterExpansion = false;
// Account for word spacing.
// We apply additional space between "words" by adding width to the space character.
if (treatAsSpace && (character != '\t' || !m_run.allowTabs()) && textIterator.currentCharacter() && m_font->wordSpacing())
width += m_font->wordSpacing();
} else
m_isAfterExpansion = false;
}
if (shouldApplyFontTransforms() && glyphBuffer && Font::treatAsSpace(character))
charactersTreatedAsSpace.append(make_pair(glyphBuffer->size(),
OriginalAdvancesForCharacterTreatedAsSpace(character == ' ', glyphBuffer->size() ? glyphBuffer->advanceAt(glyphBuffer->size() - 1) : 0, width)));
if (m_accountForGlyphBounds) {
bounds = fontData->boundsForGlyph(glyph);
if (!textIterator.currentCharacter())
m_firstGlyphOverflow = max<float>(0, -bounds.x());
}
if (m_forTextEmphasis && !Font::canReceiveTextEmphasis(character))
glyph = 0;
// Advance past the character we just dealt with.
textIterator.advance(advanceLength);
float oldWidth = width;
// Force characters that are used to determine word boundaries for the rounding hack
// to be integer width, so following words will start on an integer boundary.
if (m_run.applyWordRounding() && Font::isRoundingHackCharacter(character)) {
width = ceilf(width);
// Since widthSinceLastRounding can lose precision if we include measurements for
// preceding whitespace, we bypass it here.
m_runWidthSoFar += width;
// Since this is a rounding hack character, we should have reset this sum on the previous
// iteration.
ASSERT(!widthSinceLastRounding);
} else {
// Check to see if the next character is a "rounding hack character", if so, adjust
// width so that the total run width will be on an integer boundary.
if ((m_run.applyWordRounding() && textIterator.currentCharacter() < m_run.length() && Font::isRoundingHackCharacter(*(textIterator.characters())))
|| (m_run.applyRunRounding() && textIterator.currentCharacter() >= m_run.length())) {
float totalWidth = widthSinceLastRounding + width;
widthSinceLastRounding = ceilf(totalWidth);
width += widthSinceLastRounding - totalWidth;
m_runWidthSoFar += widthSinceLastRounding;
widthSinceLastRounding = 0;
} else
widthSinceLastRounding += width;
}
if (glyphBuffer)
glyphBuffer->add(glyph, fontData, (rtl ? oldWidth + lastRoundingWidth : width));
lastRoundingWidth = width - oldWidth;
if (m_accountForGlyphBounds) {
m_maxGlyphBoundingBoxY = max(m_maxGlyphBoundingBoxY, bounds.maxY());
m_minGlyphBoundingBoxY = min(m_minGlyphBoundingBoxY, bounds.y());
m_lastGlyphOverflow = max<float>(0, bounds.maxX() - width);
}
}
if (shouldApplyFontTransforms())
m_runWidthSoFar += applyFontTransforms(glyphBuffer, m_run.ltr(), lastGlyphCount, lastFontData, m_typesettingFeatures, charactersTreatedAsSpace);
unsigned consumedCharacters = textIterator.currentCharacter() - m_currentCharacter;
m_currentCharacter = textIterator.currentCharacter();
m_runWidthSoFar += widthSinceLastRounding;
m_finalRoundingWidth = lastRoundingWidth;
return consumedCharacters;
}