本文整理汇总了C++中FloatRect::bottom方法的典型用法代码示例。如果您正苦于以下问题:C++ FloatRect::bottom方法的具体用法?C++ FloatRect::bottom怎么用?C++ FloatRect::bottom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FloatRect
的用法示例。
在下文中一共展示了FloatRect::bottom方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mapRect
FloatRect AffineTransform::mapRect(const FloatRect& rect) const
{
if (isIdentityOrTranslation()) {
FloatRect mappedRect(rect);
mappedRect.move(narrowPrecisionToFloat(m_transform[4]), narrowPrecisionToFloat(m_transform[5]));
return mappedRect;
}
FloatQuad result;
result.setP1(mapPoint(rect.location()));
result.setP2(mapPoint(FloatPoint(rect.right(), rect.y())));
result.setP3(mapPoint(FloatPoint(rect.right(), rect.bottom())));
result.setP4(mapPoint(FloatPoint(rect.x(), rect.bottom())));
return result.boundingBox();
}
示例2: intersects
bool FloatRect::intersects(const FloatRect& other) const
{
// Checking emptiness handles negative widths as well as zero.
return !isEmpty() && !other.isEmpty()
&& x() < other.right() && other.x() < right()
&& y() < other.bottom() && other.y() < bottom();
}
示例3: FloatRect
static inline FloatRect normalizeRect(const FloatRect& rect)
{
return FloatRect(min(rect.x(), rect.right()),
min(rect.y(), rect.bottom()),
max(rect.width(), -rect.width()),
max(rect.height(), -rect.height()));
}
示例4: enclosingIntRect
IntRect enclosingIntRect(const FloatRect& rect)
{
int l = static_cast<int>(floorf(rect.x()));
int t = static_cast<int>(floorf(rect.y()));
int r = static_cast<int>(ceilf(rect.right()));
int b = static_cast<int>(ceilf(rect.bottom()));
return IntRect(l, t, r - l, b - t);
}
示例5: enclosingIntRect
IntRect enclosingIntRect(const FloatRect& rect)
{
int l = static_cast<int>(rect.x());
int t = static_cast<int>(rect.y());
// FIXME: These two need to be a "ceiling" operation, not rounding.
// We changed them to do "+ 0.5f" to compile on Win32 where there's
// no ceilf, but they should be changed back to "ceiling" at some point
// and we should provide an implementation of ceilf for Win32.
int r = static_cast<int>(rect.right() + 0.5f);
int b = static_cast<int>(rect.bottom() + 0.5f);
return IntRect(l, t, r - l, b - t);
}
示例6: draw
void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator compositeOp)
{
CGImageRef image = frameAtIndex(m_currentFrame);
if (!image) // If it's too early we won't have an image yet.
return;
if (mayFillWithSolidColor()) {
fillWithSolidColor(ctxt, destRect, solidColor(), compositeOp);
return;
}
CGContextRef context = ctxt->platformContext();
ctxt->save();
// If the source rect is a subportion of the image, then we compute an inflated destination rect that will hold the entire image
// and then set a clip to the portion that we want to display.
CGSize selfSize = size();
FloatRect adjustedDestRect = destRect;
if (srcRect.width() != selfSize.width || srcRect.height() != selfSize.height) {
// A subportion of the image is drawing. Adjust the destination rect to
// account for this.
float xScale = srcRect.width() / destRect.width();
float yScale = srcRect.height() / destRect.height();
adjustedDestRect.setLocation(FloatPoint(destRect.x() - srcRect.x() / xScale, destRect.y() - srcRect.y() / yScale));
adjustedDestRect.setSize(FloatSize(size().width() / xScale, size().height() / yScale));
CGContextClipToRect(context, destRect);
}
// If the image is only partially loaded, then shrink the destination rect that we're drawing into accordingly.
float currHeight = CGImageGetHeight(image);
if (currHeight < selfSize.height)
adjustedDestRect.setHeight(adjustedDestRect.height() * currHeight / selfSize.height);
// Flip the coords.
ctxt->setCompositeOperation(compositeOp);
CGContextTranslateCTM(context, adjustedDestRect.x(), adjustedDestRect.bottom());
CGContextScaleCTM(context, 1, -1);
adjustedDestRect.setLocation(FloatPoint());
// Draw the image.
CGContextDrawImage(context, adjustedDestRect, image);
ctxt->restore();
startAnimation();
if (imageObserver())
imageObserver()->didDraw(this);
}
示例7: 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.right() - width, -1);
xSet = x > 0;
y = floatFeature(features, "dialogtop", screenAvailableRect.y(), screenAvailableRect.bottom() - 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);
}
示例8: 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(right(), other.right());
float b = max(bottom(), other.bottom());
m_location.setX(l);
m_location.setY(t);
m_size.setWidth(r - l);
m_size.setHeight(b - t);
}
示例9: intersect
void FloatRect::intersect(const FloatRect& other)
{
float l = max(x(), other.x());
float t = max(y(), other.y());
float r = min(right(), other.right());
float b = min(bottom(), other.bottom());
// Return a clean empty rectangle for non-intersecting cases.
if (l >= r || t >= b) {
l = 0;
t = 0;
r = 0;
b = 0;
}
m_location.setX(l);
m_location.setY(t);
m_size.setWidth(r - l);
m_size.setHeight(b - t);
}
示例10: tilesInRect
IntRect TiledImageOpenVG::tilesInRect(const FloatRect& rect) const
{
int leftIndex = static_cast<int>(rect.x()) / m_maxTileSize.width();
int topIndex = static_cast<int>(rect.y()) / m_maxTileSize.height();
if (leftIndex < 0)
leftIndex = 0;
if (topIndex < 0)
topIndex = 0;
// Round rect edges up to get the outer pixel boundaries.
int rightIndex = (static_cast<int>(ceil(rect.right())) - 1) / m_maxTileSize.width();
int bottomIndex = (static_cast<int>(ceil(rect.bottom())) - 1) / m_maxTileSize.height();
int columns = (rightIndex - leftIndex) + 1;
int rows = (bottomIndex - topIndex) + 1;
return IntRect(leftIndex, topIndex,
(columns <= m_numColumns) ? columns : m_numColumns,
(rows <= (m_tiles.size() / m_numColumns)) ? rows : (m_tiles.size() / m_numColumns));
}
示例11: inflateForShadow
void SVGRenderStyle::inflateForShadow(FloatRect& repaintRect) const
{
ShadowData* svgShadow = shadow();
if (!svgShadow)
return;
int shadowTop;
int shadowRight;
int shadowBottom;
int shadowLeft;
getSVGShadowExtent(svgShadow, shadowTop, shadowRight, shadowBottom, shadowLeft);
int overflowLeft = repaintRect.x() + shadowLeft;
int overflowRight = repaintRect.right() + shadowRight;
int overflowTop = repaintRect.y() + shadowTop;
int overflowBottom = repaintRect.bottom() + shadowBottom;
repaintRect.setX(overflowLeft);
repaintRect.setY(overflowTop);
repaintRect.setWidth(overflowRight - overflowLeft);
repaintRect.setHeight(overflowBottom - overflowTop);
}
示例12: clip
void GraphicsContextPlatformPrivate::clip(const FloatRect& clipRect)
{
if (!m_hdc)
return;
IntersectClipRect(m_hdc, clipRect.x(), clipRect.y(), clipRect.right(), clipRect.bottom());
}
示例13: contains
bool FloatRect::contains(const FloatRect& other) const
{
return x() <= other.x() && right() >= other.right()
&& y() <= other.y() && bottom() >= other.bottom();
}
示例14: advance
//.........这里部分代码省略.........
// glyphDataForCharacter() returned whether it chose to use a small caps font.
if (!m_font->isSmallCaps() || c == toUpper(c))
m_fallbackFonts->add(fontData);
else {
const GlyphData& uppercaseGlyphData = m_font->glyphDataForCharacter(toUpper(c), rtl);
if (uppercaseGlyphData.fontData != primaryFont)
m_fallbackFonts->add(uppercaseGlyphData.fontData);
}
}
}
if (hasExtraSpacing) {
// Account for letter-spacing.
if (width && m_font->letterSpacing())
width += m_font->letterSpacing();
if (Font::treatAsSpace(c)) {
// Account for padding. WebCore uses space padding to justify text.
// We distribute the specified padding over the available spaces in the run.
if (m_padding) {
// Use left over padding if not evenly divisible by number of spaces.
if (m_padding < m_padPerSpace) {
width += m_padding;
m_padding = 0;
} else {
float previousPadding = m_padding;
m_padding -= m_padPerSpace;
width += roundf(previousPadding) - roundf(m_padding);
}
}
// Account for word spacing.
// We apply additional space between "words" by adding width to the space character.
if (currentCharacter != 0 && !Font::treatAsSpace(cp[-1]) && m_font->wordSpacing())
width += m_font->wordSpacing();
}
}
if (m_accountForGlyphBounds) {
bounds = fontData->boundsForGlyph(glyph);
if (!currentCharacter)
m_firstGlyphOverflow = max<float>(0, -bounds.x());
}
if (m_forTextEmphasis && !Font::canReceiveTextEmphasis(c))
glyph = 0;
// Advance past the character we just dealt with.
cp += clusterLength;
currentCharacter += clusterLength;
// Account for float/integer impedance mismatch between CG and KHTML. "Words" (characters
// followed by a character defined by isRoundingHackCharacter()) are always an integer width.
// We adjust the width of the last character of a "word" to ensure an integer width.
// If we move KHTML to floats we can remove this (and related) hacks.
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(c)) {
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() && currentCharacter < m_run.length() && Font::isRoundingHackCharacter(*cp))
|| (m_run.applyRunRounding() && currentCharacter >= m_end)) {
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.bottom());
m_minGlyphBoundingBoxY = min(m_minGlyphBoundingBoxY, bounds.y());
m_lastGlyphOverflow = max<float>(0, bounds.right() - width);
}
}
m_currentCharacter = currentCharacter;
m_runWidthSoFar += widthSinceLastRounding;
m_finalRoundingWidth = lastRoundingWidth;
}
示例15: scissorToRect
// Sets the scissor region to the given rectangle. The coordinate system for the
// scissorRect has its origin at the top left corner of the current visible rect.
void LayerRendererChromium::scissorToRect(const FloatRect& scissorRect)
{
// Compute the lower left corner of the scissor rect.
float bottom = std::max((float)m_rootVisibleRect.height() - scissorRect.bottom(), 0.f);
GLC(glScissor(scissorRect.x(), bottom, scissorRect.width(), scissorRect.height()));
}