本文整理汇总了C++中FloatRoundedRect::rect方法的典型用法代码示例。如果您正苦于以下问题:C++ FloatRoundedRect::rect方法的具体用法?C++ FloatRoundedRect::rect怎么用?C++ FloatRoundedRect::rect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FloatRoundedRect
的用法示例。
在下文中一共展示了FloatRoundedRect::rect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FloatRoundedRect
TEST(FloatRoundedRectTest, zeroRadii)
{
FloatRoundedRect r = FloatRoundedRect(1, 2, 3, 4);
EXPECT_EQ(FloatRect(1, 2, 3, 4), r.rect());
EXPECT_EQ(FloatSize(), r.radii().topLeft());
EXPECT_EQ(FloatSize(), r.radii().topRight());
EXPECT_EQ(FloatSize(), r.radii().bottomLeft());
EXPECT_EQ(FloatSize(), r.radii().bottomRight());
EXPECT_TRUE(r.radii().isZero());
EXPECT_FALSE(r.isRounded());
EXPECT_FALSE(r.isEmpty());
EXPECT_EQ(FloatRect(1, 2, 0, 0), r.topLeftCorner());
EXPECT_EQ(FloatRect(4, 2, 0, 0), r.topRightCorner());
EXPECT_EQ(FloatRect(4, 6, 0, 0), r.bottomRightCorner());
EXPECT_EQ(FloatRect(1, 6, 0, 0), r.bottomLeftCorner());
TEST_INTERCEPTS(r, 2, r.rect().x(), r.rect().maxX());
TEST_INTERCEPTS(r, 4, r.rect().x(), r.rect().maxX());
TEST_INTERCEPTS(r, 6, r.rect().x(), r.rect().maxX());
float minXIntercept;
float maxXIntercept;
EXPECT_FALSE(r.xInterceptsAtY(1, minXIntercept, maxXIntercept));
EXPECT_FALSE(r.xInterceptsAtY(7, minXIntercept, maxXIntercept));
// The FloatRoundedRect::expandRadii() function doesn't change radii FloatSizes that
// are <= zero. Same as RoundedRect::expandRadii().
r.expandRadii(20);
r.shrinkRadii(10);
EXPECT_TRUE(r.radii().isZero());
}
示例2: rect
PassOwnPtr<Shape> Shape::createLayoutBoxShape(const FloatRoundedRect& roundedRect, WritingMode writingMode, float margin)
{
FloatRect rect(0, 0, roundedRect.rect().width(), roundedRect.rect().height());
FloatRoundedRect bounds(rect, roundedRect.radii());
OwnPtr<Shape> shape = createInsetShape(bounds);
shape->m_writingMode = writingMode;
shape->m_margin = margin;
return shape.release();
}
示例3: rect
std::unique_ptr<Shape> Shape::createLayoutBoxShape(
const FloatRoundedRect& roundedRect,
WritingMode writingMode,
float margin) {
FloatRect rect(0, 0, roundedRect.rect().width(), roundedRect.rect().height());
FloatRoundedRect bounds(rect, roundedRect.getRadii());
std::unique_ptr<Shape> shape = createInsetShape(bounds);
shape->m_writingMode = writingMode;
shape->m_margin = margin;
return shape;
}
示例4: fillRectWithRoundedHole
void GraphicsContext::fillRectWithRoundedHole(const IntRect& rect, const FloatRoundedRect& roundedHoleRect, const Color& color, ColorSpace colorSpace)
{
if (paintingDisabled())
return;
Path path;
path.addRect(rect);
if (!roundedHoleRect.radii().isZero())
path.addRoundedRect(roundedHoleRect);
else
path.addRect(roundedHoleRect.rect());
WindRule oldFillRule = fillRule();
Color oldFillColor = fillColor();
ColorSpace oldFillColorSpace = fillColorSpace();
setFillRule(RULE_EVENODD);
setFillColor(color, colorSpace);
fillPath(path);
setFillRule(oldFillRule);
setFillColor(oldFillColor, oldFillColorSpace);
}
示例5: PrintTo
void PrintTo(const FloatRoundedRect& roundedRect, std::ostream* os)
{
*os << "FloatRoundedRect(";
PrintTo(roundedRect.rect(), os);
*os << ", ";
PrintTo(roundedRect.getRadii(), os);
*os << ")";
}
示例6: fillRoundedRect
void GraphicsContext::fillRoundedRect(const FloatRoundedRect& rect, const Color& color, BlendMode blendMode)
{
if (rect.isRounded()) {
setCompositeOperation(compositeOperation(), blendMode);
platformFillRoundedRect(rect, color);
setCompositeOperation(compositeOperation());
} else
fillRect(rect.rect(), color, compositeOperation(), blendMode);
}
示例7: clipOutRoundedRect
void GraphicsContext::clipOutRoundedRect(const FloatRoundedRect& rect)
{
if (paintingDisabled())
return;
if (!rect.isRounded()) {
clipOut(rect.rect());
return;
}
Path path;
path.addRoundedRect(rect);
clipOut(path);
}
示例8: fillRoundedRect
void GraphicsContext::fillRoundedRect(const FloatRoundedRect& rect, const Color& color, BlendMode blendMode)
{
if (paintingDisabled())
return;
if (isRecording()) {
m_displayListRecorder->fillRoundedRect(rect, color, blendMode);
return;
}
if (rect.isRounded()) {
setCompositeOperation(compositeOperation(), blendMode);
platformFillRoundedRect(rect, color);
setCompositeOperation(compositeOperation());
} else
fillRect(rect.rect(), color, compositeOperation(), blendMode);
}
示例9: fillRectWithRoundedHole
void GraphicsContext::fillRectWithRoundedHole(const FloatRect& rect, const FloatRoundedRect& roundedHoleRect, const Color& color, ColorSpace)
{
if (paintingDisabled() || !color.isValid())
return;
if (this->mustUseShadowBlur())
platformContext()->shadowBlur().drawInsetShadow(this, rect, roundedHoleRect);
Path path;
path.addRect(rect);
if (!roundedHoleRect.radii().isZero())
path.addRoundedRect(roundedHoleRect);
else
path.addRect(roundedHoleRect.rect());
cairo_t* cr = platformContext()->cr();
cairo_save(cr);
setPathOnCairoContext(platformContext()->cr(), path.platformPath()->context());
fillCurrentCairoPath(this);
cairo_restore(cr);
}
示例10: topCorner
RoundedInnerRectClipper::RoundedInnerRectClipper(LayoutObject& layoutObject, const PaintInfo& paintInfo, const LayoutRect& rect, const FloatRoundedRect& clipRect, RoundedInnerRectClipperBehavior behavior)
: m_layoutObject(layoutObject)
, m_paintInfo(paintInfo)
, m_useDisplayItemList(RuntimeEnabledFeatures::slimmingPaintEnabled() && behavior == ApplyToDisplayListIfEnabled)
, m_clipType(m_useDisplayItemList ? m_paintInfo.displayItemTypeForClipping() : DisplayItem::ClipBoxPaintPhaseFirst)
{
Vector<FloatRoundedRect> roundedRectClips;
if (clipRect.isRenderable()) {
roundedRectClips.append(clipRect);
} else {
// We create a rounded rect for each of the corners and clip it, while making sure we clip opposing corners together.
if (!clipRect.radii().topLeft().isEmpty() || !clipRect.radii().bottomRight().isEmpty()) {
FloatRect topCorner(clipRect.rect().x(), clipRect.rect().y(), rect.maxX() - clipRect.rect().x(), rect.maxY() - clipRect.rect().y());
FloatRoundedRect::Radii topCornerRadii;
topCornerRadii.setTopLeft(clipRect.radii().topLeft());
roundedRectClips.append(FloatRoundedRect(topCorner, topCornerRadii));
FloatRect bottomCorner(rect.x().toFloat(), rect.y().toFloat(), clipRect.rect().maxX() - rect.x().toFloat(), clipRect.rect().maxY() - rect.y().toFloat());
FloatRoundedRect::Radii bottomCornerRadii;
bottomCornerRadii.setBottomRight(clipRect.radii().bottomRight());
roundedRectClips.append(FloatRoundedRect(bottomCorner, bottomCornerRadii));
}
if (!clipRect.radii().topRight().isEmpty() || !clipRect.radii().bottomLeft().isEmpty()) {
FloatRect topCorner(rect.x().toFloat(), clipRect.rect().y(), clipRect.rect().maxX() - rect.x().toFloat(), rect.maxY() - clipRect.rect().y());
FloatRoundedRect::Radii topCornerRadii;
topCornerRadii.setTopRight(clipRect.radii().topRight());
roundedRectClips.append(FloatRoundedRect(topCorner, topCornerRadii));
FloatRect bottomCorner(clipRect.rect().x(), rect.y().toFloat(), rect.maxX() - clipRect.rect().x(), clipRect.rect().maxY() - rect.y().toFloat());
FloatRoundedRect::Radii bottomCornerRadii;
bottomCornerRadii.setBottomLeft(clipRect.radii().bottomLeft());
roundedRectClips.append(FloatRoundedRect(bottomCorner, bottomCornerRadii));
}
}
if (m_useDisplayItemList) {
ASSERT(m_paintInfo.context->displayItemList());
if (m_paintInfo.context->displayItemList()->displayItemConstructionIsDisabled())
return;
m_paintInfo.context->displayItemList()->createAndAppend<ClipDisplayItem>(layoutObject, m_clipType, LayoutRect::infiniteIntRect(), roundedRectClips);
} else {
ClipDisplayItem clipDisplayItem(layoutObject, m_clipType, LayoutRect::infiniteIntRect(), roundedRectClips);
clipDisplayItem.replay(*paintInfo.context);
}
}
示例11: createInsetShape
static std::unique_ptr<Shape> createInsetShape(const FloatRoundedRect& bounds)
{
ASSERT(bounds.rect().width() >= 0 && bounds.rect().height() >= 0);
return std::make_unique<BoxShape>(bounds);
}
示例12: wrapUnique
static std::unique_ptr<Shape> createInsetShape(const FloatRoundedRect& bounds) {
ASSERT(bounds.rect().width() >= 0 && bounds.rect().height() >= 0);
return wrapUnique(new BoxShape(bounds));
}
示例13: adoptPtr
static PassOwnPtr<Shape> createBoxShape(const FloatRoundedRect& bounds, float shapeMargin, float shapePadding)
{
ASSERT(bounds.rect().width() >= 0 && bounds.rect().height() >= 0);
return adoptPtr(new BoxShape(bounds, shapeMargin, shapePadding));
}
示例14: adoptPtr
static PassOwnPtr<Shape> createInsetShape(const FloatRoundedRect& bounds)
{
ASSERT(bounds.rect().width() >= 0 && bounds.rect().height() >= 0);
return adoptPtr(new BoxShape(bounds));
}
示例15: addRoundedRect
void Path::addRoundedRect(const FloatRoundedRect& r) {
addRoundedRect(r.rect(), r.getRadii().topLeft(), r.getRadii().topRight(),
r.getRadii().bottomLeft(), r.getRadii().bottomRight());
}