本文整理汇总了C++中FloatRect::expand方法的典型用法代码示例。如果您正苦于以下问题:C++ FloatRect::expand方法的具体用法?C++ FloatRect::expand怎么用?C++ FloatRect::expand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FloatRect
的用法示例。
在下文中一共展示了FloatRect::expand方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void TileCoverageMap::update()
{
FloatRect containerBounds = m_controller.bounds();
FloatRect visibleRect = m_controller.visibleRect();
FloatRect coverageRect = m_controller.coverageRect();
visibleRect.contract(4, 4); // Layer is positioned 2px from top and left edges.
float widthScale = 1;
float scale = 1;
if (!containerBounds.isEmpty()) {
widthScale = std::min<float>(visibleRect.width() / containerBounds.width(), 0.1);
float visibleHeight = visibleRect.height() - std::min(m_controller.topContentInset(), visibleRect.y());
scale = std::min(widthScale, visibleHeight / containerBounds.height());
}
float indicatorScale = scale * m_controller.tileGrid().scale();
FloatRect mapBounds = containerBounds;
mapBounds.scale(indicatorScale, indicatorScale);
m_layer.get().setPosition(m_position + FloatPoint(2, 2));
m_layer.get().setBounds(mapBounds);
m_layer.get().setNeedsDisplay();
visibleRect.scale(indicatorScale, indicatorScale);
visibleRect.expand(2, 2);
m_visibleRectIndicatorLayer->setPosition(visibleRect.location());
m_visibleRectIndicatorLayer->setBounds(FloatRect(FloatPoint(), visibleRect.size()));
coverageRect.scale(indicatorScale, indicatorScale);
coverageRect.expand(2, 2);
m_coverageRectIndicatorLayer->setPosition(coverageRect.location());
m_coverageRectIndicatorLayer->setBounds(FloatRect(FloatPoint(), coverageRect.size()));
Color visibleRectIndicatorColor;
switch (m_controller.indicatorMode()) {
case SynchronousScrollingBecauseOfStyleIndication:
visibleRectIndicatorColor = Color(255, 0, 0);
break;
case SynchronousScrollingBecauseOfEventHandlersIndication:
visibleRectIndicatorColor = Color(255, 255, 0);
break;
case AsyncScrollingIndication:
visibleRectIndicatorColor = Color(0, 200, 0);
break;
}
m_visibleRectIndicatorLayer.get().setBorderColor(visibleRectIndicatorColor);
}
示例2: expandRectWithFilters
static inline void expandRectWithFilters(FloatRect& rect, const WebKit::WebFilterOperations& filters)
{
int top, right, bottom, left;
filters.getOutsets(top, right, bottom, left);
rect.move(-left, -top);
rect.expand(left + right, top + bottom);
}
示例3: drawPattern
void GeneratedImage::drawPattern(GraphicsContext& destContext,
const FloatRect& srcRect,
const FloatSize& scale,
const FloatPoint& phase,
SkBlendMode compositeOp,
const FloatRect& destRect,
const FloatSize& repeatSpacing) {
FloatRect tileRect = srcRect;
tileRect.expand(FloatSize(repeatSpacing));
std::unique_ptr<PaintController> paintController = PaintController::create();
GraphicsContext context(*paintController);
context.beginRecording(tileRect);
drawTile(context, srcRect);
sk_sp<SkPicture> tilePicture = context.endRecording();
SkMatrix patternMatrix = SkMatrix::MakeTrans(phase.x(), phase.y());
patternMatrix.preScale(scale.width(), scale.height());
patternMatrix.preTranslate(tileRect.x(), tileRect.y());
RefPtr<Pattern> picturePattern =
Pattern::createPicturePattern(std::move(tilePicture));
SkPaint fillPaint = destContext.fillPaint();
picturePattern->applyToPaint(fillPaint, patternMatrix);
fillPaint.setColor(SK_ColorBLACK);
fillPaint.setBlendMode(compositeOp);
destContext.drawRect(destRect, fillPaint);
}
示例4: drawPattern
void GeneratedImage::drawPattern(GraphicsContext* destContext, const FloatRect& srcRect, const FloatSize& scale,
const FloatPoint& phase, SkXfermode::Mode compositeOp, const FloatRect& destRect,
const IntSize& repeatSpacing)
{
FloatRect tileRect = srcRect;
tileRect.expand(repeatSpacing);
SkPictureBuilder builder(tileRect, nullptr, destContext);
builder.context().beginRecording(tileRect);
drawTile(&builder.context(), srcRect);
RefPtr<const SkPicture> tilePicture = builder.endRecording();
AffineTransform patternTransform;
patternTransform.translate(phase.x(), phase.y());
patternTransform.scale(scale.width(), scale.height());
patternTransform.translate(tileRect.x(), tileRect.y());
RefPtr<Pattern> picturePattern = Pattern::createPicturePattern(tilePicture);
picturePattern->setPatternSpaceTransform(patternTransform);
SkPaint fillPaint = destContext->fillPaint();
picturePattern->applyToPaint(fillPaint);
fillPaint.setColor(SK_ColorBLACK);
fillPaint.setXfermodeMode(compositeOp);
destContext->drawRect(destRect, fillPaint);
}
示例5: mapPaintRect
FloatRect FEConvolveMatrix::mapPaintRect(const FloatRect& rect, bool forward)
{
FloatRect result = rect;
result.moveBy(forward ? -m_targetOffset : m_targetOffset - m_kernelSize);
result.expand(m_kernelSize);
return result;
}
示例6:
Optional<FloatRect> StrokeEllipse::localBounds(const GraphicsContext& context) const
{
float strokeThickness = context.strokeThickness();
FloatRect bounds = m_rect;
bounds.expand(strokeThickness, strokeThickness);
return bounds;
}
示例7: mapEffect
FloatRect FEConvolveMatrix::mapEffect(const FloatRect& rect) const {
if (!parametersValid())
return rect;
FloatRect result = rect;
result.moveBy(-m_targetOffset);
result.expand(FloatSize(m_kernelSize));
return result;
}
示例8: computeOverlapRegions
void TextureMapperLayer::computeOverlapRegions(Region& overlapRegion, Region& nonOverlapRegion, ResolveSelfOverlapMode mode)
{
if (!m_state.visible || !m_state.contentsVisible)
return;
FloatRect boundingRect;
if (m_backingStore || m_state.masksToBounds || m_state.maskLayer || hasFilters())
boundingRect = layerRect();
else if (m_contentsLayer || m_state.solidColor.alpha())
boundingRect = m_state.contentsRect;
if (m_currentFilters.hasOutsets()) {
FilterOutsets outsets = m_currentFilters.outsets();
IntRect unfilteredTargetRect(boundingRect);
boundingRect.move(std::max(0, -outsets.left()), std::max(0, -outsets.top()));
boundingRect.expand(outsets.left() + outsets.right(), outsets.top() + outsets.bottom());
boundingRect.unite(unfilteredTargetRect);
}
TransformationMatrix replicaMatrix;
if (m_state.replicaLayer) {
replicaMatrix = replicaTransform();
boundingRect.unite(replicaMatrix.mapRect(boundingRect));
}
boundingRect = m_currentTransform.combined().mapRect(boundingRect);
// Count all masks and filters as overlap layers.
if (hasFilters() || m_state.maskLayer || (m_state.replicaLayer && m_state.replicaLayer->m_state.maskLayer)) {
Region newOverlapRegion(enclosingIntRect(boundingRect));
nonOverlapRegion.subtract(newOverlapRegion);
overlapRegion.unite(newOverlapRegion);
return;
}
Region newOverlapRegion;
Region newNonOverlapRegion(enclosingIntRect(boundingRect));
if (!m_state.masksToBounds) {
for (auto* child : m_children)
child->computeOverlapRegions(newOverlapRegion, newNonOverlapRegion, ResolveSelfOverlapIfNeeded);
}
if (m_state.replicaLayer) {
newOverlapRegion.unite(replicaMatrix.mapRect(newOverlapRegion.bounds()));
Region replicaRegion(replicaMatrix.mapRect(newNonOverlapRegion.bounds()));
resolveOverlaps(replicaRegion, newOverlapRegion, newNonOverlapRegion);
}
if ((mode != ResolveSelfOverlapAlways) && shouldBlend()) {
newNonOverlapRegion.unite(newOverlapRegion);
newOverlapRegion = Region();
}
overlapRegion.unite(newOverlapRegion);
resolveOverlaps(newNonOverlapRegion, overlapRegion, nonOverlapRegion);
}
示例9: mapPaintRect
FloatRect FEConvolveMatrix::mapPaintRect(const FloatRect& rect, bool forward)
{
FloatRect result = rect;
if (parametersValid()) {
result.moveBy(forward ? -m_targetOffset : m_targetOffset - m_kernelSize);
result.expand(FloatSize(m_kernelSize));
}
return result;
}
示例10: outsetIndicatorRectIncludingShadow
static FloatRect outsetIndicatorRectIncludingShadow(const FloatRect rect)
{
#if ENABLE(LEGACY_FIND_INDICATOR_STYLE)
FloatRect outsetRect = rect;
outsetRect.move(-leftBorderThickness, -topBorderThickness);
outsetRect.expand(leftBorderThickness + rightBorderThickness, topBorderThickness + bottomBorderThickness);
return outsetRect;
#else
return inflateRect(rect, flatShadowBlurRadius + flatStyleHorizontalBorder, flatShadowBlurRadius + flatStyleVerticalBorder);
#endif
}
示例11: adjustRectForShadow
void ShadowList::adjustRectForShadow(FloatRect& rect) const {
rect.expand(rectOutsetsIncludingOriginal());
}