From 6acd84d02ecfaaec7fa1891177e974b6c60bae00 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Fri, 8 Aug 2014 17:41:51 -0400 Subject: [PATCH] Bug 1046344 - Add a build option to enable the C++ APZ code. r=snorp --- configure.in | 14 ++++++++++++++ mobile/android/app/mobile.js | 3 +++ mobile/android/base/AppConstants.java.in | 7 +++++++ mobile/android/base/gfx/PanZoomController.java | 6 +++++- 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 45bc022ed2d..ec3cc8af005 100644 --- a/configure.in +++ b/configure.in @@ -3817,6 +3817,7 @@ MOZ_SAFE_BROWSING= MOZ_HELP_VIEWER= MOZ_SPELLCHECK=1 MOZ_ANDROID_OMTC= +MOZ_ANDROID_APZ= MOZ_TOOLKIT_SEARCH=1 MOZ_UI_LOCALE=en-US MOZ_UNIVERSALCHARDET=1 @@ -4819,6 +4820,18 @@ if test -n "$MOZ_ANDROID_OMTC"; then AC_DEFINE(MOZ_ANDROID_OMTC) fi +dnl ======================================================== +dnl = Enable the C++ async pan/zoom code instead of the Java version +dnl ======================================================== +MOZ_ARG_ENABLE_BOOL(android-apz, +[ --enable-android-apz Switch to C++ pan/zoom code], + MOZ_ANDROID_APZ=1, + MOZ_ANDROID_APZ=) +if test -n "$MOZ_ANDROID_APZ"; then + dnl Do this if defined in confvars.sh + AC_DEFINE(MOZ_ANDROID_APZ) +fi + dnl ======================================================== dnl = Disable WebSMS backend dnl ======================================================== @@ -8397,6 +8410,7 @@ AC_SUBST(MOZ_UNIVERSALCHARDET) AC_SUBST(ACCESSIBILITY) AC_SUBST(MOZ_SPELLCHECK) AC_SUBST(MOZ_ANDROID_OMTC) +AC_SUBST(MOZ_ANDROID_APZ) AC_SUBST(MOZ_ANDROID_ANR_REPORTER) AC_SUBST(MOZ_CRASHREPORTER) AC_SUBST(MOZ_CRASHREPORTER_INJECTOR) diff --git a/mobile/android/app/mobile.js b/mobile/android/app/mobile.js index e28df099e48..93038093712 100644 --- a/mobile/android/app/mobile.js +++ b/mobile/android/app/mobile.js @@ -564,6 +564,9 @@ pref("ui.dragThresholdY", 25); pref("layers.acceleration.disabled", false); pref("layers.offmainthreadcomposition.enabled", true); pref("layers.async-video.enabled", true); +#ifdef MOZ_ANDROID_APZ +pref("layers.async-pan-zoom.enabled", true); +#endif pref("layers.progressive-paint", true); pref("layers.low-precision-buffer", true); pref("layers.low-precision-resolution", "0.25"); diff --git a/mobile/android/base/AppConstants.java.in b/mobile/android/base/AppConstants.java.in index 1f3f47a3559..63659fba174 100644 --- a/mobile/android/base/AppConstants.java.in +++ b/mobile/android/base/AppConstants.java.in @@ -196,6 +196,13 @@ public class AppConstants { false; #endif + public static final boolean MOZ_ANDROID_APZ = +#ifdef MOZ_ANDROID_APZ + true; +#else + false; +#endif + // See this wiki page for more details about channel specific build defines: // https://wiki.mozilla.org/Platform/Channel-specific_build_defines public static final boolean RELEASE_BUILD = diff --git a/mobile/android/base/gfx/PanZoomController.java b/mobile/android/base/gfx/PanZoomController.java index ed4f6b9a2cf..15b111d864e 100644 --- a/mobile/android/base/gfx/PanZoomController.java +++ b/mobile/android/base/gfx/PanZoomController.java @@ -23,7 +23,11 @@ public interface PanZoomController { static class Factory { static PanZoomController create(PanZoomTarget target, View view, EventDispatcher dispatcher) { - return new JavaPanZoomController(target, view, dispatcher); + if (org.mozilla.gecko.AppConstants.MOZ_ANDROID_APZ) { + return new NativePanZoomController(target, view, dispatcher); + } else { + return new JavaPanZoomController(target, view, dispatcher); + } } }