本文整理汇总了C++中Layer::GetAnimations方法的典型用法代码示例。如果您正苦于以下问题:C++ Layer::GetAnimations方法的具体用法?C++ Layer::GetAnimations怎么用?C++ Layer::GetAnimations使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Layer
的用法示例。
在下文中一共展示了Layer::GetAnimations方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cast
bool
LayerTransactionParent::RecvGetTransform(PLayerParent* aParent,
gfx3DMatrix* aTransform)
{
if (mDestroyed || !layer_manager() || layer_manager()->IsDestroyed()) {
return false;
}
// The following code recovers the untranslated transform
// from the shadow transform by undoing the translations in
// AsyncCompositionManager::SampleValue.
Layer* layer = cast(aParent)->AsLayer();
if (!layer) {
return false;
}
gfx::To3DMatrix(layer->AsLayerComposite()->GetShadowTransform(), *aTransform);
if (ContainerLayer* c = layer->AsContainerLayer()) {
aTransform->ScalePost(1.0f/c->GetInheritedXScale(),
1.0f/c->GetInheritedYScale(),
1.0f);
}
float scale = 1;
gfxPoint3D scaledOrigin;
gfxPoint3D transformOrigin;
for (uint32_t i=0; i < layer->GetAnimations().Length(); i++) {
if (layer->GetAnimations()[i].data().type() == AnimationData::TTransformData) {
const TransformData& data = layer->GetAnimations()[i].data().get_TransformData();
scale = data.appUnitsPerDevPixel();
scaledOrigin =
gfxPoint3D(NS_round(NSAppUnitsToFloatPixels(data.origin().x, scale)),
NS_round(NSAppUnitsToFloatPixels(data.origin().y, scale)),
0.0f);
transformOrigin = data.transformOrigin();
break;
}
}
aTransform->Translate(-scaledOrigin);
*aTransform = nsLayoutUtils::ChangeMatrixBasis(-scaledOrigin - transformOrigin, *aTransform);
return true;
}
示例2: cast
bool
LayerTransactionParent::RecvGetAnimationTransform(PLayerParent* aParent,
MaybeTransform* aTransform)
{
if (mDestroyed || !layer_manager() || layer_manager()->IsDestroyed()) {
return false;
}
Layer* layer = cast(aParent)->AsLayer();
if (!layer) {
return false;
}
// This method is specific to transforms applied by animation.
// This is because this method uses the information stored with an animation
// such as the origin of the reference frame corresponding to the layer, to
// recover the untranslated transform from the shadow transform. For
// transforms that are not set by animation we don't have this information
// available.
if (!layer->AsLayerComposite()->GetShadowTransformSetByAnimation()) {
*aTransform = mozilla::void_t();
return true;
}
// The following code recovers the untranslated transform
// from the shadow transform by undoing the translations in
// AsyncCompositionManager::SampleValue.
Matrix4x4 transform = layer->AsLayerComposite()->GetShadowTransform();
if (ContainerLayer* c = layer->AsContainerLayer()) {
// Undo the scale transform applied by AsyncCompositionManager::SampleValue
transform.ScalePost(1.0f/c->GetInheritedXScale(),
1.0f/c->GetInheritedYScale(),
1.0f);
}
float scale = 1;
gfxPoint3D scaledOrigin;
gfxPoint3D transformOrigin;
for (uint32_t i=0; i < layer->GetAnimations().Length(); i++) {
if (layer->GetAnimations()[i].data().type() == AnimationData::TTransformData) {
const TransformData& data = layer->GetAnimations()[i].data().get_TransformData();
scale = data.appUnitsPerDevPixel();
scaledOrigin =
gfxPoint3D(NS_round(NSAppUnitsToFloatPixels(data.origin().x, scale)),
NS_round(NSAppUnitsToFloatPixels(data.origin().y, scale)),
0.0f);
double cssPerDev =
double(nsDeviceContext::AppUnitsPerCSSPixel()) / double(scale);
transformOrigin = data.transformOrigin() * cssPerDev;
break;
}
}
// Undo the translation to the origin of the reference frame applied by
// AsyncCompositionManager::SampleValue
transform.Translate(-scaledOrigin.x, -scaledOrigin.y, -scaledOrigin.z);
// Undo the rebasing applied by
// nsDisplayTransform::GetResultingTransformMatrixInternal
gfxPoint3D basis = -scaledOrigin - transformOrigin;
transform.ChangeBasis(basis.x, basis.y, basis.z);
// Convert to CSS pixels (this undoes the operations performed by
// nsStyleTransformMatrix::ProcessTranslatePart which is called from
// nsDisplayTransform::GetResultingTransformMatrix)
double devPerCss =
double(scale) / double(nsDeviceContext::AppUnitsPerCSSPixel());
transform._41 *= devPerCss;
transform._42 *= devPerCss;
transform._43 *= devPerCss;
*aTransform = transform;
return true;
}
示例3: rendertrace
bool
ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
const nsIntRegion& aRegionToClear,
uint64_t aId,
bool aScheduleComposite,
uint32_t aPaintSequenceNumber,
bool aIsRepeatTransaction,
bool* aSent)
{
*aSent = false;
MOZ_ASSERT(aId);
PROFILER_LABEL("ShadowLayerForwarder", "EndTranscation",
js::ProfileEntry::Category::GRAPHICS);
RenderTraceScope rendertrace("Foward Transaction", "000091");
NS_ABORT_IF_FALSE(HasShadowManager(), "no manager to forward to");
NS_ABORT_IF_FALSE(!mTxn->Finished(), "forgot BeginTransaction?");
DiagnosticTypes diagnostics = gfxPlatform::GetPlatform()->GetLayerDiagnosticTypes();
if (mDiagnosticTypes != diagnostics) {
mDiagnosticTypes = diagnostics;
mTxn->AddEdit(OpSetDiagnosticTypes(diagnostics));
}
AutoTxnEnd _(mTxn);
if (mTxn->Empty() && !mTxn->RotationChanged() && !mWindowOverlayChanged) {
MOZ_LAYERS_LOG(("[LayersForwarder] 0-length cset (?) and no rotation event, skipping Update()"));
return true;
}
MOZ_LAYERS_LOG(("[LayersForwarder] destroying buffers..."));
MOZ_LAYERS_LOG(("[LayersForwarder] building transaction..."));
// We purposely add attribute-change ops to the final changeset
// before we add paint ops. This allows layers to record the
// attribute changes before new pixels arrive, which can be useful
// for setting up back/front buffers.
RenderTraceScope rendertrace2("Foward Transaction", "000092");
for (ShadowableLayerSet::const_iterator it = mTxn->mMutants.begin();
it != mTxn->mMutants.end(); ++it) {
ShadowableLayer* shadow = *it;
Layer* mutant = shadow->AsLayer();
NS_ABORT_IF_FALSE(!!mutant, "unshadowable layer?");
LayerAttributes attrs;
CommonLayerAttributes& common = attrs.common();
common.visibleRegion() = mutant->GetVisibleRegion();
common.eventRegions() = mutant->GetEventRegions();
common.postXScale() = mutant->GetPostXScale();
common.postYScale() = mutant->GetPostYScale();
common.transform() = mutant->GetBaseTransform();
common.contentFlags() = mutant->GetContentFlags();
common.opacity() = mutant->GetOpacity();
common.useClipRect() = !!mutant->GetClipRect();
common.clipRect() = (common.useClipRect() ?
*mutant->GetClipRect() : nsIntRect());
common.isFixedPosition() = mutant->GetIsFixedPosition();
common.fixedPositionAnchor() = mutant->GetFixedPositionAnchor();
common.fixedPositionMargin() = mutant->GetFixedPositionMargins();
common.isStickyPosition() = mutant->GetIsStickyPosition();
if (mutant->GetIsStickyPosition()) {
common.stickyScrollContainerId() = mutant->GetStickyScrollContainerId();
common.stickyScrollRangeOuter() = mutant->GetStickyScrollRangeOuter();
common.stickyScrollRangeInner() = mutant->GetStickyScrollRangeInner();
}
common.scrollbarTargetContainerId() = mutant->GetScrollbarTargetContainerId();
common.scrollbarDirection() = mutant->GetScrollbarDirection();
common.mixBlendMode() = (int8_t)mutant->GetMixBlendMode();
common.forceIsolatedGroup() = mutant->GetForceIsolatedGroup();
if (Layer* maskLayer = mutant->GetMaskLayer()) {
common.maskLayerChild() = Shadow(maskLayer->AsShadowableLayer());
} else {
common.maskLayerChild() = nullptr;
}
common.maskLayerParent() = nullptr;
common.animations() = mutant->GetAnimations();
common.invalidRegion() = mutant->GetInvalidRegion();
attrs.specific() = null_t();
mutant->FillSpecificAttributes(attrs.specific());
MOZ_LAYERS_LOG(("[LayersForwarder] OpSetLayerAttributes(%p)\n", mutant));
mTxn->AddEdit(OpSetLayerAttributes(nullptr, Shadow(shadow), attrs));
}
AutoInfallibleTArray<Edit, 10> cset;
size_t nCsets = mTxn->mCset.size() + mTxn->mPaints.size();
NS_ABORT_IF_FALSE(nCsets > 0 || mWindowOverlayChanged, "should have bailed by now");
cset.SetCapacity(nCsets);
if (!mTxn->mCset.empty()) {
cset.AppendElements(&mTxn->mCset.front(), mTxn->mCset.size());
}
// Paints after non-paint ops, including attribute changes. See
// above.
if (!mTxn->mPaints.empty()) {
//.........这里部分代码省略.........