本文整理汇总了C++中StaticAutoPtr::GetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ StaticAutoPtr::GetValue方法的具体用法?C++ StaticAutoPtr::GetValue怎么用?C++ StaticAutoPtr::GetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StaticAutoPtr
的用法示例。
在下文中一共展示了StaticAutoPtr::GetValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ApplyFlingCurveToVelocity
float Axis::ApplyFlingCurveToVelocity(float aVelocity) const {
float newVelocity = aVelocity;
if (gfxPrefs::APZMaxVelocity() > 0.0f) {
bool velocityIsNegative = (newVelocity < 0);
newVelocity = fabs(newVelocity);
float maxVelocity = ToLocalVelocity(gfxPrefs::APZMaxVelocity());
newVelocity = std::min(newVelocity, maxVelocity);
if (gfxPrefs::APZCurveThreshold() > 0.0f && gfxPrefs::APZCurveThreshold() < gfxPrefs::APZMaxVelocity()) {
float curveThreshold = ToLocalVelocity(gfxPrefs::APZCurveThreshold());
if (newVelocity > curveThreshold) {
// here, 0 < curveThreshold < newVelocity <= maxVelocity, so we apply the curve
float scale = maxVelocity - curveThreshold;
float funcInput = (newVelocity - curveThreshold) / scale;
float funcOutput =
gVelocityCurveFunction->GetValue(funcInput,
ComputedTimingFunction::BeforeFlag::Unset);
float curvedVelocity = (funcOutput * scale) + curveThreshold;
AXIS_LOG("%p|%s curving up velocity from %f to %f\n",
mAsyncPanZoomController, Name(), newVelocity, curvedVelocity);
newVelocity = curvedVelocity;
}
}
if (velocityIsNegative) {
newVelocity = -newVelocity;
}
}
return newVelocity;
}
示例2: UpdateWithTouchAtDevicePoint
void Axis::UpdateWithTouchAtDevicePoint(ParentLayerCoord aPos, ParentLayerCoord aAdditionalDelta, uint32_t aTimestampMs) {
// mVelocityQueue is controller-thread only
APZThreadUtils::AssertOnControllerThread();
if (aTimestampMs <= mVelocitySampleTimeMs + MIN_VELOCITY_SAMPLE_TIME_MS) {
// See also the comment on MIN_VELOCITY_SAMPLE_TIME_MS.
// We still update mPos so that the positioning is correct (and we don't run
// into problems like bug 1042734) but the velocity will remain where it was.
// In particular we don't update either mVelocitySampleTimeMs or
// mVelocitySamplePos so that eventually when we do get an event with the
// required time delta we use the corresponding distance delta as well.
AXIS_LOG("%p|%s skipping velocity computation for small time delta %dms\n",
mAsyncPanZoomController, Name(), (aTimestampMs - mVelocitySampleTimeMs));
mPos = aPos;
return;
}
float newVelocity = mAxisLocked ? 0.0f : (float)(mVelocitySamplePos - aPos + aAdditionalDelta) / (float)(aTimestampMs - mVelocitySampleTimeMs);
if (gfxPrefs::APZMaxVelocity() > 0.0f) {
bool velocityIsNegative = (newVelocity < 0);
newVelocity = fabs(newVelocity);
float maxVelocity = ToLocalVelocity(gfxPrefs::APZMaxVelocity());
newVelocity = std::min(newVelocity, maxVelocity);
if (gfxPrefs::APZCurveThreshold() > 0.0f && gfxPrefs::APZCurveThreshold() < gfxPrefs::APZMaxVelocity()) {
float curveThreshold = ToLocalVelocity(gfxPrefs::APZCurveThreshold());
if (newVelocity > curveThreshold) {
// here, 0 < curveThreshold < newVelocity <= maxVelocity, so we apply the curve
float scale = maxVelocity - curveThreshold;
float funcInput = (newVelocity - curveThreshold) / scale;
float funcOutput = gVelocityCurveFunction->GetValue(funcInput);
float curvedVelocity = (funcOutput * scale) + curveThreshold;
AXIS_LOG("%p|%s curving up velocity from %f to %f\n",
mAsyncPanZoomController, Name(), newVelocity, curvedVelocity);
newVelocity = curvedVelocity;
}
}
if (velocityIsNegative) {
newVelocity = -newVelocity;
}
}
AXIS_LOG("%p|%s updating velocity to %f with touch\n",
mAsyncPanZoomController, Name(), newVelocity);
mVelocity = newVelocity;
mPos = aPos;
mVelocitySampleTimeMs = aTimestampMs;
mVelocitySamplePos = aPos;
// Limit queue size pased on pref
mVelocityQueue.AppendElement(std::make_pair(aTimestampMs, mVelocity));
if (mVelocityQueue.Length() > gfxPrefs::APZMaxVelocityQueueSize()) {
mVelocityQueue.RemoveElementAt(0);
}
}
示例3: UpdateWithTouchAtDevicePoint
void Axis::UpdateWithTouchAtDevicePoint(ParentLayerCoord aPos, uint32_t aTimestampMs) {
// mVelocityQueue is controller-thread only
APZThreadUtils::AssertOnControllerThread();
if (aTimestampMs == mPosTimeMs) {
// This could be a duplicate event, or it could be a legitimate event
// on some platforms that generate events really fast. As a compromise
// update mPos so we don't run into problems like bug 1042734, even though
// that means the velocity will be stale. Better than doing a divide-by-zero.
mPos = aPos;
return;
}
float newVelocity = mAxisLocked ? 0.0f : (float)(mPos - aPos) / (float)(aTimestampMs - mPosTimeMs);
if (gfxPrefs::APZMaxVelocity() > 0.0f) {
bool velocityIsNegative = (newVelocity < 0);
newVelocity = fabs(newVelocity);
float maxVelocity = ToLocalVelocity(gfxPrefs::APZMaxVelocity());
newVelocity = std::min(newVelocity, maxVelocity);
if (gfxPrefs::APZCurveThreshold() > 0.0f && gfxPrefs::APZCurveThreshold() < gfxPrefs::APZMaxVelocity()) {
float curveThreshold = ToLocalVelocity(gfxPrefs::APZCurveThreshold());
if (newVelocity > curveThreshold) {
// here, 0 < curveThreshold < newVelocity <= maxVelocity, so we apply the curve
float scale = maxVelocity - curveThreshold;
float funcInput = (newVelocity - curveThreshold) / scale;
float funcOutput = gVelocityCurveFunction->GetValue(funcInput);
float curvedVelocity = (funcOutput * scale) + curveThreshold;
AXIS_LOG("%p|%s curving up velocity from %f to %f\n",
mAsyncPanZoomController, Name(), newVelocity, curvedVelocity);
newVelocity = curvedVelocity;
}
}
if (velocityIsNegative) {
newVelocity = -newVelocity;
}
}
AXIS_LOG("%p|%s updating velocity to %f with touch\n",
mAsyncPanZoomController, Name(), newVelocity);
mVelocity = newVelocity;
mPos = aPos;
mPosTimeMs = aTimestampMs;
// Limit queue size pased on pref
mVelocityQueue.AppendElement(std::make_pair(aTimestampMs, mVelocity));
if (mVelocityQueue.Length() > gfxPrefs::APZMaxVelocityQueueSize()) {
mVelocityQueue.RemoveElementAt(0);
}
}