本文整理汇总了C++中Matrix4x4::CanDraw2D方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4x4::CanDraw2D方法的具体用法?C++ Matrix4x4::CanDraw2D怎么用?C++ Matrix4x4::CanDraw2D使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix4x4
的用法示例。
在下文中一共展示了Matrix4x4::CanDraw2D方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: GetLocalTransform
void
BasicContainerLayer::ComputeEffectiveTransforms(const Matrix4x4& aTransformToSurface)
{
// We push groups for container layers if we need to, which always
// are aligned in device space, so it doesn't really matter how we snap
// containers.
Matrix residual;
Matrix4x4 idealTransform = GetLocalTransform() * aTransformToSurface;
idealTransform.ProjectTo2D();
if (!idealTransform.CanDraw2D()) {
mEffectiveTransform = idealTransform;
ComputeEffectiveTransformsForChildren(Matrix4x4());
ComputeEffectiveTransformForMaskLayer(Matrix4x4());
mUseIntermediateSurface = true;
return;
}
mEffectiveTransform = SnapTransformTranslation(idealTransform, &residual);
// We always pass the ideal matrix down to our children, so there is no
// need to apply any compensation using the residual from SnapTransformTranslation.
ComputeEffectiveTransformsForChildren(idealTransform);
ComputeEffectiveTransformForMaskLayer(aTransformToSurface);
Layer* child = GetFirstChild();
bool hasSingleBlendingChild = false;
if (!HasMultipleChildren() && child) {
hasSingleBlendingChild = child->GetMixBlendMode() != CompositionOp::OP_OVER;
}
/* If we have a single childand it is not blending,, it can just inherit our opacity,
* otherwise we need a PushGroup and we need to mark ourselves as using
* an intermediate surface so our children don't inherit our opacity
* via GetEffectiveOpacity.
* Having a mask layer always forces our own push group
* Having a blend mode also always forces our own push group
*/
mUseIntermediateSurface =
GetMaskLayer() ||
GetForceIsolatedGroup() ||
(GetMixBlendMode() != CompositionOp::OP_OVER && HasMultipleChildren()) ||
(GetEffectiveOpacity() != 1.0 && (HasMultipleChildren() || hasSingleBlendingChild));
}
示例3:
bool
GetMaskData(Layer* aMaskLayer,
const Point& aDeviceOffset,
AutoMoz2DMaskData* aMaskData)
{
if (aMaskLayer) {
RefPtr<SourceSurface> surface =
static_cast<BasicImplData*>(aMaskLayer->ImplData())->GetAsSourceSurface();
if (surface) {
Matrix transform;
Matrix4x4 effectiveTransform = aMaskLayer->GetEffectiveTransform();
DebugOnly<bool> maskIs2D = effectiveTransform.CanDraw2D(&transform);
NS_ASSERTION(maskIs2D, "How did we end up with a 3D transform here?!");
transform.PostTranslate(-aDeviceOffset.x, -aDeviceOffset.y);
aMaskData->Construct(transform, surface);
return true;
}
}
return false;
}
示例4: GetLocalTransform
void
BasicContainerLayer::ComputeEffectiveTransforms(const Matrix4x4& aTransformToSurface)
{
// We push groups for container layers if we need to, which always
// are aligned in device space, so it doesn't really matter how we snap
// containers.
Matrix residual;
Matrix4x4 idealTransform = GetLocalTransform() * aTransformToSurface;
if (!Extend3DContext() && !Is3DContextLeaf()) {
// For 3D transform leaked from extended parent layer.
idealTransform.ProjectTo2D();
}
if (!idealTransform.CanDraw2D()) {
if (!Extend3DContext() ||
(!idealTransform.Is2D() && Creates3DContextWithExtendingChildren())) {
if (!Creates3DContextWithExtendingChildren()) {
idealTransform.ProjectTo2D();
}
mEffectiveTransform = idealTransform;
ComputeEffectiveTransformsForChildren(Matrix4x4());
ComputeEffectiveTransformForMaskLayers(Matrix4x4());
mUseIntermediateSurface = true;
return;
}
mEffectiveTransform = idealTransform;
ComputeEffectiveTransformsForChildren(idealTransform);
ComputeEffectiveTransformForMaskLayers(idealTransform);
mUseIntermediateSurface = false;
return;
}
// With 2D transform or extended 3D context.
Layer* child = GetFirstChild();
bool hasSingleBlendingChild = false;
if (!HasMultipleChildren() && child) {
hasSingleBlendingChild = child->GetMixBlendMode() != CompositionOp::OP_OVER;
}
/* If we have a single childand it is not blending,, it can just inherit our opacity,
* otherwise we need a PushGroup and we need to mark ourselves as using
* an intermediate surface so our children don't inherit our opacity
* via GetEffectiveOpacity.
* Having a mask layer always forces our own push group
* Having a blend mode also always forces our own push group
*/
mUseIntermediateSurface =
GetMaskLayer() ||
GetForceIsolatedGroup() ||
(GetMixBlendMode() != CompositionOp::OP_OVER && HasMultipleChildren()) ||
(GetEffectiveOpacity() != 1.0 && (HasMultipleChildren() || hasSingleBlendingChild));
if (!Extend3DContext()) {
idealTransform.ProjectTo2D();
}
mEffectiveTransform =
!mUseIntermediateSurface ?
idealTransform : SnapTransformTranslation(idealTransform, &residual);
Matrix4x4 childTransformToSurface =
(!mUseIntermediateSurface ||
(mUseIntermediateSurface && !Extend3DContext() /* 2D */)) ?
idealTransform : Matrix4x4::From2D(residual);
ComputeEffectiveTransformsForChildren(childTransformToSurface);
ComputeEffectiveTransformForMaskLayers(aTransformToSurface);
}