Bug 979720 - Convert max velocity from px/ms to inches/ms. r=bkelly

This commit is contained in:
Kartikaya Gupta 2014-03-14 15:49:00 -04:00
parent ec971e55c8
commit 7f5a497900
3 changed files with 7 additions and 6 deletions

View File

@ -870,9 +870,9 @@ pref("osfile.reset_worker_delay", 5000);
pref("apz.asyncscroll.throttle", 40); pref("apz.asyncscroll.throttle", 40);
pref("apz.pan_repaint_interval", 16); pref("apz.pan_repaint_interval", 16);
// Maximum fling velocity in px/ms. Slower devices may need to reduce this // Maximum fling velocity in inches/ms. Slower devices may need to reduce this
// to avoid checkerboarding. Note, float value must be set as a string. // to avoid checkerboarding. Note, float value must be set as a string.
pref("apz.max_velocity_pixels_per_ms", "6.0"); pref("apz.max_velocity_pixels_per_inch", "0.0375");
// Tweak default displayport values to reduce the risk of running out of // Tweak default displayport values to reduce the risk of running out of
// memory when zooming in // memory when zooming in

View File

@ -8,6 +8,7 @@
#include <math.h> // for fabsf, pow, powf #include <math.h> // for fabsf, pow, powf
#include <algorithm> // for max #include <algorithm> // for max
#include "AsyncPanZoomController.h" // for AsyncPanZoomController #include "AsyncPanZoomController.h" // for AsyncPanZoomController
#include "mozilla/layers/APZCTreeManager.h" // for APZCTreeManager
#include "FrameMetrics.h" // for FrameMetrics #include "FrameMetrics.h" // for FrameMetrics
#include "mozilla/Attributes.h" // for MOZ_FINAL #include "mozilla/Attributes.h" // for MOZ_FINAL
#include "mozilla/Preferences.h" // for Preferences #include "mozilla/Preferences.h" // for Preferences
@ -65,9 +66,9 @@ namespace layers {
*/ */
/** /**
* "apz.max_velocity_pixels_per_ms" * "apz.max_velocity_pixels_per_inch"
* *
* Maximum velocity in pixels per millisecond. Velocity will be capped at this * Maximum velocity in inches per millisecond. Velocity will be capped at this
* value if a faster fling occurs. Negative values indicate unlimited velocity. * value if a faster fling occurs. Negative values indicate unlimited velocity.
* *
* The default value is -1.0f, set in gfxPrefs.h * The default value is -1.0f, set in gfxPrefs.h
@ -84,7 +85,7 @@ Axis::Axis(AsyncPanZoomController* aAsyncPanZoomController)
void Axis::UpdateWithTouchAtDevicePoint(int32_t aPos, const TimeDuration& aTimeDelta) { void Axis::UpdateWithTouchAtDevicePoint(int32_t aPos, const TimeDuration& aTimeDelta) {
float newVelocity = mAxisLocked ? 0 : (mPos - aPos) / aTimeDelta.ToMilliseconds(); float newVelocity = mAxisLocked ? 0 : (mPos - aPos) / aTimeDelta.ToMilliseconds();
if (gfxPrefs::APZMaxVelocity() > 0.0f) { if (gfxPrefs::APZMaxVelocity() > 0.0f) {
newVelocity = std::min(newVelocity, gfxPrefs::APZMaxVelocity()); newVelocity = std::min(newVelocity, gfxPrefs::APZMaxVelocity() * APZCTreeManager::GetDPI());
} }
mVelocity = newVelocity; mVelocity = newVelocity;

View File

@ -106,7 +106,7 @@ private:
DECL_GFX_PREF(Once, "apz.fling_friction", APZFlingFriction, float, 0.002f); DECL_GFX_PREF(Once, "apz.fling_friction", APZFlingFriction, float, 0.002f);
DECL_GFX_PREF(Once, "apz.fling_stopped_threshold", APZFlingStoppedThreshold, float, 0.01f); DECL_GFX_PREF(Once, "apz.fling_stopped_threshold", APZFlingStoppedThreshold, float, 0.01f);
DECL_GFX_PREF(Once, "apz.max_event_acceleration", APZMaxEventAcceleration, float, 999.0f); DECL_GFX_PREF(Once, "apz.max_event_acceleration", APZMaxEventAcceleration, float, 999.0f);
DECL_GFX_PREF(Once, "apz.max_velocity_pixels_per_ms", APZMaxVelocity, float, -1.0f); DECL_GFX_PREF(Once, "apz.max_velocity_pixels_per_inch", APZMaxVelocity, float, -1.0f);
DECL_GFX_PREF(Once, "apz.max_velocity_queue_size", APZMaxVelocityQueueSize, uint32_t, 5); DECL_GFX_PREF(Once, "apz.max_velocity_queue_size", APZMaxVelocityQueueSize, uint32_t, 5);
DECL_GFX_PREF(Once, "gfx.android.rgb16.force", AndroidRGB16Force, bool, false); DECL_GFX_PREF(Once, "gfx.android.rgb16.force", AndroidRGB16Force, bool, false);