当前位置: 首页>>代码示例>>C++>>正文


C++ FloatRect::expand方法代码示例

本文整理汇总了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);
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:49,代码来源:TileCoverageMap.cpp

示例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);
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例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);
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例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);
}
开发者ID:shaoboyan,项目名称:chromium-crosswalk,代码行数:27,代码来源:GeneratedImage.cpp

示例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;
}
开发者ID:kjthegod,项目名称:WebKit,代码行数:8,代码来源:FEConvolveMatrix.cpp

示例6:

Optional<FloatRect> StrokeEllipse::localBounds(const GraphicsContext& context) const
{
    float strokeThickness = context.strokeThickness();

    FloatRect bounds = m_rect;
    bounds.expand(strokeThickness, strokeThickness);
    return bounds;
}
开发者ID:ollie314,项目名称:webkit,代码行数:8,代码来源:DisplayListItems.cpp

示例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;
}
开发者ID:mirror,项目名称:chromium,代码行数:8,代码来源:FEConvolveMatrix.cpp

示例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);
}
开发者ID:reaven15,项目名称:webkit,代码行数:57,代码来源:TextureMapperLayer.cpp

示例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;
}
开发者ID:howardroark2018,项目名称:chromium,代码行数:9,代码来源:FEConvolveMatrix.cpp

示例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
}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:11,代码来源:FindIndicator.cpp

示例11: adjustRectForShadow

void ShadowList::adjustRectForShadow(FloatRect& rect) const {
  rect.expand(rectOutsetsIncludingOriginal());
}
开发者ID:,项目名称:,代码行数:3,代码来源:


注:本文中的FloatRect::expand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。