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


C++ FillLayer::repeatY方法代码示例

本文整理汇总了C++中FillLayer::repeatY方法的典型用法代码示例。如果您正苦于以下问题:C++ FillLayer::repeatY方法的具体用法?C++ FillLayer::repeatY怎么用?C++ FillLayer::repeatY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FillLayer的用法示例。


在下文中一共展示了FillLayer::repeatY方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: calculate


//.........这里部分代码省略.........
          paintRect.size() - LayoutSize(left + right, top + bottom);
    }
  } else {
    setHasNonLocalGeometry();

    LayoutRect viewportRect = obj.viewRect();
    if (fixedBackgroundPaintsInLocalCoordinates(obj, globalPaintFlags)) {
      viewportRect.setLocation(LayoutPoint());
    } else {
      if (FrameView* frameView = obj.view()->frameView())
        viewportRect.setLocation(IntPoint(frameView->scrollOffsetInt()));
      // Compensate the translations created by ScrollRecorders.
      // TODO(trchen): Fix this for SP phase 2. crbug.com/529963.
      viewportRect.moveBy(
          accumulatedScrollOffsetForFixedBackground(obj, paintContainer));
    }

    if (paintContainer)
      viewportRect.moveBy(
          LayoutPoint(-paintContainer->localToAbsolute(FloatPoint())));

    setDestRect(viewportRect);
    positioningAreaSize = destRect().size();
  }

  LayoutSize fillTileSize(
      calculateFillTileSize(positioningBox, fillLayer, positioningAreaSize));
  // It's necessary to apply the heuristic here prior to any further
  // calculations to avoid incorrectly using sub-pixel values that won't be
  // present in the painted tile.
  setTileSize(applySubPixelHeuristicToImageSize(fillTileSize, m_destRect));

  EFillRepeat backgroundRepeatX = fillLayer.repeatX();
  EFillRepeat backgroundRepeatY = fillLayer.repeatY();
  LayoutUnit unsnappedAvailableWidth =
      positioningAreaSize.width() - fillTileSize.width();
  LayoutUnit unsnappedAvailableHeight =
      positioningAreaSize.height() - fillTileSize.height();
  positioningAreaSize =
      LayoutSize(snapSizeToPixel(positioningAreaSize.width(), m_destRect.x()),
                 snapSizeToPixel(positioningAreaSize.height(), m_destRect.y()));
  LayoutUnit availableWidth = positioningAreaSize.width() - tileSize().width();
  LayoutUnit availableHeight =
      positioningAreaSize.height() - tileSize().height();

  LayoutUnit computedXPosition =
      roundedMinimumValueForLength(fillLayer.xPosition(), availableWidth);
  if (backgroundRepeatX == RoundFill &&
      positioningAreaSize.width() > LayoutUnit() &&
      fillTileSize.width() > LayoutUnit()) {
    int nrTiles = std::max(
        1, roundToInt(positioningAreaSize.width() / fillTileSize.width()));
    LayoutUnit roundedWidth = positioningAreaSize.width() / nrTiles;

    // Maintain aspect ratio if background-size: auto is set
    if (fillLayer.size().size.height().isAuto() &&
        backgroundRepeatY != RoundFill) {
      fillTileSize.setHeight(fillTileSize.height() * roundedWidth /
                             fillTileSize.width());
    }
    fillTileSize.setWidth(roundedWidth);

    setTileSize(applySubPixelHeuristicToImageSize(fillTileSize, m_destRect));
    setPhaseX(tileSize().width()
                  ? LayoutUnit(roundf(
                        tileSize().width() -
开发者ID:mirror,项目名称:chromium,代码行数:67,代码来源:BackgroundImageGeometry.cpp


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