本文整理汇总了C++中FloatRect::maxX方法的典型用法代码示例。如果您正苦于以下问题:C++ FloatRect::maxX方法的具体用法?C++ FloatRect::maxX怎么用?C++ FloatRect::maxX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FloatRect
的用法示例。
在下文中一共展示了FloatRect::maxX方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addBeziersForRoundedRect
void Path::addBeziersForRoundedRect(const FloatRect& rect, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius)
{
moveTo(FloatPoint(rect.x() + topLeftRadius.width(), rect.y()));
addLineTo(FloatPoint(rect.maxX() - topRightRadius.width(), rect.y()));
if (topRightRadius.width() > 0 || topRightRadius.height() > 0)
addBezierCurveTo(FloatPoint(rect.maxX() - topRightRadius.width() * gCircleControlPoint, rect.y()),
FloatPoint(rect.maxX(), rect.y() + topRightRadius.height() * gCircleControlPoint),
FloatPoint(rect.maxX(), rect.y() + topRightRadius.height()));
addLineTo(FloatPoint(rect.maxX(), rect.maxY() - bottomRightRadius.height()));
if (bottomRightRadius.width() > 0 || bottomRightRadius.height() > 0)
addBezierCurveTo(FloatPoint(rect.maxX(), rect.maxY() - bottomRightRadius.height() * gCircleControlPoint),
FloatPoint(rect.maxX() - bottomRightRadius.width() * gCircleControlPoint, rect.maxY()),
FloatPoint(rect.maxX() - bottomRightRadius.width(), rect.maxY()));
addLineTo(FloatPoint(rect.x() + bottomLeftRadius.width(), rect.maxY()));
if (bottomLeftRadius.width() > 0 || bottomLeftRadius.height() > 0)
addBezierCurveTo(FloatPoint(rect.x() + bottomLeftRadius.width() * gCircleControlPoint, rect.maxY()),
FloatPoint(rect.x(), rect.maxY() - bottomLeftRadius.height() * gCircleControlPoint),
FloatPoint(rect.x(), rect.maxY() - bottomLeftRadius.height()));
addLineTo(FloatPoint(rect.x(), rect.y() + topLeftRadius.height()));
if (topLeftRadius.width() > 0 || topLeftRadius.height() > 0)
addBezierCurveTo(FloatPoint(rect.x(), rect.y() + topLeftRadius.height() * gCircleControlPoint),
FloatPoint(rect.x() + topLeftRadius.width() * gCircleControlPoint, rect.y()),
FloatPoint(rect.x() + topLeftRadius.width(), rect.y()));
closeSubpath();
}
示例2: widthSet
WindowFeatures::WindowFeatures(const String& dialogFeaturesString, const FloatRect& screenAvailableRect)
: widthSet(true)
, heightSet(true)
, menuBarVisible(false)
, toolBarVisible(false)
, locationBarVisible(false)
, fullscreen(false)
, dialog(true)
#ifdef EXTENSION_NODEJS_INJECTION
, nodejs(false)
#endif
{
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;
}
}
#ifdef EXTENSION_NODEJS_INJECTION
nodejs = boolFeature(features, "nodejs", false);
#endif
resizable = boolFeature(features, "resizable");
scrollbarsVisible = boolFeature(features, "scroll", true);
statusBarVisible = boolFeature(features, "status", !trusted);
}
示例3: expandRectWithinRect
// Return 'rect' padded evenly on all sides to achieve 'newSize', but make the padding uneven to contain within constrainingRect.
static FloatRect expandRectWithinRect(const FloatRect& rect, const FloatSize& newSize, const FloatRect& constrainingRect)
{
ASSERT(newSize.width() >= rect.width() && newSize.height() >= rect.height());
FloatSize extraSize = newSize - rect.size();
FloatRect expandedRect = rect;
expandedRect.inflateX(extraSize.width() / 2);
expandedRect.inflateY(extraSize.height() / 2);
if (expandedRect.x() < constrainingRect.x())
expandedRect.setX(constrainingRect.x());
else if (expandedRect.maxX() > constrainingRect.maxX())
expandedRect.setX(constrainingRect.maxX() - expandedRect.width());
if (expandedRect.y() < constrainingRect.y())
expandedRect.setY(constrainingRect.y());
else if (expandedRect.maxY() > constrainingRect.maxY())
expandedRect.setY(constrainingRect.maxY() - expandedRect.height());
return intersection(expandedRect, constrainingRect);
}
示例4: drawGL
bool Tile::drawGL(float opacity, const SkRect& rect, float scale,
const TransformationMatrix* transform,
bool forceBlending, bool usePointSampling,
const FloatRect& fillPortion)
{
if (m_x < 0 || m_y < 0 || m_scale != scale)
return false;
// No need to mutex protect reads of m_backTexture as it is only written to by
// the consumer thread.
if (!m_frontTexture)
return false;
if (fillPortion.maxX() < 1.0f || fillPortion.maxY() < 1.0f
|| fillPortion.x() > 0.0f || fillPortion.y() > 0.0f)
ALOGV("drawing tile %p (%d, %d with fill portions %f %f->%f, %f",
this, m_x, m_y, fillPortion.x(), fillPortion.y(),
fillPortion.maxX(), fillPortion.maxY());
m_frontTexture->drawGL(isLayerTile(), rect, opacity, transform,
forceBlending, usePointSampling, fillPortion);
return true;
}
示例5: ASSERT
Vector<FloatRect> NinePieceImage::computeIntrinsicRects(const FloatRect& outer, const LayoutBoxExtent& slices, float deviceScaleFactor)
{
FloatRect inner = outer;
inner.move(slices.left(), slices.top());
inner.contract(slices.left() + slices.right(), slices.top() + slices.bottom());
ASSERT(outer.contains(inner));
Vector<FloatRect> rects(MaxPiece);
rects[TopLeftPiece] = snapRectToDevicePixels(outer.x(), outer.y(), slices.left(), slices.top(), deviceScaleFactor);
rects[BottomLeftPiece] = snapRectToDevicePixels(outer.x(), inner.maxY(), slices.left(), slices.bottom(), deviceScaleFactor);
rects[LeftPiece] = snapRectToDevicePixels(outer.x(), inner.y(), slices.left(), inner.height(), deviceScaleFactor);
rects[TopRightPiece] = snapRectToDevicePixels(inner.maxX(), outer.y(), slices.right(), slices.top(), deviceScaleFactor);
rects[BottomRightPiece] = snapRectToDevicePixels(inner.maxX(), inner.maxY(), slices.right(), slices.bottom(), deviceScaleFactor);
rects[RightPiece] = snapRectToDevicePixels(inner.maxX(), inner.y(), slices.right(), inner.height(), deviceScaleFactor);
rects[TopPiece] = snapRectToDevicePixels(inner.x(), outer.y(), inner.width(), slices.top(), deviceScaleFactor);
rects[BottomPiece] = snapRectToDevicePixels(inner.x(), inner.maxY(), inner.width(), slices.bottom(), deviceScaleFactor);
rects[MiddlePiece] = snapRectToDevicePixels(inner.x(), inner.y(), inner.width(), inner.height(), deviceScaleFactor);
return rects;
}
示例6: 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;
}
示例7: paintMediaSeekForwardButton
bool RenderThemeWinCE::paintMediaSeekForwardButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
{
bool rc = paintButton(o, paintInfo, r);
FloatRect imRect = r;
imRect.inflate(-3);
FloatPoint pts[3] = { FloatPoint(imRect.x(), imRect.y()), FloatPoint((imRect.x() + imRect.maxX()) / 2.0, (imRect.y() + imRect.maxY()) / 2.0), FloatPoint(imRect.x(), imRect.maxY()) };
FloatPoint pts2[3] = { FloatPoint((imRect.x() + imRect.maxX()) / 2.0, imRect.y()), FloatPoint(imRect.maxX(), (imRect.y() + imRect.maxY()) / 2.0), FloatPoint((imRect.x() + imRect.maxX()) / 2.0, imRect.maxY()) };
paintInfo.context->save();
paintInfo.context->setStrokeColor(Color::black);
paintInfo.context->setFillColor(Color::black);
paintInfo.context->drawConvexPolygon(3, pts);
paintInfo.context->drawConvexPolygon(3, pts2);
paintInfo.context->restore();
return rc;
}
示例8: 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.maxX(), rect.y())));
result.setP3(mapPoint(FloatPoint(rect.maxX(), rect.maxY())));
result.setP4(mapPoint(FloatPoint(rect.x(), rect.maxY())));
return result.boundingBox();
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:15,代码来源:AffineTransform.cpp
示例9: layerPositionForViewportRect
FloatPoint FixedPositionViewportConstraints::layerPositionForViewportRect(const FloatRect& viewportRect) const
{
FloatSize offset;
if (hasAnchorEdge(AnchorEdgeLeft))
offset.setWidth(viewportRect.x() - m_viewportRectAtLastLayout.x());
else if (hasAnchorEdge(AnchorEdgeRight))
offset.setWidth(viewportRect.maxX() - m_viewportRectAtLastLayout.maxX());
if (hasAnchorEdge(AnchorEdgeTop))
offset.setHeight(viewportRect.y() - m_viewportRectAtLastLayout.y());
else if (hasAnchorEdge(AnchorEdgeBottom))
offset.setHeight(viewportRect.maxY() - m_viewportRectAtLastLayout.maxY());
return m_layerPositionAtLastLayout + offset;
}
示例10: 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);
}
示例11: 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);
}
示例12: 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);
}
示例13: 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);
}
示例14: 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();
}
示例15: 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;
}
}