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


C++ Maybe::BoundingBox方法代码示例

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


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

示例1: triangle

void
Compositor::DrawGeometry(const gfx::Rect& aRect,
                         const gfx::IntRect& aClipRect,
                         const EffectChain& aEffectChain,
                         gfx::Float aOpacity,
                         const gfx::Matrix4x4& aTransform,
                         const gfx::Rect& aVisibleRect,
                         const Maybe<gfx::Polygon3D>& aGeometry)
{
  if (!aGeometry) {
    DrawQuad(aRect, aClipRect, aEffectChain,
             aOpacity, aTransform, aVisibleRect);
    return;
  }

  // Cull invisible polygons.
  if (aRect.Intersect(aGeometry->BoundingBox()).IsEmpty()) {
    return;
  }

  gfx::Polygon3D clipped = aGeometry->ClipPolygon(aRect);
  nsTArray<gfx::Triangle> triangles = clipped.ToTriangles();

  for (gfx::Triangle& geometry : triangles) {
    const gfx::Rect intersection = aRect.Intersect(geometry.BoundingBox());

    // Cull invisible triangles.
    if (intersection.IsEmpty()) {
      continue;
    }

    MOZ_ASSERT(aRect.width > 0.0f && aRect.height > 0.0f);
    MOZ_ASSERT(intersection.width > 0.0f && intersection.height > 0.0f);

    gfx::TexturedTriangle triangle(Move(geometry));
    triangle.width = aRect.width;
    triangle.height = aRect.height;

    // Since the texture was created for non-split geometry, we need to
    // update the texture coordinates to account for the split.
    if (aEffectChain.mPrimaryEffect->mType == EffectTypes::RGB) {
      TexturedEffect* texturedEffect =
        static_cast<TexturedEffect*>(aEffectChain.mPrimaryEffect.get());

      UpdateTextureCoordinates(triangle, aRect, intersection,
                               texturedEffect->mTextureCoords);
    }

    DrawTriangle(triangle, aClipRect, aEffectChain,
                 aOpacity, aTransform, aVisibleRect);
  }
}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:52,代码来源:Compositor.cpp

示例2: GetLayer

IntRect
LayerMLGPU::GetClippedBoundingBox(RenderViewMLGPU* aView,
                                  const Maybe<gfx::Polygon>& aGeometry)
{
  MOZ_ASSERT(IsPrepared());

  Layer* layer = GetLayer();
  const Matrix4x4& transform = layer->GetEffectiveTransform();

  Rect rect = aGeometry
              ? aGeometry->BoundingBox()
              : Rect(layer->GetLocalVisibleRegion().GetBounds().ToUnknownRect());
  rect = transform.TransformBounds(rect);
  rect.MoveBy(-aView->GetTargetOffset());
  rect = rect.Intersect(Rect(mComputedClipRect.ToUnknownRect()));

  IntRect bounds;
  rect.RoundOut();
  rect.ToIntRect(&bounds);
  return bounds;
}
开发者ID:marcoscaceres,项目名称:gecko-dev,代码行数:21,代码来源:LayerMLGPU.cpp


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