本文整理汇总了C++中FloatRect::right方法的典型用法代码示例。如果您正苦于以下问题:C++ FloatRect::right方法的具体用法?C++ FloatRect::right怎么用?C++ FloatRect::right使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FloatRect
的用法示例。
在下文中一共展示了FloatRect::right方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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()));
}
示例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: 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);
}
示例4: 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);
}
示例5: 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();
}
示例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.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);
}
示例7: 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);
}
示例8: 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);
}
示例9: 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));
}
示例10: 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);
}
示例11: showModalDialog
static JSValuePtr showModalDialog(ExecState* exec, Frame* frame, const String& url, JSValuePtr dialogArgs, const String& featureArgs)
{
if (!canShowModalDialogNow(frame) || !allowPopUp(exec))
return jsUndefined();
const HashMap<String, String> features = parseModalDialogFeatures(featureArgs);
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");
if (!frame)
return jsUndefined();
FloatRect screenRect = screenAvailableRect(frame->view());
WindowFeatures wargs;
wargs.width = WindowFeatures::floatFeature(features, "dialogwidth", 100, screenRect.width(), 620); // default here came from frame size of dialog in MacIE
wargs.widthSet = true;
wargs.height = WindowFeatures::floatFeature(features, "dialogheight", 100, screenRect.height(), 450); // default here came from frame size of dialog in MacIE
wargs.heightSet = true;
wargs.x = WindowFeatures::floatFeature(features, "dialogleft", screenRect.x(), screenRect.right() - wargs.width, -1);
wargs.xSet = wargs.x > 0;
wargs.y = WindowFeatures::floatFeature(features, "dialogtop", screenRect.y(), screenRect.bottom() - wargs.height, -1);
wargs.ySet = wargs.y > 0;
if (WindowFeatures::boolFeature(features, "center", true)) {
if (!wargs.xSet) {
wargs.x = screenRect.x() + (screenRect.width() - wargs.width) / 2;
wargs.xSet = true;
}
if (!wargs.ySet) {
wargs.y = screenRect.y() + (screenRect.height() - wargs.height) / 2;
wargs.ySet = true;
}
}
wargs.dialog = true;
wargs.resizable = WindowFeatures::boolFeature(features, "resizable");
wargs.scrollbarsVisible = WindowFeatures::boolFeature(features, "scroll", true);
wargs.statusBarVisible = WindowFeatures::boolFeature(features, "status", !trusted);
wargs.menuBarVisible = false;
wargs.toolBarVisible = false;
wargs.locationBarVisible = false;
wargs.fullscreen = false;
Frame* dialogFrame = createWindow(exec, frame, url, "", wargs, dialogArgs);
if (!dialogFrame)
return jsUndefined();
JSDOMWindow* dialogWindow = toJSDOMWindow(dialogFrame);
// Get the return value either just before clearing the dialog window's
// properties (in JSDOMWindowBase::clear), or when on return from runModal.
JSValuePtr returnValue = noValue();
dialogWindow->setReturnValueSlot(&returnValue);
dialogFrame->page()->chrome()->runModal();
dialogWindow->setReturnValueSlot(0);
// If we don't have a return value, get it now.
// Either JSDOMWindowBase::clear was not called yet, or there was no return value,
// and in that case, there's no harm in trying again (no benefit either).
if (!returnValue)
returnValue = dialogWindow->getDirect(Identifier(exec, "returnValue"));
return returnValue ? returnValue : jsUndefined();
}
示例12: 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;
}
示例13: repaint
void BackingStoreScrollbar::repaint(const WebCore::IntRect& hotRect, bool vertical)
{
SurfaceOpenVG* surface = SurfacePool::globalSurfacePool()->tileRenderingSurface();
const IntSize surfaceSize(surface->width(), surface->height());
PainterOpenVG painter(surface);
// If the rendering surface is smaller than the scrollbar
// (e.g. when the screen is rotated), paint it multiple times.
int lastXTile = (m_size.width() - 1) / surfaceSize.width();
int lastYTile = (m_size.height() - 1) / surfaceSize.height();
FloatRect innerRect = hotRect;
innerRect.move(0.5, 0.5); // draw it pixel-perfect with a 1.0 wide stroke
int radius = vertical ? hotRect.width() / 2 : hotRect.height() / 2;
if (vertical)
innerRect.inflateY(-radius);
else
innerRect.inflateX(-radius);
Path path;
if (vertical) {
path.moveTo(FloatPoint(innerRect.x(), innerRect.y()));
path.addArc(FloatPoint(innerRect.x() + radius, innerRect.y()), radius, piFloat, 0, false);
path.addLineTo(FloatPoint(innerRect.right(), innerRect.bottom()));
path.addArc(FloatPoint(innerRect.x() + radius, innerRect.bottom()), radius, 0, piFloat, false);
path.closeSubpath();
} else {
path.moveTo(FloatPoint(innerRect.right(), innerRect.y()));
path.addArc(FloatPoint(innerRect.right(), innerRect.y() + radius), radius, piFloat + piFloat / 2, piFloat / 2, false);
path.addLineTo(FloatPoint(innerRect.x(), innerRect.bottom()));
path.addArc(FloatPoint(innerRect.x(), innerRect.y() + radius), radius, piFloat / 2, piFloat + piFloat / 2, false);
path.closeSubpath();
}
for (int i = 0; i <= lastXTile; ++i) {
for (int j = 0; j <= lastYTile; ++j) {
const int dstX = i * surfaceSize.width();
const int dstY = j * surfaceSize.height();
const int dstRight = (i == lastXTile) ? m_size.width() : (i + 1) * surfaceSize.width();
const int dstBottom = (j == lastYTile) ? m_size.height() : (j + 1) * surfaceSize.height();
painter.translate(rect().x(), rect().y());
if (dstX || dstY)
painter.translate(-dstX, -dstY);
// Paint the actual scrollbar.
painter.setFillColor(Color(255, 255, 255));
painter.drawRect(IntRect(IntPoint(0, 0), rect().size()), VG_FILL_PATH);
painter.setFillColor(Color(173, 176, 178));
painter.drawPath(path, VG_FILL_PATH, WebCore::RULE_NONZERO);
surface->makeCurrent();
unsigned char* dstBufferStart = m_image + (dstY * imageStride()) + (dstX * imageBytesPerPixel());
vgReadPixels(dstBufferStart, imageStride(), VG_sRGB_565,
0, 0, dstRight - dstX, dstBottom - dstY);
ASSERT_VG_NO_ERROR();
// Paint the alpha channel for the actual scrollbar.
painter.setCompositeOperation(CompositeClear);
painter.setFillColor(Color(0, 0, 0));
painter.drawRect(IntRect(IntPoint(0, 0), rect().size()), VG_FILL_PATH);
painter.setCompositeOperation(CompositeSourceOver);
painter.setFillColor(Color(255, 255, 255));
painter.drawPath(path, VG_FILL_PATH, WebCore::RULE_NONZERO);
surface->makeCurrent();
// FIXME: We need VG_A_4 until proper alpha blending is available.
// When we get 8-bit formats, make sure to adapt both the format
// and remove the division by two when determining the dstAlphaBufferStart.
unsigned char* dstAlphaBufferStart = m_alphaImage + (dstY * alphaImageStride()) + dstX / 2;
vgReadPixels(dstAlphaBufferStart, alphaImageStride(), VG_A_4,
0, 0, dstRight - dstX, dstBottom - dstY);
ASSERT_VG_NO_ERROR();
if (dstX || dstY)
painter.translate(dstX, dstY);
}
}
}
示例14: clip
void GraphicsContextPlatformPrivate::clip(const FloatRect& clipRect)
{
if (!m_hdc)
return;
IntersectClipRect(m_hdc, clipRect.x(), clipRect.y(), clipRect.right(), clipRect.bottom());
}
示例15: contains
bool FloatRect::contains(const FloatRect& other) const
{
return x() <= other.x() && right() >= other.right()
&& y() <= other.y() && bottom() >= other.bottom();
}