summaryrefslogtreecommitdiff
path: root/gfx/layers
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-12-27 06:58:56 +0000
committerMoonchild <moonchild@palemoon.org>2020-12-27 06:58:56 +0000
commit8d4456c797eea9236f4d84cdb23d85ce670152dc (patch)
tree5328170540665a789e1d857957e433f253849f8b /gfx/layers
parentae2a160348562dfa5361f1e68226365b240c9597 (diff)
downloaduxp-8d4456c797eea9236f4d84cdb23d85ce670152dc.tar.gz
Issue #1053 - Part 3a: Remove Android conditionals from /gfx
Diffstat (limited to 'gfx/layers')
-rw-r--r--gfx/layers/Compositor.cpp11
-rw-r--r--gfx/layers/GLImages.cpp16
-rw-r--r--gfx/layers/GLImages.h28
-rw-r--r--gfx/layers/ImageContainer.h7
-rw-r--r--gfx/layers/LayersLogging.cpp11
-rw-r--r--gfx/layers/apz/src/AndroidAPZ.cpp273
-rw-r--r--gfx/layers/apz/src/AndroidAPZ.h60
-rw-r--r--gfx/layers/apz/src/AsyncPanZoomController.cpp14
-rw-r--r--gfx/layers/apz/util/APZCCallbackHelper.cpp13
-rw-r--r--gfx/layers/apz/util/APZEventState.cpp7
-rw-r--r--gfx/layers/apz/util/APZThreadUtils.cpp17
-rw-r--r--gfx/layers/basic/BasicPaintedLayer.cpp2
-rw-r--r--gfx/layers/client/ClientLayerManager.cpp6
-rw-r--r--gfx/layers/client/ClientTiledPaintedLayer.cpp5
-rw-r--r--gfx/layers/client/ImageClient.cpp7
-rw-r--r--gfx/layers/client/TiledContentClient.cpp14
-rw-r--r--gfx/layers/composite/AsyncCompositionManager.cpp115
-rw-r--r--gfx/layers/composite/AsyncCompositionManager.h8
-rw-r--r--gfx/layers/composite/CanvasLayerComposite.cpp13
-rw-r--r--gfx/layers/composite/LayerManagerComposite.cpp235
-rw-r--r--gfx/layers/composite/LayerManagerComposite.h3
-rw-r--r--gfx/layers/ipc/CompositorBridgeParent.cpp15
-rw-r--r--gfx/layers/ipc/RemoteContentController.cpp10
-rw-r--r--gfx/layers/moz.build5
-rw-r--r--gfx/layers/opengl/CompositorOGL.cpp25
-rw-r--r--gfx/layers/opengl/TextureClientOGL.cpp59
-rw-r--r--gfx/layers/opengl/TextureClientOGL.h35
-rw-r--r--gfx/layers/opengl/TextureHostOGL.cpp181
-rw-r--r--gfx/layers/opengl/TextureHostOGL.h97
29 files changed, 21 insertions, 1271 deletions
diff --git a/gfx/layers/Compositor.cpp b/gfx/layers/Compositor.cpp
index b623b8de92..e091975bf7 100644
--- a/gfx/layers/Compositor.cpp
+++ b/gfx/layers/Compositor.cpp
@@ -28,15 +28,8 @@ Compositor::Compositor(widget::CompositorWidget* aWidget,
, mScreenRotation(ROTATION_0)
, mWidget(aWidget)
, mIsDestroyed(false)
-#if defined(MOZ_WIDGET_ANDROID)
- // If the default color isn't white for Fennec, there is a black
- // flash before the first page of a tab is loaded.
- , mClearColor(1.0, 1.0, 1.0, 1.0)
- , mDefaultClearColor(1.0, 1.0, 1.0, 1.0)
-#else
, mClearColor(0.0, 0.0, 0.0, 0.0)
, mDefaultClearColor(0.0, 0.0, 0.0, 0.0)
-#endif
{
}
@@ -173,11 +166,7 @@ Compositor::DrawDiagnosticsInternal(DiagnosticFlags aFlags,
const gfx::Matrix4x4& aTransform,
uint32_t aFlashCounter)
{
-#if defined(ANDROID)
- int lWidth = 10;
-#else
int lWidth = 2;
-#endif
gfx::Color color;
if (aFlags & DiagnosticFlags::CONTENT) {
diff --git a/gfx/layers/GLImages.cpp b/gfx/layers/GLImages.cpp
index c151d991b2..008067df7b 100644
--- a/gfx/layers/GLImages.cpp
+++ b/gfx/layers/GLImages.cpp
@@ -1,3 +1,7 @@
+/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "GLImages.h"
#include "GLContext.h"
@@ -98,17 +102,5 @@ GLImage::GetAsSourceSurface()
return source.forget();
}
-#ifdef MOZ_WIDGET_ANDROID
-SurfaceTextureImage::SurfaceTextureImage(gl::AndroidSurfaceTexture* aSurfTex,
- const gfx::IntSize& aSize,
- gl::OriginPos aOriginPos)
- : GLImage(ImageFormat::SURFACE_TEXTURE),
- mSurfaceTexture(aSurfTex),
- mSize(aSize),
- mOriginPos(aOriginPos)
-{
-}
-#endif
-
} // namespace layers
} // namespace mozilla
diff --git a/gfx/layers/GLImages.h b/gfx/layers/GLImages.h
index 3e419d4b60..16e31e0538 100644
--- a/gfx/layers/GLImages.h
+++ b/gfx/layers/GLImages.h
@@ -60,34 +60,6 @@ private:
bool mOwns;
};
-#ifdef MOZ_WIDGET_ANDROID
-
-class SurfaceTextureImage : public GLImage {
-public:
- SurfaceTextureImage(gl::AndroidSurfaceTexture* aSurfTex,
- const gfx::IntSize& aSize,
- gl::OriginPos aOriginPos);
-
- gfx::IntSize GetSize() override { return mSize; }
- gl::AndroidSurfaceTexture* GetSurfaceTexture() const {
- return mSurfaceTexture;
- }
- gl::OriginPos GetOriginPos() const {
- return mOriginPos;
- }
-
- SurfaceTextureImage* AsSurfaceTextureImage() override {
- return this;
- }
-
-private:
- RefPtr<gl::AndroidSurfaceTexture> mSurfaceTexture;
- gfx::IntSize mSize;
- gl::OriginPos mOriginPos;
-};
-
-#endif // MOZ_WIDGET_ANDROID
-
} // namespace layers
} // namespace mozilla
diff --git a/gfx/layers/ImageContainer.h b/gfx/layers/ImageContainer.h
index a2f404e179..73085ba906 100644
--- a/gfx/layers/ImageContainer.h
+++ b/gfx/layers/ImageContainer.h
@@ -166,9 +166,7 @@ protected:
class GLImage;
class EGLImageImage;
class SharedRGBImage;
-#ifdef MOZ_WIDGET_ANDROID
-class SurfaceTextureImage;
-#elif defined(XP_MACOSX)
+#if defined(XP_MACOSX)
class MacIOSurfaceImage;
#endif
@@ -225,9 +223,6 @@ public:
/* Access to derived classes. */
virtual EGLImageImage* AsEGLImageImage() { return nullptr; }
virtual GLImage* AsGLImage() { return nullptr; }
-#ifdef MOZ_WIDGET_ANDROID
- virtual SurfaceTextureImage* AsSurfaceTextureImage() { return nullptr; }
-#endif
#ifdef XP_MACOSX
virtual MacIOSurfaceImage* AsMacIOSurfaceImage() { return nullptr; }
#endif
diff --git a/gfx/layers/LayersLogging.cpp b/gfx/layers/LayersLogging.cpp
index 3d11643603..bf3a139579 100644
--- a/gfx/layers/LayersLogging.cpp
+++ b/gfx/layers/LayersLogging.cpp
@@ -396,18 +396,7 @@ AppendToString(std::stringstream& aStream, ImageFormat format,
void
print_stderr(std::stringstream& aStr)
{
-#if defined(ANDROID)
- // On Android logcat output is truncated to 1024 chars per line, and
- // we usually use std::stringstream to build up giant multi-line gobs
- // of output. So to avoid the truncation we find the newlines and
- // print the lines individually.
- std::string line;
- while (std::getline(aStr, line)) {
- printf_stderr("%s\n", line.c_str());
- }
-#else
printf_stderr("%s", aStr.str().c_str());
-#endif
}
void
diff --git a/gfx/layers/apz/src/AndroidAPZ.cpp b/gfx/layers/apz/src/AndroidAPZ.cpp
deleted file mode 100644
index 3a2baff86a..0000000000
--- a/gfx/layers/apz/src/AndroidAPZ.cpp
+++ /dev/null
@@ -1,273 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "AndroidAPZ.h"
-
-#include "AsyncPanZoomController.h"
-#include "GeneratedJNIWrappers.h"
-#include "gfxPrefs.h"
-#include "OverscrollHandoffState.h"
-#include "ViewConfiguration.h"
-
-#define ANDROID_APZ_LOG(...)
-// #define ANDROID_APZ_LOG(...) printf_stderr("ANDROID_APZ: " __VA_ARGS__)
-
-static float sMaxFlingSpeed = 0.0f;
-
-namespace mozilla {
-namespace layers {
-
-AndroidSpecificState::AndroidSpecificState() {
- using namespace mozilla::java;
-
- sdk::ViewConfiguration::LocalRef config;
- if (sdk::ViewConfiguration::Get(GeckoAppShell::GetApplicationContext(), &config) == NS_OK) {
- int32_t speed = 0;
- if (config->GetScaledMaximumFlingVelocity(&speed) == NS_OK) {
- sMaxFlingSpeed = (float)speed * 0.001f;
- } else {
- ANDROID_APZ_LOG("%p Failed to query ViewConfiguration for scaled maximum fling velocity\n", this);
- }
- } else {
- ANDROID_APZ_LOG("%p Failed to get ViewConfiguration\n", this);
- }
-
- StackScroller::LocalRef scroller;
- if (StackScroller::New(GeckoAppShell::GetApplicationContext(), &scroller) != NS_OK) {
- ANDROID_APZ_LOG("%p Failed to create Android StackScroller\n", this);
- return;
- }
- mOverScroller = scroller;
-}
-
-const float BOUNDS_EPSILON = 1.0f;
-
-// This function is used to convert the scroll offset from a float to an integer
-// suitable for using with the Android OverScroller Class.
-// The Android OverScroller class (unfortunately) operates in integers instead of floats.
-// When casting a float value such as 1.5 to an integer, the value is converted to 1.
-// If this value represents the max scroll offset, the OverScroller class will never scroll
-// to the end of the page as it will always be 0.5 pixels short. To work around this issue,
-// the min and max scroll extents are floor/ceil to convert them to the nearest integer
-// just outside of the actual scroll extents. This means, the starting
-// scroll offset must be converted the same way so that if the frame has already been
-// scrolled 1.5 pixels, it won't be snapped back when converted to an integer. This integer
-// rounding error was one of several causes of Bug 1276463.
-static int32_t
-ClampStart(float aOrigin, float aMin, float aMax)
-{
- if (aOrigin <= aMin) {
- return (int32_t)floor(aMin);
- } else if (aOrigin >= aMax) {
- return (int32_t)ceil(aMax);
- }
- return (int32_t)aOrigin;
-}
-
-AndroidFlingAnimation::AndroidFlingAnimation(AsyncPanZoomController& aApzc,
- PlatformSpecificStateBase* aPlatformSpecificState,
- const RefPtr<const OverscrollHandoffChain>& aOverscrollHandoffChain,
- bool aFlingIsHandoff,
- const RefPtr<const AsyncPanZoomController>& aScrolledApzc)
- : mApzc(aApzc)
- , mOverscrollHandoffChain(aOverscrollHandoffChain)
- , mScrolledApzc(aScrolledApzc)
- , mSentBounceX(false)
- , mSentBounceY(false)
- , mFlingDuration(0)
-{
- MOZ_ASSERT(mOverscrollHandoffChain);
- AndroidSpecificState* state = aPlatformSpecificState->AsAndroidSpecificState();
- MOZ_ASSERT(state);
- mOverScroller = state->mOverScroller;
- MOZ_ASSERT(mOverScroller);
-
- // Drop any velocity on axes where we don't have room to scroll anyways
- // (in this APZC, or an APZC further in the handoff chain).
- // This ensures that we don't take the 'overscroll' path in Sample()
- // on account of one axis which can't scroll having a velocity.
- if (!mOverscrollHandoffChain->CanScrollInDirection(&mApzc, Layer::HORIZONTAL)) {
- ReentrantMonitorAutoEnter lock(mApzc.mMonitor);
- mApzc.mX.SetVelocity(0);
- }
- if (!mOverscrollHandoffChain->CanScrollInDirection(&mApzc, Layer::VERTICAL)) {
- ReentrantMonitorAutoEnter lock(mApzc.mMonitor);
- mApzc.mY.SetVelocity(0);
- }
-
- ParentLayerPoint velocity = mApzc.GetVelocityVector();
-
- float scrollRangeStartX = mApzc.mX.GetPageStart().value;
- float scrollRangeEndX = mApzc.mX.GetScrollRangeEnd().value;
- float scrollRangeStartY = mApzc.mY.GetPageStart().value;
- float scrollRangeEndY = mApzc.mY.GetScrollRangeEnd().value;
- mStartOffset.x = mPreviousOffset.x = mApzc.mX.GetOrigin().value;
- mStartOffset.y = mPreviousOffset.y = mApzc.mY.GetOrigin().value;
- float length = velocity.Length();
- if (length > 0.0f) {
- mFlingDirection = velocity / length;
-
- if ((sMaxFlingSpeed > 0.0f) && (length > sMaxFlingSpeed)) {
- velocity = mFlingDirection * sMaxFlingSpeed;
- }
- }
-
- mPreviousVelocity = velocity;
-
- int32_t originX = ClampStart(mStartOffset.x, scrollRangeStartX, scrollRangeEndX);
- int32_t originY = ClampStart(mStartOffset.y, scrollRangeStartY, scrollRangeEndY);
- if (!state->mLastFling.IsNull()) {
- // If it's been too long since the previous fling, or if the new fling's
- // velocity is too low, don't allow flywheel to kick in. If we do allow
- // flywheel to kick in, then we need to update the timestamp on the
- // StackScroller because otherwise it might use a stale velocity.
- TimeDuration flingDuration = TimeStamp::Now() - state->mLastFling;
- if (flingDuration.ToMilliseconds() < gfxPrefs::APZFlingAccelInterval()
- && velocity.Length() >= gfxPrefs::APZFlingAccelMinVelocity()) {
- bool unused = false;
- mOverScroller->ComputeScrollOffset(flingDuration.ToMilliseconds(), &unused);
- } else {
- mOverScroller->ForceFinished(true);
- }
- }
- mOverScroller->Fling(originX, originY,
- // Android needs the velocity in pixels per second and it is in pixels per ms.
- (int32_t)(velocity.x * 1000.0f), (int32_t)(velocity.y * 1000.0f),
- (int32_t)floor(scrollRangeStartX), (int32_t)ceil(scrollRangeEndX),
- (int32_t)floor(scrollRangeStartY), (int32_t)ceil(scrollRangeEndY),
- 0, 0, 0);
- state->mLastFling = TimeStamp::Now();
-}
-
-/**
- * Advances a fling by an interpolated amount based on the Android OverScroller.
- * This should be called whenever sampling the content transform for this
- * frame. Returns true if the fling animation should be advanced by one frame,
- * or false if there is no fling or the fling has ended.
- */
-bool
-AndroidFlingAnimation::DoSample(FrameMetrics& aFrameMetrics,
- const TimeDuration& aDelta)
-{
- bool shouldContinueFling = true;
-
- mFlingDuration += aDelta.ToMilliseconds();
- mOverScroller->ComputeScrollOffset(mFlingDuration, &shouldContinueFling);
-
- int32_t currentX = 0;
- int32_t currentY = 0;
- mOverScroller->GetCurrX(&currentX);
- mOverScroller->GetCurrY(&currentY);
- ParentLayerPoint offset((float)currentX, (float)currentY);
- ParentLayerPoint preCheckedOffset(offset);
-
- bool hitBoundX = CheckBounds(mApzc.mX, offset.x, mFlingDirection.x, &(offset.x));
- bool hitBoundY = CheckBounds(mApzc.mY, offset.y, mFlingDirection.y, &(offset.y));
-
- ParentLayerPoint velocity = mPreviousVelocity;
-
- // Sometimes the OverScroller fails to update the offset for a frame.
- // If the frame can still scroll we just use the velocity from the previous
- // frame. However, if the frame can no longer scroll in the direction
- // of the fling, then end the animation.
- if (offset != mPreviousOffset) {
- if (aDelta.ToMilliseconds() > 0) {
- mOverScroller->GetCurrSpeedX(&velocity.x);
- mOverScroller->GetCurrSpeedY(&velocity.y);
-
- velocity.x /= 1000;
- velocity.y /= 1000;
-
- mPreviousVelocity = velocity;
- }
- } else if ((fabsf(offset.x - preCheckedOffset.x) > BOUNDS_EPSILON) || (fabsf(offset.y - preCheckedOffset.y) > BOUNDS_EPSILON)) {
- // The page is no longer scrolling but the fling animation is still animating beyond the page bounds. If it goes
- // beyond the BOUNDS_EPSILON then it has overflowed and will never stop. In that case, stop the fling animation.
- shouldContinueFling = false;
- } else if (hitBoundX && hitBoundY) {
- // We can't scroll any farther along either axis.
- shouldContinueFling = false;
- }
-
- float speed = velocity.Length();
-
- // gfxPrefs::APZFlingStoppedThreshold is only used in tests.
- if (!shouldContinueFling || (speed < gfxPrefs::APZFlingStoppedThreshold())) {
- if (shouldContinueFling) {
- // The OverScroller thinks it should continue but the speed is below
- // the stopping threshold so abort the animation.
- mOverScroller->AbortAnimation();
- }
- // This animation is going to end. If DeferHandleFlingOverscroll
- // has not been called and there is still some velocity left,
- // call it so that fling hand off may occur if applicable.
- if (!mSentBounceX && !mSentBounceY && (speed > 0.0f)) {
- DeferHandleFlingOverscroll(velocity);
- }
- return false;
- }
-
- mPreviousOffset = offset;
-
- mApzc.SetVelocityVector(velocity);
- aFrameMetrics.SetScrollOffset(offset / aFrameMetrics.GetZoom());
-
- // If we hit a bounds while flinging, send the velocity so that the bounce
- // animation can play.
- if (hitBoundX || hitBoundY) {
- ParentLayerPoint bounceVelocity = velocity;
-
- if (!mSentBounceX && hitBoundX && fabsf(offset.x - mStartOffset.x) > BOUNDS_EPSILON) {
- mSentBounceX = true;
- } else {
- bounceVelocity.x = 0.0f;
- }
-
- if (!mSentBounceY && hitBoundY && fabsf(offset.y - mStartOffset.y) > BOUNDS_EPSILON) {
- mSentBounceY = true;
- } else {
- bounceVelocity.y = 0.0f;
- }
- if (!IsZero(bounceVelocity)) {
- DeferHandleFlingOverscroll(bounceVelocity);
- }
- }
-
- return true;
-}
-
-void
-AndroidFlingAnimation::DeferHandleFlingOverscroll(ParentLayerPoint& aVelocity)
-{
- mDeferredTasks.AppendElement(
- NewRunnableMethod<ParentLayerPoint,
- RefPtr<const OverscrollHandoffChain>,
- RefPtr<const AsyncPanZoomController>>(&mApzc,
- &AsyncPanZoomController::HandleFlingOverscroll,
- aVelocity,
- mOverscrollHandoffChain,
- mScrolledApzc));
-
-}
-
-bool
-AndroidFlingAnimation::CheckBounds(Axis& aAxis, float aValue, float aDirection, float* aClamped)
-{
- if ((aDirection < 0.0f) && (aValue <= aAxis.GetPageStart().value)) {
- if (aClamped) {
- *aClamped = aAxis.GetPageStart().value;
- }
- return true;
- } else if ((aDirection > 0.0f) && (aValue >= aAxis.GetScrollRangeEnd().value)) {
- if (aClamped) {
- *aClamped = aAxis.GetScrollRangeEnd().value;
- }
- return true;
- }
- return false;
-}
-
-} // namespace layers
-} // namespace mozilla
diff --git a/gfx/layers/apz/src/AndroidAPZ.h b/gfx/layers/apz/src/AndroidAPZ.h
deleted file mode 100644
index 248f2fbe7e..0000000000
--- a/gfx/layers/apz/src/AndroidAPZ.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_layers_AndroidAPZ_h_
-#define mozilla_layers_AndroidAPZ_h_
-
-#include "AsyncPanZoomAnimation.h"
-#include "AsyncPanZoomController.h"
-#include "GeneratedJNIWrappers.h"
-
-namespace mozilla {
-namespace layers {
-
-class AndroidSpecificState : public PlatformSpecificStateBase {
-public:
- AndroidSpecificState();
-
- virtual AndroidSpecificState* AsAndroidSpecificState() override {
- return this;
- }
-
- java::StackScroller::GlobalRef mOverScroller;
- TimeStamp mLastFling;
-};
-
-class AndroidFlingAnimation: public AsyncPanZoomAnimation {
-public:
- AndroidFlingAnimation(AsyncPanZoomController& aApzc,
- PlatformSpecificStateBase* aPlatformSpecificState,
- const RefPtr<const OverscrollHandoffChain>& aOverscrollHandoffChain,
- bool aFlingIsHandoff /* ignored */,
- const RefPtr<const AsyncPanZoomController>& aScrolledApzc);
- virtual bool DoSample(FrameMetrics& aFrameMetrics,
- const TimeDuration& aDelta) override;
-private:
- void DeferHandleFlingOverscroll(ParentLayerPoint& aVelocity);
- // Returns true if value is on or outside of axis bounds.
- bool CheckBounds(Axis& aAxis, float aValue, float aDirection, float* aClamped);
-
- AsyncPanZoomController& mApzc;
- java::StackScroller::GlobalRef mOverScroller;
- RefPtr<const OverscrollHandoffChain> mOverscrollHandoffChain;
- RefPtr<const AsyncPanZoomController> mScrolledApzc;
- bool mSentBounceX;
- bool mSentBounceY;
- long mFlingDuration;
- ParentLayerPoint mStartOffset;
- ParentLayerPoint mPreviousOffset;
- // Unit vector in the direction of the fling.
- ParentLayerPoint mFlingDirection;
- ParentLayerPoint mPreviousVelocity;
-};
-
-
-} // namespace layers
-} // namespace mozilla
-
-#endif // mozilla_layers_AndroidAPZ_h_
diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp
index 772590356a..4808daf49c 100644
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -75,9 +75,6 @@
#include "SharedMemoryBasic.h" // for SharedMemoryBasic
#include "ScrollSnap.h" // for ScrollSnapUtils
#include "WheelScrollAnimation.h"
-#if defined(MOZ_WIDGET_ANDROID)
-#include "AndroidAPZ.h"
-#endif // defined(MOZ_WIDGET_ANDROID)
#define ENABLE_APZC_LOGGING 0
// #define ENABLE_APZC_LOGGING 1
@@ -110,16 +107,10 @@ using mozilla::gfx::PointTyped;
using mozilla::gfx::RectTyped;
using mozilla::gfx::ScaleFactors2D;
-// Choose between platform-specific implementations.
-#ifdef MOZ_WIDGET_ANDROID
-typedef WidgetOverscrollEffect OverscrollEffect;
-typedef AndroidSpecificState PlatformSpecificState;
-typedef AndroidFlingAnimation FlingAnimation;
-#else
+// Platform-specific implementations.
typedef GenericOverscrollEffect OverscrollEffect;
typedef PlatformSpecificStateBase PlatformSpecificState; // no extra state, just use the base class
typedef GenericFlingAnimation FlingAnimation;
-#endif
/**
* \page APZCPrefs APZ preferences
@@ -250,7 +241,6 @@ typedef GenericFlingAnimation FlingAnimation;
* for a new sample, v(t0) is the velocity at the previous sample, f is the
* value of this pref, and (t1 - t0) is the amount of time, in milliseconds,
* that has elapsed between the two samples.\n
- * NOTE: Not currently used in Android fling calculations.
*
* \li\b apz.fling_min_velocity_threshold
* Minimum velocity for a fling to actually kick off. If the user pans and lifts
@@ -271,8 +261,6 @@ typedef GenericFlingAnimation FlingAnimation;
* animation completely. This is to prevent asymptotically approaching 0
* velocity and rerendering unnecessarily.\n
* Units: screen pixels per millisecond.\n
- * NOTE: Should not be set to anything
- * other than 0.0 for Android except for tests to disable flings.
*
* \li\b apz.max_velocity_inches_per_ms
* Maximum velocity. Velocity will be capped at this value if a faster fling
diff --git a/gfx/layers/apz/util/APZCCallbackHelper.cpp b/gfx/layers/apz/util/APZCCallbackHelper.cpp
index 3f33a59e43..2fda14719b 100644
--- a/gfx/layers/apz/util/APZCCallbackHelper.cpp
+++ b/gfx/layers/apz/util/APZCCallbackHelper.cpp
@@ -580,18 +580,7 @@ GetRootDocumentElementFor(nsIWidget* aWidget)
static nsIFrame*
UpdateRootFrameForTouchTargetDocument(nsIFrame* aRootFrame)
{
-#if defined(MOZ_WIDGET_ANDROID)
- // Re-target so that the hit test is performed relative to the frame for the
- // Root Content Document instead of the Root Document which are different in
- // Android. See bug 1229752 comment 16 for an explanation of why this is necessary.
- if (nsIDocument* doc = aRootFrame->PresContext()->PresShell()->GetTouchEventTargetDocument()) {
- if (nsIPresShell* shell = doc->GetShell()) {
- if (nsIFrame* frame = shell->GetRootFrame()) {
- return frame;
- }
- }
- }
-#endif
+ // No retargeting needed on desktop.
return aRootFrame;
}
diff --git a/gfx/layers/apz/util/APZEventState.cpp b/gfx/layers/apz/util/APZEventState.cpp
index 20a41eed5a..00a18d7b26 100644
--- a/gfx/layers/apz/util/APZEventState.cpp
+++ b/gfx/layers/apz/util/APZEventState.cpp
@@ -479,11 +479,8 @@ APZEventState::ProcessAPZStateChange(ViewID aViewId,
void
APZEventState::ProcessClusterHit()
{
- // If we hit a cluster of links then we shouldn't activate any of them,
- // as we will be showing the zoomed view. (This is only called on Fennec).
-#ifndef MOZ_WIDGET_ANDROID
- MOZ_ASSERT(false);
-#endif
+ // If we hit a cluster of links then we shouldn't activate any of them.
+ MOZ_ASSERT(false, "Cluster hits shouldn't happen on desktop!");
mActiveElementManager->ClearActivation();
}
diff --git a/gfx/layers/apz/util/APZThreadUtils.cpp b/gfx/layers/apz/util/APZThreadUtils.cpp
index 46f67d010f..e1975a2a06 100644
--- a/gfx/layers/apz/util/APZThreadUtils.cpp
+++ b/gfx/layers/apz/util/APZThreadUtils.cpp
@@ -6,9 +6,6 @@
#include "mozilla/layers/APZThreadUtils.h"
#include "mozilla/layers/Compositor.h"
-#ifdef MOZ_WIDGET_ANDROID
-#include "AndroidBridge.h"
-#endif
namespace mozilla {
namespace layers {
@@ -57,15 +54,6 @@ APZThreadUtils::RunOnControllerThread(already_AddRefed<Runnable> aTask)
{
RefPtr<Runnable> task = aTask;
-#ifdef MOZ_WIDGET_ANDROID
- // This is needed while nsWindow::ConfigureAPZControllerThread is not propper
- // implemented.
- if (AndroidBridge::IsJavaUiThread()) {
- task->Run();
- } else {
- AndroidBridge::Bridge()->PostTaskToUiThread(task.forget(), 0);
- }
-#else
if (!sControllerThread) {
// Could happen on startup
NS_WARNING("Dropping task posted to controller thread");
@@ -77,17 +65,12 @@ APZThreadUtils::RunOnControllerThread(already_AddRefed<Runnable> aTask)
} else {
sControllerThread->PostTask(task.forget());
}
-#endif
}
/*static*/ bool
APZThreadUtils::IsControllerThread()
{
-#ifdef MOZ_WIDGET_ANDROID
- return AndroidBridge::IsJavaUiThread();
-#else
return sControllerThread == MessageLoop::current();
-#endif
}
NS_IMPL_ISUPPORTS(GenericTimerCallbackBase, nsITimerCallback)
diff --git a/gfx/layers/basic/BasicPaintedLayer.cpp b/gfx/layers/basic/BasicPaintedLayer.cpp
index 7ce0c24af7..d2c456daa1 100644
--- a/gfx/layers/basic/BasicPaintedLayer.cpp
+++ b/gfx/layers/basic/BasicPaintedLayer.cpp
@@ -149,7 +149,6 @@ BasicPaintedLayer::Validate(LayerManager::DrawPaintedLayerCallback aCallback,
}
uint32_t flags = 0;
-#ifndef MOZ_WIDGET_ANDROID
if (BasicManager()->CompositorMightResample()) {
flags |= RotatedContentBuffer::PAINT_WILL_RESAMPLE;
}
@@ -158,7 +157,6 @@ BasicPaintedLayer::Validate(LayerManager::DrawPaintedLayerCallback aCallback,
flags |= RotatedContentBuffer::PAINT_WILL_RESAMPLE;
}
}
-#endif
if (mDrawAtomically) {
flags |= RotatedContentBuffer::PAINT_NO_ROTATION;
}
diff --git a/gfx/layers/client/ClientLayerManager.cpp b/gfx/layers/client/ClientLayerManager.cpp
index 1e4369bcee..ddca3ec3c1 100644
--- a/gfx/layers/client/ClientLayerManager.cpp
+++ b/gfx/layers/client/ClientLayerManager.cpp
@@ -31,10 +31,6 @@
#include "TiledLayerBuffer.h"
#include "mozilla/dom/WindowBinding.h" // for Overfill Callback
#include "FrameLayerBuilder.h" // for FrameLayerbuilder
-#ifdef MOZ_WIDGET_ANDROID
-#include "AndroidBridge.h"
-#include "LayerMetricsWrapper.h"
-#endif
#ifdef XP_WIN
#include "mozilla/gfx/DeviceManagerDx.h"
#endif
@@ -250,7 +246,7 @@ ClientLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
//
// Desktop does not support async zoom yet, so we ignore this for those
// platforms.
-#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_UIKIT)
+#if defined(MOZ_WIDGET_UIKIT)
if (mWidget && mWidget->GetOwningTabChild()) {
mCompositorMightResample = AsyncPanZoomEnabled();
}
diff --git a/gfx/layers/client/ClientTiledPaintedLayer.cpp b/gfx/layers/client/ClientTiledPaintedLayer.cpp
index 5a07681f6d..599fb972c4 100644
--- a/gfx/layers/client/ClientTiledPaintedLayer.cpp
+++ b/gfx/layers/client/ClientTiledPaintedLayer.cpp
@@ -150,11 +150,6 @@ ClientTiledPaintedLayer::BeginPaint()
if (!displayPortAncestor || !scrollAncestor) {
// No displayport or scroll ancestor, so we can't do progressive rendering.
-#if defined(MOZ_WIDGET_ANDROID)
- // Both Android and b2g on phones are guaranteed to have a displayport set, so this
- // should never happen.
- NS_WARNING("Tiled PaintedLayer with no scrollable container ancestor");
-#endif
return;
}
diff --git a/gfx/layers/client/ImageClient.cpp b/gfx/layers/client/ImageClient.cpp
index 1ccb69502f..e5a725c277 100644
--- a/gfx/layers/client/ImageClient.cpp
+++ b/gfx/layers/client/ImageClient.cpp
@@ -128,13 +128,6 @@ ImageClient::CreateTextureClientForImage(Image* aImage, KnowsCompositor* aForwar
EGLImageImage* typedImage = aImage->AsEGLImageImage();
texture = EGLImageTextureData::CreateTextureClient(
typedImage, size, aForwarder->GetTextureForwarder(), TextureFlags::DEFAULT);
-#ifdef MOZ_WIDGET_ANDROID
- } else if (aImage->GetFormat() == ImageFormat::SURFACE_TEXTURE) {
- SurfaceTextureImage* typedImage = aImage->AsSurfaceTextureImage();
- texture = AndroidSurfaceTextureData::CreateTextureClient(
- typedImage->GetSurfaceTexture(), size, typedImage->GetOriginPos(),
- aForwarder->GetTextureForwarder(), TextureFlags::DEFAULT);
-#endif
} else {
MOZ_ASSERT(false, "Bad ImageFormat.");
}
diff --git a/gfx/layers/client/TiledContentClient.cpp b/gfx/layers/client/TiledContentClient.cpp
index c5677a8a31..164e76da8c 100644
--- a/gfx/layers/client/TiledContentClient.cpp
+++ b/gfx/layers/client/TiledContentClient.cpp
@@ -1230,19 +1230,7 @@ ClientMultiTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& a
// Compute a "coherent update rect" that we should paint all at once in a
// single transaction. This is to avoid rendering glitches on animated
// page content, and when layers change size/shape.
- // On Fennec uploads are more expensive because we're not using gralloc, so
- // we use a coherent update rect that is intersected with the screen at the
- // time of issuing the draw command. This will paint faster but also potentially
- // make the progressive paint more visible to the user while scrolling.
- // On B2G uploads are cheaper and we value coherency more, especially outside
- // the browser, so we always use the entire user-visible area.
- IntRect coherentUpdateRect(RoundedOut(
-#ifdef MOZ_WIDGET_ANDROID
- transformedCompositionBounds->Intersect(aPaintData->mCompositionBounds)
-#else
- *transformedCompositionBounds
-#endif
- ).ToUnknownRect());
+ IntRect coherentUpdateRect(RoundedOut(*transformedCompositionBounds).ToUnknownRect());
TILING_LOG("TILING %p: Progressive update final coherency rect %s\n", &mPaintedLayer, Stringify(coherentUpdateRect).c_str());
diff --git a/gfx/layers/composite/AsyncCompositionManager.cpp b/gfx/layers/composite/AsyncCompositionManager.cpp
index cb6b23b0ca..e1938392f6 100644
--- a/gfx/layers/composite/AsyncCompositionManager.cpp
+++ b/gfx/layers/composite/AsyncCompositionManager.cpp
@@ -38,10 +38,6 @@
#include "nsTArrayForwardDeclare.h" // for InfallibleTArray
#include "UnitTransforms.h" // for TransformTo
#include "gfxPrefs.h"
-#if defined(MOZ_WIDGET_ANDROID)
-# include <android/log.h>
-# include "mozilla/widget/AndroidCompositorWidget.h"
-#endif
#include "GeckoProfiler.h"
#include "FrameUniformityData.h"
#include "TreeTraversal.h" // for ForEachNode, BreadthFirstSearch
@@ -825,11 +821,7 @@ ExpandRootClipRect(Layer* aLayer, const ScreenMargin& aFixedLayerMargins)
// clear the clip rect on aLayer entirely but this seems more precise.
Maybe<ParentLayerIntRect> rootClipRect = aLayer->AsLayerComposite()->GetShadowClipRect();
if (rootClipRect && aFixedLayerMargins != ScreenMargin()) {
-#ifndef MOZ_WIDGET_ANDROID
- // We should never enter here on anything other than Fennec, since
- // aFixedLayerMargins should be empty everywhere else.
- MOZ_ASSERT(false);
-#endif
+ MOZ_ASSERT(false, "aFixedLayerMargins should be empty!");
ParentLayerRect rect(rootClipRect.value());
rect.Deflate(ViewAs<ParentLayerPixel>(aFixedLayerMargins,
PixelCastJustification::ScreenIsParentLayerForRoot));
@@ -837,40 +829,6 @@ ExpandRootClipRect(Layer* aLayer, const ScreenMargin& aFixedLayerMargins)
}
}
-#ifdef MOZ_WIDGET_ANDROID
-static void
-MoveScrollbarForLayerMargin(Layer* aRoot, FrameMetrics::ViewID aRootScrollId,
- const ScreenMargin& aFixedLayerMargins)
-{
- // See bug 1223928 comment 9 - once we can detect the RCD with just the
- // isRootContent flag on the metrics, we can probably move this code into
- // ApplyAsyncTransformToScrollbar rather than having it as a separate
- // adjustment on the layer tree.
- Layer* scrollbar = BreadthFirstSearch<ReverseIterator>(aRoot,
- [aRootScrollId](Layer* aNode) {
- return (aNode->GetScrollbarDirection() == Layer::HORIZONTAL &&
- aNode->GetScrollbarTargetContainerId() == aRootScrollId);
- });
- if (scrollbar) {
- // Shift the horizontal scrollbar down into the new space exposed by the
- // dynamic toolbar hiding. Technically we should also scale the vertical
- // scrollbar a bit to expand into the new space but it's not as noticeable
- // and it would add a lot more complexity, so we're going with the "it's not
- // worth it" justification.
- TranslateShadowLayer(scrollbar, ParentLayerPoint(0, -aFixedLayerMargins.bottom), true, nullptr);
- if (scrollbar->GetParent()) {
- // The layer that has the HORIZONTAL direction sits inside another
- // ContainerLayer. This ContainerLayer also has a clip rect that causes
- // the scrollbar to get clipped. We need to expand that clip rect to
- // prevent that from happening. This is kind of ugly in that we're
- // assuming a particular layer tree structure but short of adding more
- // flags to the layer there doesn't appear to be a good way to do this.
- ExpandRootClipRect(scrollbar->GetParent(), aFixedLayerMargins);
- }
- }
-}
-#endif
-
bool
AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer,
bool* aOutFoundRoot)
@@ -974,50 +932,9 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer,
const ScrollMetadata& scrollMetadata = layer->GetScrollMetadata(i);
const FrameMetrics& metrics = scrollMetadata.GetMetrics();
-#if defined(MOZ_WIDGET_ANDROID)
- // If we find a metrics which is the root content doc, use that. If not, use
- // the root layer. Since this function recurses on children first we should
- // only end up using the root layer if the entire tree was devoid of a
- // root content metrics. This is a temporary solution; in the long term we
- // should not need the root content metrics at all. See bug 1201529 comment
- // 6 for details.
- if (!(*aOutFoundRoot)) {
- *aOutFoundRoot = metrics.IsRootContent() || /* RCD */
- (layer->GetParent() == nullptr && /* rootmost metrics */
- i + 1 >= layer->GetScrollMetadataCount());
- if (*aOutFoundRoot) {
- mRootScrollableId = metrics.GetScrollId();
- CSSToLayerScale geckoZoom = metrics.LayersPixelsPerCSSPixel().ToScaleFactor();
- if (mIsFirstPaint) {
- LayerIntPoint scrollOffsetLayerPixels = RoundedToInt(metrics.GetScrollOffset() * geckoZoom);
- mContentRect = metrics.GetScrollableRect();
- SetFirstPaintViewport(scrollOffsetLayerPixels,
- geckoZoom,
- mContentRect);
- } else {
- ParentLayerPoint scrollOffset = controller->GetCurrentAsyncScrollOffset(
- AsyncPanZoomController::RESPECT_FORCE_DISABLE);
- // Compute the painted displayport in document-relative CSS pixels.
- CSSRect displayPort(metrics.GetCriticalDisplayPort().IsEmpty() ?
- metrics.GetDisplayPort() :
- metrics.GetCriticalDisplayPort());
- displayPort += metrics.GetScrollOffset();
- SyncFrameMetrics(scrollOffset,
- geckoZoom * asyncTransformWithoutOverscroll.mScale,
- metrics.GetScrollableRect(), displayPort, geckoZoom, mLayersUpdated,
- mPaintSyncId, fixedLayerMargins);
- mFixedLayerMargins = fixedLayerMargins;
- mLayersUpdated = false;
- mPaintSyncId = 0;
- }
- mIsFirstPaint = false;
- }
- }
-#else
- // Non-Android platforms still care about this flag being cleared after
+ // We still care about this flag being cleared after
// the first call to TransformShadowTree().
mIsFirstPaint = false;
-#endif
// Transform the current local clips by this APZC's async transform. If we're
// using containerful scrolling, then the clip is not part of the scrolled
@@ -1420,12 +1337,8 @@ AsyncCompositionManager::TransformShadowTree(TimeStamp aCurrentFrame,
// in Gecko and partially in Java.
bool foundRoot = false;
if (ApplyAsyncContentTransformToTree(root, &foundRoot)) {
-#if defined(MOZ_WIDGET_ANDROID)
- MOZ_ASSERT(foundRoot);
- if (foundRoot && mFixedLayerMargins != ScreenMargin()) {
- MoveScrollbarForLayerMargin(root, mRootScrollableId, mFixedLayerMargins);
- }
-#endif
+ // Fixed margin considerations should go here, but we never encounter
+ // those outside of mobile.
}
// Advance APZ animations to the next expected vsync timestamp, if we can
@@ -1458,14 +1371,7 @@ AsyncCompositionManager::SetFirstPaintViewport(const LayerIntPoint& aOffset,
const CSSToLayerScale& aZoom,
const CSSRect& aCssPageRect)
{
-#ifdef MOZ_WIDGET_ANDROID
- widget::AndroidCompositorWidget* widget =
- mLayerManager->GetCompositor()->GetWidget()->AsAndroid();
- if (!widget) {
- return;
- }
- widget->SetFirstPaintViewport(aOffset, aZoom, aCssPageRect);
-#endif
+ // ** STUB **
}
void
@@ -1478,16 +1384,7 @@ AsyncCompositionManager::SyncFrameMetrics(const ParentLayerPoint& aScrollOffset,
int32_t aPaintSyncId,
ScreenMargin& aFixedLayerMargins)
{
-#ifdef MOZ_WIDGET_ANDROID
- widget::AndroidCompositorWidget* widget =
- mLayerManager->GetCompositor()->GetWidget()->AsAndroid();
- if (!widget) {
- return;
- }
- widget->SyncFrameMetrics(
- aScrollOffset, aZoom, aCssPageRect, aDisplayPort, aPaintedResolution,
- aLayersUpdated, aPaintSyncId, aFixedLayerMargins);
-#endif
+ // ** STUB **
}
} // namespace layers
diff --git a/gfx/layers/composite/AsyncCompositionManager.h b/gfx/layers/composite/AsyncCompositionManager.h
index 4ec49b1a93..98aaa964e7 100644
--- a/gfx/layers/composite/AsyncCompositionManager.h
+++ b/gfx/layers/composite/AsyncCompositionManager.h
@@ -238,14 +238,6 @@ private:
LayerTransformRecorder mLayerTransformRecorder;
TimeStamp mPreviousFrameTimeStamp;
-
-#ifdef MOZ_WIDGET_ANDROID
- // The following two fields are only needed on Fennec with C++ APZ, because
- // then we need to reposition the gecko scrollbar to deal with the
- // dynamic toolbar shifting content around.
- FrameMetrics::ViewID mRootScrollableId;
- ScreenMargin mFixedLayerMargins;
-#endif
};
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(AsyncCompositionManager::TransformsToSkip)
diff --git a/gfx/layers/composite/CanvasLayerComposite.cpp b/gfx/layers/composite/CanvasLayerComposite.cpp
index 86f25b1ee1..5ccbeeab9b 100644
--- a/gfx/layers/composite/CanvasLayerComposite.cpp
+++ b/gfx/layers/composite/CanvasLayerComposite.cpp
@@ -133,18 +133,7 @@ CanvasLayerComposite::CleanupResources()
gfx::SamplingFilter
CanvasLayerComposite::GetSamplingFilter()
{
- gfx::SamplingFilter filter = mSamplingFilter;
-#ifdef ANDROID
- // Bug 691354
- // Using the LINEAR filter we get unexplained artifacts.
- // Use NEAREST when no scaling is required.
- Matrix matrix;
- bool is2D = GetEffectiveTransform().Is2D(&matrix);
- if (is2D && !ThebesMatrix(matrix).HasNonTranslationOrFlip()) {
- filter = SamplingFilter::POINT;
- }
-#endif
- return filter;
+ return mSamplingFilter;
}
void
diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp
index 800478d559..0ee11bdfb1 100644
--- a/gfx/layers/composite/LayerManagerComposite.cpp
+++ b/gfx/layers/composite/LayerManagerComposite.cpp
@@ -54,16 +54,6 @@
#include "nsPoint.h" // for nsIntPoint
#include "nsRect.h" // for mozilla::gfx::IntRect
#include "nsRegion.h" // for nsIntRegion, etc
-#ifdef MOZ_WIDGET_ANDROID
-#include <android/log.h>
-#include <android/native_window.h>
-#endif
-#if defined(MOZ_WIDGET_ANDROID)
-#include "opengl/CompositorOGL.h"
-#include "GLContextEGL.h"
-#include "GLContextProvider.h"
-#include "ScopedGLHelpers.h"
-#endif
#include "GeckoProfiler.h"
#include "TextRenderer.h" // for TextRenderer
#include "mozilla/layers/CompositorBridgeParent.h"
@@ -490,9 +480,6 @@ LayerManagerComposite::UpdateAndRender()
}
Render(invalid, opaque);
-#if defined(MOZ_WIDGET_ANDROID)
- RenderToPresentationSurface();
-#endif
mGeometryChanged = false;
mWindowOverlayChanged = false;
@@ -618,42 +605,6 @@ LayerManagerComposite::RenderDebugOverlay(const IntRect& aBounds)
}
float alpha = 1;
-#ifdef ANDROID
- // Draw a translation delay warning overlay
- int width;
- int border;
- if (!mWarnTime.IsNull() && (now - mWarnTime).ToMilliseconds() < kVisualWarningDuration) {
- EffectChain effects;
-
- // Black blorder
- border = 4;
- width = 6;
- effects.mPrimaryEffect = new EffectSolidColor(gfx::Color(0, 0, 0, 1));
- mCompositor->DrawQuad(gfx::Rect(border, border, aBounds.width - 2 * border, width),
- aBounds, effects, alpha, gfx::Matrix4x4());
- mCompositor->DrawQuad(gfx::Rect(border, aBounds.height - border - width, aBounds.width - 2 * border, width),
- aBounds, effects, alpha, gfx::Matrix4x4());
- mCompositor->DrawQuad(gfx::Rect(border, border + width, width, aBounds.height - 2 * border - width * 2),
- aBounds, effects, alpha, gfx::Matrix4x4());
- mCompositor->DrawQuad(gfx::Rect(aBounds.width - border - width, border + width, width, aBounds.height - 2 * border - 2 * width),
- aBounds, effects, alpha, gfx::Matrix4x4());
-
- // Content
- border = 5;
- width = 4;
- effects.mPrimaryEffect = new EffectSolidColor(gfx::Color(1, 1.f - mWarningLevel, 0, 1));
- mCompositor->DrawQuad(gfx::Rect(border, border, aBounds.width - 2 * border, width),
- aBounds, effects, alpha, gfx::Matrix4x4());
- mCompositor->DrawQuad(gfx::Rect(border, aBounds.height - border - width, aBounds.width - 2 * border, width),
- aBounds, effects, alpha, gfx::Matrix4x4());
- mCompositor->DrawQuad(gfx::Rect(border, border + width, width, aBounds.height - 2 * border - width * 2),
- aBounds, effects, alpha, gfx::Matrix4x4());
- mCompositor->DrawQuad(gfx::Rect(aBounds.width - border - width, border + width, width, aBounds.height - 2 * border - 2 * width),
- aBounds, effects, alpha, gfx::Matrix4x4());
- SetDebugOverlayWantsNextFrame(true);
- }
-#endif
-
float fillRatio = mCompositor->GetFillRatio();
mFPS->DrawFPS(now, drawFrameColorBars ? 10 : 1, 2, unsigned(fillRatio), mCompositor);
@@ -932,8 +883,6 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion, const nsIntRegi
mozilla::widget::WidgetRenderingContext widgetContext;
#if defined(XP_MACOSX)
widgetContext.mLayerManager = this;
-#elif defined(MOZ_WIDGET_ANDROID)
- widgetContext.mCompositor = GetCompositor();
#endif
{
@@ -952,14 +901,6 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion, const nsIntRegi
CompositorBench(mCompositor, bounds);
MOZ_ASSERT(mRoot->GetOpacity() == 1);
-#if defined(MOZ_WIDGET_ANDROID)
- LayerMetricsWrapper wrapper = GetRootContentLayer();
- if (wrapper) {
- mCompositor->SetClearColor(wrapper.Metadata().GetBackgroundColor());
- } else {
- mCompositor->SetClearColorToDefault();
- }
-#endif
if (mRoot->GetClipRect()) {
clipRect = *mRoot->GetClipRect();
IntRect rect(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
@@ -1029,182 +970,6 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion, const nsIntRegi
RecordFrame();
}
-#if defined(MOZ_WIDGET_ANDROID)
-class ScopedCompositorProjMatrix {
-public:
- ScopedCompositorProjMatrix(CompositorOGL* aCompositor, const Matrix4x4& aProjMatrix):
- mCompositor(aCompositor),
- mOriginalProjMatrix(mCompositor->GetProjMatrix())
- {
- mCompositor->SetProjMatrix(aProjMatrix);
- }
-
- ~ScopedCompositorProjMatrix()
- {
- mCompositor->SetProjMatrix(mOriginalProjMatrix);
- }
-private:
- CompositorOGL* const mCompositor;
- const Matrix4x4 mOriginalProjMatrix;
-};
-
-class ScopedCompostitorSurfaceSize {
-public:
- ScopedCompostitorSurfaceSize(CompositorOGL* aCompositor, const gfx::IntSize& aSize) :
- mCompositor(aCompositor),
- mOriginalSize(mCompositor->GetDestinationSurfaceSize())
- {
- mCompositor->SetDestinationSurfaceSize(aSize);
- }
- ~ScopedCompostitorSurfaceSize()
- {
- mCompositor->SetDestinationSurfaceSize(mOriginalSize);
- }
-private:
- CompositorOGL* const mCompositor;
- const gfx::IntSize mOriginalSize;
-};
-
-class ScopedCompositorRenderOffset {
-public:
- ScopedCompositorRenderOffset(CompositorOGL* aCompositor, const ScreenPoint& aOffset) :
- mCompositor(aCompositor),
- mOriginalOffset(mCompositor->GetScreenRenderOffset())
- {
- mCompositor->SetScreenRenderOffset(aOffset);
- }
- ~ScopedCompositorRenderOffset()
- {
- mCompositor->SetScreenRenderOffset(mOriginalOffset);
- }
-private:
- CompositorOGL* const mCompositor;
- const ScreenPoint mOriginalOffset;
-};
-
-class ScopedContextSurfaceOverride {
-public:
- ScopedContextSurfaceOverride(GLContextEGL* aContext, void* aSurface) :
- mContext(aContext)
- {
- MOZ_ASSERT(aSurface);
- mContext->SetEGLSurfaceOverride(aSurface);
- mContext->MakeCurrent(true);
- }
- ~ScopedContextSurfaceOverride()
- {
- mContext->SetEGLSurfaceOverride(EGL_NO_SURFACE);
- mContext->MakeCurrent(true);
- }
-private:
- GLContextEGL* const mContext;
-};
-
-void
-LayerManagerComposite::RenderToPresentationSurface()
-{
-#ifdef MOZ_WIDGET_ANDROID
- nsIWidget* const widget = mCompositor->GetWidget()->RealWidget();
- auto window = static_cast<ANativeWindow*>(
- widget->GetNativeData(NS_PRESENTATION_WINDOW));
-
- if (!window) {
- return;
- }
-
- EGLSurface surface = widget->GetNativeData(NS_PRESENTATION_SURFACE);
-
- if (!surface) {
- //create surface;
- surface = GLContextProviderEGL::CreateEGLSurface(window);
- if (!surface) {
- return;
- }
-
- widget->SetNativeData(NS_PRESENTATION_SURFACE,
- reinterpret_cast<uintptr_t>(surface));
- }
-
- CompositorOGL* compositor = mCompositor->AsCompositorOGL();
- GLContext* gl = compositor->gl();
- GLContextEGL* egl = GLContextEGL::Cast(gl);
-
- if (!egl) {
- return;
- }
-
- const IntSize windowSize(ANativeWindow_getWidth(window),
- ANativeWindow_getHeight(window));
-
-#endif
-
- if ((windowSize.width <= 0) || (windowSize.height <= 0)) {
- return;
- }
-
- ScreenRotation rotation = compositor->GetScreenRotation();
-
- const int actualWidth = windowSize.width;
- const int actualHeight = windowSize.height;
-
- const gfx::IntSize originalSize = compositor->GetDestinationSurfaceSize();
- const nsIntRect originalRect = nsIntRect(0, 0, originalSize.width, originalSize.height);
-
- int pageWidth = originalSize.width;
- int pageHeight = originalSize.height;
- if (rotation == ROTATION_90 || rotation == ROTATION_270) {
- pageWidth = originalSize.height;
- pageHeight = originalSize.width;
- }
-
- float scale = 1.0;
-
- if ((pageWidth > actualWidth) || (pageHeight > actualHeight)) {
- const float scaleWidth = (float)actualWidth / (float)pageWidth;
- const float scaleHeight = (float)actualHeight / (float)pageHeight;
- scale = scaleWidth <= scaleHeight ? scaleWidth : scaleHeight;
- }
-
- const gfx::IntSize actualSize(actualWidth, actualHeight);
- ScopedCompostitorSurfaceSize overrideSurfaceSize(compositor, actualSize);
-
- const ScreenPoint offset((actualWidth - (int)(scale * pageWidth)) / 2, 0);
- ScopedContextSurfaceOverride overrideSurface(egl, surface);
-
- Matrix viewMatrix = ComputeTransformForRotation(originalRect,
- rotation);
- viewMatrix.Invert(); // unrotate
- viewMatrix.PostScale(scale, scale);
- viewMatrix.PostTranslate(offset.x, offset.y);
- Matrix4x4 matrix = Matrix4x4::From2D(viewMatrix);
-
- mRoot->ComputeEffectiveTransforms(matrix);
- nsIntRegion opaque;
- LayerIntRegion visible;
- PostProcessLayers(mRoot, opaque, visible, Nothing());
-
- nsIntRegion invalid;
- IntRect bounds = IntRect::Truncate(0, 0, scale * pageWidth, actualHeight);
- IntRect rect, actualBounds;
- MOZ_ASSERT(mRoot->GetOpacity() == 1);
- mCompositor->BeginFrame(invalid, nullptr, bounds, nsIntRegion(), &rect, &actualBounds);
-
- // The Java side of Fennec sets a scissor rect that accounts for
- // chrome such as the URL bar. Override that so that the entire frame buffer
- // is cleared.
- ScopedScissorRect scissorRect(egl, 0, 0, actualWidth, actualHeight);
- egl->fClearColor(0.0, 0.0, 0.0, 0.0);
- egl->fClear(LOCAL_GL_COLOR_BUFFER_BIT);
-
- const IntRect clipRect = IntRect::Truncate(0, 0, actualWidth, actualHeight);
-
- RootLayer()->Prepare(RenderTargetIntRect::FromUnknownRect(clipRect));
- RootLayer()->RenderLayer(clipRect);
-
- mCompositor->EndFrame();
-}
-#endif
-
already_AddRefed<PaintedLayerComposite>
LayerManagerComposite::CreatePaintedLayerComposite()
{
diff --git a/gfx/layers/composite/LayerManagerComposite.h b/gfx/layers/composite/LayerManagerComposite.h
index 8fe7a6b34a..ea4b203ac4 100644
--- a/gfx/layers/composite/LayerManagerComposite.h
+++ b/gfx/layers/composite/LayerManagerComposite.h
@@ -327,9 +327,6 @@ private:
* Render the current layer tree to the active target.
*/
void Render(const nsIntRegion& aInvalidRegion, const nsIntRegion& aOpaqueRegion);
-#if defined(MOZ_WIDGET_ANDROID)
- void RenderToPresentationSurface();
-#endif
/**
* We need to know our invalid region before we're ready to render.
diff --git a/gfx/layers/ipc/CompositorBridgeParent.cpp b/gfx/layers/ipc/CompositorBridgeParent.cpp
index e6bf2d991a..25ac10130d 100644
--- a/gfx/layers/ipc/CompositorBridgeParent.cpp
+++ b/gfx/layers/ipc/CompositorBridgeParent.cpp
@@ -369,16 +369,6 @@ CompositorVsyncScheduler::ScheduleComposition()
if (mAsapScheduling) {
// Used only for performance testing purposes
PostCompositeTask(TimeStamp::Now());
-#ifdef MOZ_WIDGET_ANDROID
- } else if (mNeedsComposite >= 2 && mIsObservingVsync) {
- // uh-oh, we already requested a composite at least twice so far, and a
- // composite hasn't happened yet. It is possible that the vsync observation
- // is blocked on the main thread, so let's just composite ASAP and not
- // wait for the vsync. Note that this should only ever happen on Fennec
- // because there content runs in the same process as the compositor, and so
- // content can actually block the main thread in this process.
- PostCompositeTask(TimeStamp::Now());
-#endif
} else {
SetNeedsComposite();
}
@@ -953,11 +943,6 @@ CompositorBridgeParent::ResumeComposition()
MonitorAutoLock lock(mResumeCompositionMonitor);
if (!mCompositor->Resume()) {
-#ifdef MOZ_WIDGET_ANDROID
- // We can't get a surface. This could be because the activity changed between
- // the time resume was scheduled and now.
- __android_log_print(ANDROID_LOG_INFO, "CompositorBridgeParent", "Unable to renew compositor surface; remaining in paused state");
-#endif
lock.NotifyAll();
return;
}
diff --git a/gfx/layers/ipc/RemoteContentController.cpp b/gfx/layers/ipc/RemoteContentController.cpp
index 54a08eed3d..d71476a780 100644
--- a/gfx/layers/ipc/RemoteContentController.cpp
+++ b/gfx/layers/ipc/RemoteContentController.cpp
@@ -18,9 +18,6 @@
#include "mozilla/gfx/GPUProcessManager.h"
#include "mozilla/Unused.h"
#include "Units.h"
-#ifdef MOZ_WIDGET_ANDROID
-#include "AndroidBridge.h"
-#endif
namespace mozilla {
namespace layers {
@@ -90,8 +87,7 @@ RemoteContentController::HandleTap(TapType aTapType,
if (NS_IsMainThread()) {
HandleTapOnMainThread(aTapType, aPoint, aModifiers, aGuid, aInputBlockId);
} else {
- // We don't want to get the TabParent or call TabParent::SendHandleTap() from a non-main thread (this might happen
- // on Android, where this is called from the Java UI thread)
+ // We don't want to get the TabParent or call TabParent::SendHandleTap() from a non-main thread
NS_DispatchToMainThread(NewRunnableMethod<TapType, LayoutDevicePoint, Modifiers, ScrollableLayerGuid, uint64_t>
(this, &RemoteContentController::HandleTapOnMainThread, aTapType, aPoint, aModifiers, aGuid, aInputBlockId));
}
@@ -139,12 +135,8 @@ RemoteContentController::NotifyPinchGesture(PinchGestureInput::PinchGestureType
void
RemoteContentController::PostDelayedTask(already_AddRefed<Runnable> aTask, int aDelayMs)
{
-#ifdef MOZ_WIDGET_ANDROID
- AndroidBridge::Bridge()->PostTaskToUiThread(Move(aTask), aDelayMs);
-#else
(MessageLoop::current() ? MessageLoop::current() : mCompositorThread)->
PostDelayedTask(Move(aTask), aDelayMs);
-#endif
}
bool
diff --git a/gfx/layers/moz.build b/gfx/layers/moz.build
index d67bc74d4b..f0fedf404c 100644
--- a/gfx/layers/moz.build
+++ b/gfx/layers/moz.build
@@ -228,11 +228,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
'opengl/GLManager.cpp',
]
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
- SOURCES += [
- 'apz/src/AndroidAPZ.cpp',
- ]
-
SOURCES += [
'apz/public/IAPZCTreeManager.cpp',
'apz/src/APZCTreeManager.cpp',
diff --git a/gfx/layers/opengl/CompositorOGL.cpp b/gfx/layers/opengl/CompositorOGL.cpp
index 93656d72a0..6e5a011004 100644
--- a/gfx/layers/opengl/CompositorOGL.cpp
+++ b/gfx/layers/opengl/CompositorOGL.cpp
@@ -43,10 +43,6 @@
#include "GLBlitTextureImageHelper.h"
#include "HeapCopyOfStackArray.h"
-#if MOZ_WIDGET_ANDROID
-#include "TexturePoolOGL.h"
-#endif
-
#include "GeckoProfiler.h"
namespace mozilla {
@@ -229,13 +225,6 @@ CompositorOGL::Initialize(nsCString* const out_failureReason)
mGLContext = CreateContext();
-#ifdef MOZ_WIDGET_ANDROID
- if (!mGLContext){
- *out_failureReason = "FEATURE_FAILURE_OPENGL_NO_ANDROID_CONTEXT";
- NS_RUNTIMEABORT("We need a context on Android");
- }
-#endif
-
if (!mGLContext){
*out_failureReason = "FEATURE_FAILURE_OPENGL_CREATE_CONTEXT";
return false;
@@ -673,10 +662,6 @@ CompositorOGL::BeginFrame(const nsIntRegion& aInvalidRegion,
mPixelsPerFrame = width * height;
mPixelsFilled = 0;
-#ifdef MOZ_WIDGET_ANDROID
- TexturePoolOGL::Fill(gl());
-#endif
-
// Default blend function implements "OVER"
mGLContext->fBlendFuncSeparate(LOCAL_GL_ONE, LOCAL_GL_ONE_MINUS_SRC_ALPHA,
LOCAL_GL_ONE, LOCAL_GL_ONE_MINUS_SRC_ALPHA);
@@ -1707,19 +1692,13 @@ CompositorOGL::CopyToTarget(DrawTarget* aTarget, const nsIntPoint& aTopLeft, con
void
CompositorOGL::Pause()
{
-#ifdef MOZ_WIDGET_ANDROID
- if (!gl() || gl()->IsDestroyed())
- return;
-
- // ReleaseSurface internally calls MakeCurrent.
- gl()->ReleaseSurface();
-#endif
+ // This was only used on Android
}
bool
CompositorOGL::Resume()
{
-#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_UIKIT)
+#if defined(MOZ_WIDGET_UIKIT)
if (!gl() || gl()->IsDestroyed())
return false;
diff --git a/gfx/layers/opengl/TextureClientOGL.cpp b/gfx/layers/opengl/TextureClientOGL.cpp
index 78d4e6d9c9..1e337717b2 100644
--- a/gfx/layers/opengl/TextureClientOGL.cpp
+++ b/gfx/layers/opengl/TextureClientOGL.cpp
@@ -73,64 +73,5 @@ EGLImageTextureData::Serialize(SurfaceDescriptor& aOutDescriptor)
return true;
}
-////////////////////////////////////////////////////////////////////////
-// AndroidSurface
-
-#ifdef MOZ_WIDGET_ANDROID
-
-already_AddRefed<TextureClient>
-AndroidSurfaceTextureData::CreateTextureClient(AndroidSurfaceTexture* aSurfTex,
- gfx::IntSize aSize,
- gl::OriginPos aOriginPos,
- LayersIPCChannel* aAllocator,
- TextureFlags aFlags)
-{
- MOZ_ASSERT(XRE_IsParentProcess(),
- "Can't pass an android surfaces between processes.");
-
- if (!aSurfTex || !XRE_IsParentProcess()) {
- return nullptr;
- }
-
- if (aOriginPos == gl::OriginPos::BottomLeft) {
- aFlags |= TextureFlags::ORIGIN_BOTTOM_LEFT;
- }
-
- return TextureClient::CreateWithData(
- new AndroidSurfaceTextureData(aSurfTex, aSize),
- aFlags, aAllocator
- );
-}
-
-AndroidSurfaceTextureData::AndroidSurfaceTextureData(AndroidSurfaceTexture* aSurfTex,
- gfx::IntSize aSize)
- : mSurfTex(aSurfTex)
- , mSize(aSize)
-{}
-
-AndroidSurfaceTextureData::~AndroidSurfaceTextureData()
-{}
-
-void
-AndroidSurfaceTextureData::FillInfo(TextureData::Info& aInfo) const
-{
- aInfo.size = mSize;
- aInfo.format = gfx::SurfaceFormat::UNKNOWN;
- aInfo.hasIntermediateBuffer = false;
- aInfo.hasSynchronization = false;
- aInfo.supportsMoz2D = false;
- aInfo.canExposeMappedData = false;
-}
-
-bool
-AndroidSurfaceTextureData::Serialize(SurfaceDescriptor& aOutDescriptor)
-{
- aOutDescriptor = SurfaceTextureDescriptor((uintptr_t)mSurfTex.get(),
- mSize);
- return true;
-}
-
-#endif // MOZ_WIDGET_ANDROID
-
} // namespace layers
} // namespace mozilla
diff --git a/gfx/layers/opengl/TextureClientOGL.h b/gfx/layers/opengl/TextureClientOGL.h
index 6555f138ad..57e05468a0 100644
--- a/gfx/layers/opengl/TextureClientOGL.h
+++ b/gfx/layers/opengl/TextureClientOGL.h
@@ -48,41 +48,6 @@ protected:
const gfx::IntSize mSize;
};
-#ifdef MOZ_WIDGET_ANDROID
-
-class AndroidSurfaceTextureData : public TextureData
-{
-public:
- static already_AddRefed<TextureClient>
- CreateTextureClient(gl::AndroidSurfaceTexture* aSurfTex,
- gfx::IntSize aSize,
- gl::OriginPos aOriginPos,
- LayersIPCChannel* aAllocator,
- TextureFlags aFlags);
-
- ~AndroidSurfaceTextureData();
-
- virtual void FillInfo(TextureData::Info& aInfo) const override;
-
- virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override;
-
- // Useless functions.
- virtual bool Lock(OpenMode) override { return true; }
-
- virtual void Unlock() override {}
-
- // Our data is always owned externally.
- virtual void Deallocate(LayersIPCChannel*) override {}
-
-protected:
- AndroidSurfaceTextureData(gl::AndroidSurfaceTexture* aSurfTex, gfx::IntSize aSize);
-
- const RefPtr<gl::AndroidSurfaceTexture> mSurfTex;
- const gfx::IntSize mSize;
-};
-
-#endif // MOZ_WIDGET_ANDROID
-
} // namespace layers
} // namespace mozilla
diff --git a/gfx/layers/opengl/TextureHostOGL.cpp b/gfx/layers/opengl/TextureHostOGL.cpp
index 02c398b51f..e4a0f5d953 100644
--- a/gfx/layers/opengl/TextureHostOGL.cpp
+++ b/gfx/layers/opengl/TextureHostOGL.cpp
@@ -40,16 +40,6 @@ CreateTextureHostOGL(const SurfaceDescriptor& aDesc,
{
RefPtr<TextureHost> result;
switch (aDesc.type()) {
-#ifdef MOZ_WIDGET_ANDROID
- case SurfaceDescriptor::TSurfaceTextureDescriptor: {
- const SurfaceTextureDescriptor& desc = aDesc.get_SurfaceTextureDescriptor();
- result = new SurfaceTextureHost(aFlags,
- (AndroidSurfaceTexture*)desc.surfTex(),
- desc.size());
- break;
- }
-#endif
-
case SurfaceDescriptor::TEGLImageDescriptor: {
const EGLImageDescriptor& desc = aDesc.get_EGLImageDescriptor();
result = new EGLImageTextureHost(aFlags,
@@ -348,177 +338,6 @@ GLTextureSource::gl() const
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
-// SurfaceTextureHost
-
-#ifdef MOZ_WIDGET_ANDROID
-
-SurfaceTextureSource::SurfaceTextureSource(CompositorOGL* aCompositor,
- AndroidSurfaceTexture* aSurfTex,
- gfx::SurfaceFormat aFormat,
- GLenum aTarget,
- GLenum aWrapMode,
- gfx::IntSize aSize)
- : mCompositor(aCompositor)
- , mSurfTex(aSurfTex)
- , mFormat(aFormat)
- , mTextureTarget(aTarget)
- , mWrapMode(aWrapMode)
- , mSize(aSize)
-{
-}
-
-void
-SurfaceTextureSource::BindTexture(GLenum aTextureUnit,
- gfx::SamplingFilter aSamplingFilter)
-{
- MOZ_ASSERT(mSurfTex);
- GLContext* gl = this->gl();
- if (!gl || !gl->MakeCurrent()) {
- NS_WARNING("Trying to bind a texture without a GLContext");
- return;
- }
-
- gl->fActiveTexture(aTextureUnit);
-
- // SurfaceTexture spams us if there are any existing GL errors, so
- // we'll clear them here in order to avoid that.
- gl->FlushErrors();
-
- mSurfTex->UpdateTexImage();
-
- ApplySamplingFilterToBoundTexture(gl, aSamplingFilter, mTextureTarget);
-}
-
-void
-SurfaceTextureSource::SetCompositor(Compositor* aCompositor)
-{
- CompositorOGL* glCompositor = AssertGLCompositor(aCompositor);
- if (!glCompositor) {
- DeallocateDeviceData();
- return;
- }
- if (mCompositor != glCompositor) {
- DeallocateDeviceData();
- }
-
- mCompositor = glCompositor;
-}
-
-bool
-SurfaceTextureSource::IsValid() const
-{
- return !!gl();
-}
-
-gl::GLContext*
-SurfaceTextureSource::gl() const
-{
- return mCompositor ? mCompositor->gl() : nullptr;
-}
-
-gfx::Matrix4x4
-SurfaceTextureSource::GetTextureTransform()
-{
- MOZ_ASSERT(mSurfTex);
-
- gfx::Matrix4x4 ret;
- mSurfTex->GetTransformMatrix(ret);
-
- return ret;
-}
-
-void
-SurfaceTextureSource::DeallocateDeviceData()
-{
- mSurfTex = nullptr;
-}
-
-////////////////////////////////////////////////////////////////////////
-
-SurfaceTextureHost::SurfaceTextureHost(TextureFlags aFlags,
- AndroidSurfaceTexture* aSurfTex,
- gfx::IntSize aSize)
- : TextureHost(aFlags)
- , mSurfTex(aSurfTex)
- , mSize(aSize)
- , mCompositor(nullptr)
-{
-}
-
-SurfaceTextureHost::~SurfaceTextureHost()
-{
-}
-
-gl::GLContext*
-SurfaceTextureHost::gl() const
-{
- return mCompositor ? mCompositor->gl() : nullptr;
-}
-
-bool
-SurfaceTextureHost::Lock()
-{
- MOZ_ASSERT(mSurfTex);
- GLContext* gl = this->gl();
- if (!gl || !gl->MakeCurrent()) {
- return false;
- }
-
- if (!mTextureSource) {
- gfx::SurfaceFormat format = gfx::SurfaceFormat::R8G8B8A8;
- GLenum target = LOCAL_GL_TEXTURE_EXTERNAL;
- GLenum wrapMode = LOCAL_GL_CLAMP_TO_EDGE;
- mTextureSource = new SurfaceTextureSource(mCompositor,
- mSurfTex,
- format,
- target,
- wrapMode,
- mSize);
- }
-
- return NS_SUCCEEDED(mSurfTex->Attach(gl));
-}
-
-void
-SurfaceTextureHost::Unlock()
-{
- MOZ_ASSERT(mSurfTex);
- mSurfTex->Detach();
-}
-
-void
-SurfaceTextureHost::SetCompositor(Compositor* aCompositor)
-{
- CompositorOGL* glCompositor = AssertGLCompositor(aCompositor);
- if (!glCompositor) {
- DeallocateDeviceData();
- return;
- }
- mCompositor = glCompositor;
- if (mTextureSource) {
- mTextureSource->SetCompositor(glCompositor);
- }
-}
-
-gfx::SurfaceFormat
-SurfaceTextureHost::GetFormat() const
-{
- return mTextureSource ? mTextureSource->GetFormat() : gfx::SurfaceFormat::UNKNOWN;
-}
-
-void
-SurfaceTextureHost::DeallocateDeviceData()
-{
- if (mTextureSource) {
- mTextureSource->DeallocateDeviceData();
- }
- mSurfTex = nullptr;
-}
-
-#endif // MOZ_WIDGET_ANDROID
-
-////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////
// EGLImage
EGLImageTextureSource::EGLImageTextureSource(CompositorOGL* aCompositor,
diff --git a/gfx/layers/opengl/TextureHostOGL.h b/gfx/layers/opengl/TextureHostOGL.h
index dd425e768c..f30811b104 100644
--- a/gfx/layers/opengl/TextureHostOGL.h
+++ b/gfx/layers/opengl/TextureHostOGL.h
@@ -336,103 +336,6 @@ protected:
};
////////////////////////////////////////////////////////////////////////
-// SurfaceTexture
-
-#ifdef MOZ_WIDGET_ANDROID
-
-class SurfaceTextureSource : public TextureSource
- , public TextureSourceOGL
-{
-public:
- SurfaceTextureSource(CompositorOGL* aCompositor,
- mozilla::gl::AndroidSurfaceTexture* aSurfTex,
- gfx::SurfaceFormat aFormat,
- GLenum aTarget,
- GLenum aWrapMode,
- gfx::IntSize aSize);
-
- virtual const char* Name() const override { return "SurfaceTextureSource"; }
-
- virtual TextureSourceOGL* AsSourceOGL() override { return this; }
-
- virtual void BindTexture(GLenum activetex,
- gfx::SamplingFilter aSamplingFilter) override;
-
- virtual bool IsValid() const override;
-
- virtual gfx::IntSize GetSize() const override { return mSize; }
-
- virtual gfx::SurfaceFormat GetFormat() const override { return mFormat; }
-
- virtual gfx::Matrix4x4 GetTextureTransform() override;
-
- virtual GLenum GetTextureTarget() const override { return mTextureTarget; }
-
- virtual GLenum GetWrapMode() const override { return mWrapMode; }
-
- virtual void DeallocateDeviceData() override;
-
- virtual void SetCompositor(Compositor* aCompositor) override;
-
- gl::GLContext* gl() const;
-
-protected:
- RefPtr<CompositorOGL> mCompositor;
- RefPtr<gl::AndroidSurfaceTexture> mSurfTex;
- const gfx::SurfaceFormat mFormat;
- const GLenum mTextureTarget;
- const GLenum mWrapMode;
- const gfx::IntSize mSize;
-};
-
-class SurfaceTextureHost : public TextureHost
-{
-public:
- SurfaceTextureHost(TextureFlags aFlags,
- mozilla::gl::AndroidSurfaceTexture* aSurfTex,
- gfx::IntSize aSize);
-
- virtual ~SurfaceTextureHost();
-
- virtual void DeallocateDeviceData() override;
-
- virtual void SetCompositor(Compositor* aCompositor) override;
-
- virtual Compositor* GetCompositor() override { return mCompositor; }
-
- virtual bool Lock() override;
-
- virtual void Unlock() override;
-
- virtual gfx::SurfaceFormat GetFormat() const override;
-
- virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture) override
- {
- aTexture = mTextureSource;
- return !!aTexture;
- }
-
- virtual already_AddRefed<gfx::DataSourceSurface> GetAsSurface() override
- {
- return nullptr; // XXX - implement this (for MOZ_DUMP_PAINTING)
- }
-
- gl::GLContext* gl() const;
-
- virtual gfx::IntSize GetSize() const override { return mSize; }
-
- virtual const char* Name() override { return "SurfaceTextureHost"; }
-
-protected:
- RefPtr<gl::AndroidSurfaceTexture> mSurfTex;
- const gfx::IntSize mSize;
- RefPtr<CompositorOGL> mCompositor;
- RefPtr<SurfaceTextureSource> mTextureSource;
-};
-
-#endif // MOZ_WIDGET_ANDROID
-
-////////////////////////////////////////////////////////////////////////
// EGLImage
class EGLImageTextureSource : public TextureSource