Bug 1329362 - part 2, Add accessor functions for EGLNativeWindowType, ANativeWindow, and EGLSurface to AndroidCompositorWidget r=dvander,kats
authorRandall Barker <rbarker@mozilla.com>
Fri, 20 Jan 2017 15:05:10 -0800
changeset 380484 4132cf335efda40ffb5141e11d9333fdcea55305
parent 380483 6cff8143e0073797bbba49ad86a1a6b1d83ebd89
child 380485 8b768ff7e8360c0e20e147b6b7c2deed6b2f512c
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander, kats
bugs1329362
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1329362 - part 2, Add accessor functions for EGLNativeWindowType, ANativeWindow, and EGLSurface to AndroidCompositorWidget r=dvander,kats
widget/InProcessCompositorWidget.h
widget/android/AndroidCompositorWidget.cpp
widget/android/AndroidCompositorWidget.h
--- a/widget/InProcessCompositorWidget.h
+++ b/widget/InProcessCompositorWidget.h
@@ -38,16 +38,16 @@ public:
   virtual uint32_t GetGLFrameBufferFormat() override;
   virtual layers::Composer2D* GetComposer2D() override;
   virtual void ObserveVsync(VsyncObserver* aObserver) override;
   virtual uintptr_t GetWidgetKey() override;
 
   // If you can override this method, inherit from CompositorWidget instead.
   nsIWidget* RealWidget() override;
 
-private:
+protected:
   nsBaseWidget* mWidget;
 };
 
 } // namespace widget
 } // namespace mozilla
 
 #endif
--- a/widget/android/AndroidCompositorWidget.cpp
+++ b/widget/android/AndroidCompositorWidget.cpp
@@ -54,10 +54,34 @@ AndroidCompositorWidget::SyncFrameMetric
     MOZ_ASSERT(viewTransform, "No view transform object!");
 
     aFixedLayerMargins.top = viewTransform->FixedLayerMarginTop();
     aFixedLayerMargins.right = viewTransform->FixedLayerMarginRight();
     aFixedLayerMargins.bottom = viewTransform->FixedLayerMarginBottom();
     aFixedLayerMargins.left = viewTransform->FixedLayerMarginLeft();
 }
 
+EGLNativeWindowType
+AndroidCompositorWidget::GetEGLNativeWindow()
+{
+  return (EGLNativeWindowType)mWidget->GetNativeData(NS_JAVA_SURFACE);
+}
+
+EGLNativeWindowType
+AndroidCompositorWidget::GetPresentationEGLSurface()
+{
+  return (EGLNativeWindowType)mWidget->GetNativeData(NS_PRESENTATION_SURFACE);
+}
+
+void
+AndroidCompositorWidget::SetPresentationEGLSurface(EGLSurface aVal)
+{
+  mWidget->SetNativeData(NS_PRESENTATION_SURFACE, (uintptr_t)aVal);
+}
+
+ANativeWindow*
+AndroidCompositorWidget::GetPresentationANativeWindow()
+{
+  return (ANativeWindow*)mWidget->GetNativeData(NS_PRESENTATION_WINDOW);
+}
+
 } // namespace widget
 } // namespace mozilla
--- a/widget/android/AndroidCompositorWidget.h
+++ b/widget/android/AndroidCompositorWidget.h
@@ -1,18 +1,23 @@
 /* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
  * 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_widget_AndroidCompositorWidget_h
 #define mozilla_widget_AndroidCompositorWidget_h
 
+#include "GLContext.h"
+#include "GLLibraryEGL.h"
+#include "GLTypes.h"
 #include "mozilla/widget/InProcessCompositorWidget.h"
 
+struct ANativeWindow;
+
 namespace mozilla {
 namespace widget {
 
 /**
  * AndroidCompositorWidget inherits from InProcessCompositorWidget because
  * Android does not support OOP compositing yet. Once it does,
  * AndroidCompositorWidget will be made to inherit from CompositorWidget
  * instead.
@@ -31,14 +36,21 @@ public:
     void SyncFrameMetrics(const ParentLayerPoint& aScrollOffset,
                           const CSSToParentLayerScale& aZoom,
                           const CSSRect& aCssPageRect,
                           const CSSRect& aDisplayPort,
                           const CSSToLayerScale& aPaintedResolution,
                           bool aLayersUpdated,
                           int32_t aPaintSyncId,
                           ScreenMargin& aFixedLayerMargins);
+
+    EGLNativeWindowType GetEGLNativeWindow();
+
+    EGLSurface GetPresentationEGLSurface();
+    void SetPresentationEGLSurface(EGLSurface aVal);
+
+    ANativeWindow* GetPresentationANativeWindow();
 };
 
 } // namespace widget
 } // namespace mozilla
 
 #endif // mozilla_widget_AndroidCompositorWidget_h