本文整理汇总了C++中Layer::GetEffectiveClipRect方法的典型用法代码示例。如果您正苦于以下问题:C++ Layer::GetEffectiveClipRect方法的具体用法?C++ Layer::GetEffectiveClipRect怎么用?C++ Layer::GetEffectiveClipRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Layer
的用法示例。
在下文中一共展示了Layer::GetEffectiveClipRect方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetLocalTransform
void
ContainerLayer::DefaultComputeEffectiveTransforms(const Matrix4x4& aTransformToSurface)
{
Matrix residual;
Matrix4x4 idealTransform = GetLocalTransform() * aTransformToSurface;
idealTransform.ProjectTo2D();
mEffectiveTransform = SnapTransformTranslation(idealTransform, &residual);
bool useIntermediateSurface;
if (GetMaskLayer() ||
GetForceIsolatedGroup()) {
useIntermediateSurface = true;
#ifdef MOZ_DUMP_PAINTING
} else if (gfxUtils::sDumpPainting) {
useIntermediateSurface = true;
#endif
} else {
float opacity = GetEffectiveOpacity();
CompositionOp blendMode = GetEffectiveMixBlendMode();
if ((opacity != 1.0f || blendMode != CompositionOp::OP_OVER) && HasMultipleChildren()) {
useIntermediateSurface = true;
} else {
useIntermediateSurface = false;
gfx::Matrix contTransform;
if (!mEffectiveTransform.Is2D(&contTransform) ||
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
!contTransform.PreservesAxisAlignedRectangles()) {
#else
gfx::ThebesMatrix(contTransform).HasNonIntegerTranslation()) {
#endif
for (Layer* child = GetFirstChild(); child; child = child->GetNextSibling()) {
const nsIntRect *clipRect = child->GetEffectiveClipRect();
/* We can't (easily) forward our transform to children with a non-empty clip
* rect since it would need to be adjusted for the transform. See
* the calculations performed by CalculateScissorRect above.
* Nor for a child with a mask layer.
*/
if ((clipRect && !clipRect->IsEmpty() && !child->GetVisibleRegion().IsEmpty()) ||
child->GetMaskLayer()) {
useIntermediateSurface = true;
break;
}
}
}
}
}
mUseIntermediateSurface = useIntermediateSurface;
if (useIntermediateSurface) {
ComputeEffectiveTransformsForChildren(Matrix4x4::From2D(residual));
} else {
ComputeEffectiveTransformsForChildren(idealTransform);
}
if (idealTransform.CanDraw2D()) {
ComputeEffectiveTransformForMaskLayer(aTransformToSurface);
} else {
ComputeEffectiveTransformForMaskLayer(Matrix4x4());
}
}
示例2: transformOffset
static Layer*
FindBackgroundLayer(ReadbackLayer* aLayer, nsIntPoint* aOffset)
{
gfx::Matrix transform;
if (!aLayer->GetTransform().Is2D(&transform) ||
transform.HasNonIntegerTranslation())
return nullptr;
nsIntPoint transformOffset(int32_t(transform._31), int32_t(transform._32));
for (Layer* l = aLayer->GetPrevSibling(); l; l = l->GetPrevSibling()) {
gfx::Matrix backgroundTransform;
if (!l->GetTransform().Is2D(&backgroundTransform) ||
gfx::ThebesMatrix(backgroundTransform).HasNonIntegerTranslation())
return nullptr;
nsIntPoint backgroundOffset(int32_t(backgroundTransform._31), int32_t(backgroundTransform._32));
IntRect rectInBackground(transformOffset - backgroundOffset, aLayer->GetSize());
const nsIntRegion visibleRegion = l->GetEffectiveVisibleRegion().ToUnknownRegion();
if (!visibleRegion.Intersects(rectInBackground))
continue;
// Since l is present in the background, from here on we either choose l
// or nothing.
if (!visibleRegion.Contains(rectInBackground))
return nullptr;
if (l->GetEffectiveOpacity() != 1.0 ||
l->HasMaskLayers() ||
!(l->GetContentFlags() & Layer::CONTENT_OPAQUE))
{
return nullptr;
}
// cliprects are post-transform
const Maybe<ParentLayerIntRect>& clipRect = l->GetEffectiveClipRect();
if (clipRect && !clipRect->Contains(ViewAs<ParentLayerPixel>(IntRect(transformOffset, aLayer->GetSize()))))
return nullptr;
Layer::LayerType type = l->GetType();
if (type != Layer::TYPE_COLOR && type != Layer::TYPE_PAINTED)
return nullptr;
*aOffset = backgroundOffset - transformOffset;
return l;
}
return nullptr;
}
示例3:
bool
ContainerLayer::HasMultipleChildren()
{
uint32_t count = 0;
for (Layer* child = GetFirstChild(); child; child = child->GetNextSibling()) {
const nsIntRect *clipRect = child->GetEffectiveClipRect();
if (clipRect && clipRect->IsEmpty())
continue;
if (child->GetVisibleRegion().IsEmpty())
continue;
++count;
if (count > 1)
return true;
}
return false;
}
示例4: transformOffset
static Layer*
FindBackgroundLayer(ReadbackLayer* aLayer, nsIntPoint* aOffset)
{
gfxMatrix transform;
if (!aLayer->GetTransform().Is2D(&transform) ||
transform.HasNonIntegerTranslation())
return nullptr;
nsIntPoint transformOffset(int32_t(transform.x0), int32_t(transform.y0));
for (Layer* l = aLayer->GetPrevSibling(); l; l = l->GetPrevSibling()) {
gfxMatrix backgroundTransform;
if (!l->GetTransform().Is2D(&backgroundTransform) ||
backgroundTransform.HasNonIntegerTranslation())
return nullptr;
nsIntPoint backgroundOffset(int32_t(backgroundTransform.x0), int32_t(backgroundTransform.y0));
nsIntRect rectInBackground(transformOffset - backgroundOffset, aLayer->GetSize());
const nsIntRegion& visibleRegion = l->GetEffectiveVisibleRegion();
if (!visibleRegion.Intersects(rectInBackground))
continue;
// Since l is present in the background, from here on we either choose l
// or nothing.
if (!visibleRegion.Contains(rectInBackground))
return nullptr;
if (l->GetEffectiveOpacity() != 1.0 ||
!(l->GetContentFlags() & Layer::CONTENT_OPAQUE))
return nullptr;
// cliprects are post-transform
const nsIntRect* clipRect = l->GetEffectiveClipRect();
if (clipRect && !clipRect->Contains(nsIntRect(transformOffset, aLayer->GetSize())))
return nullptr;
Layer::LayerType type = l->GetType();
if (type != Layer::TYPE_COLOR && type != Layer::TYPE_THEBES)
return nullptr;
*aOffset = backgroundOffset - transformOffset;
return l;
}
return nullptr;
}
示例5: GetLocalTransform
void
ContainerLayer::DefaultComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface)
{
gfxMatrix residual;
gfx3DMatrix idealTransform = GetLocalTransform()*aTransformToSurface;
mEffectiveTransform = SnapTransform(idealTransform, gfxRect(0, 0, 0, 0), &residual);
bool useIntermediateSurface;
float opacity = GetEffectiveOpacity();
if (opacity != 1.0f && HasMultipleChildren()) {
useIntermediateSurface = PR_TRUE;
} else {
useIntermediateSurface = PR_FALSE;
gfxMatrix contTransform;
if (!mEffectiveTransform.Is2D(&contTransform)) {
useIntermediateSurface = PR_TRUE;
} else if (
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
!contTransform.PreservesAxisAlignedRectangles()) {
#else
contTransform.HasNonIntegerTranslation()) {
#endif
for (Layer* child = GetFirstChild(); child; child = child->GetNextSibling()) {
const nsIntRect *clipRect = child->GetEffectiveClipRect();
/* We can't (easily) forward our transform to children with a non-empty clip
* rect since it would need to be adjusted for the transform. See
* the calculations performed by CalculateScissorRect above.
*/
if (clipRect && !clipRect->IsEmpty() && !child->GetVisibleRegion().IsEmpty()) {
useIntermediateSurface = PR_TRUE;
break;
}
}
}
}
mUseIntermediateSurface = useIntermediateSurface;
if (useIntermediateSurface) {
ComputeEffectiveTransformsForChildren(gfx3DMatrix::From2D(residual));
} else {
ComputeEffectiveTransformsForChildren(idealTransform);
}
}
示例6: GetLocalTransform
void
ContainerLayer::DefaultComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface)
{
gfxMatrix residual;
gfx3DMatrix idealTransform = GetLocalTransform()*aTransformToSurface;
mEffectiveTransform = SnapTransform(idealTransform, gfxRect(0, 0, 0, 0), &residual);
PRBool useIntermediateSurface;
float opacity = GetEffectiveOpacity();
if (opacity != 1.0f && HasMultipleChildren()) {
useIntermediateSurface = PR_TRUE;
} else {
useIntermediateSurface = PR_FALSE;
gfxMatrix contTransform;
if (!mEffectiveTransform.Is2D(&contTransform) ||
!contTransform.PreservesAxisAlignedRectangles()) {
for (Layer* child = GetFirstChild(); child; child = child->GetNextSibling()) {
const nsIntRect *clipRect = child->GetEffectiveClipRect();
/* We can't (easily) forward our transform to children with a non-empty clip
* rect since it would need to be adjusted for the transform.
* TODO: This is easily solvable for translation/scaling transforms.
*/
if (clipRect && !clipRect->IsEmpty() && !child->GetVisibleRegion().IsEmpty()) {
useIntermediateSurface = PR_TRUE;
break;
}
}
}
}
mUseIntermediateSurface = useIntermediateSurface;
if (useIntermediateSurface) {
ComputeEffectiveTransformsForChildren(gfx3DMatrix::From2D(residual));
} else {
ComputeEffectiveTransformsForChildren(idealTransform);
}
}