本文整理汇总了C++中gfx::Rect::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ Rect::IsEmpty方法的具体用法?C++ Rect::IsEmpty怎么用?C++ Rect::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gfx::Rect
的用法示例。
在下文中一共展示了Rect::IsEmpty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawRegion
void Layer::DrawRegion(const ui::TextureDrawParams& params,
const gfx::Rect& region_to_draw)
{
if(!region_to_draw.IsEmpty())
{
texture_->Draw(params, region_to_draw);
}
}
示例2: 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);
}
}