All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
AndroidGlDisplayService.h
1 // Copyright eeGeo Ltd (2017), All Rights Reserved
2 
3 #pragma once
4 
5 #include "IAndroidGlDisplayService.h"
6 #include "Types.h"
7 #include "AndroidSharedGlContextUsageGuard.h"
8 
9 namespace Eegeo
10 {
11  namespace Android
12  {
13  namespace Sdk
14  {
16  {
17  public:
18 
20  const Eegeo::Android::Sdk::INativeWindowProvider& nativeWindowProvider,
21  float deviceDpi,
22  float devicePixelScale,
23  const std::string &imageResolutionSuffix);
25 
26  bool TryBindDisplay();
27  void ReleaseDisplay(bool destroyEGL);
28 
29  bool IsDisplayAvailable() const;
30  int GetDisplayWidth() const;
31  int GetDisplayHeight() const;
32  EGLDisplay GetDisplay() const;
33  EGLSurface GetSurface() const;
34  EGLSurface GetSharedSurface() const;
35  EGLContext GetContext() const;
36  EGLContext GetResourceBuildSharedContext() const;
37  float GetDeviceDpi() const;
38  float GetDevicePixelScale() const;
39  std::string GetImageResolutionSuffix() const;
40 
41  GlDisplayServiceChangedEvent& ChangedEvent() const { return *m_changedEvent; }
42  IAndroidSharedGlContextUsageGuard& GetSharedGlContextUsageGuard() const { return *m_pGuard; }
43 
44  private:
45 
46  EGLDisplay m_display;
47  EGLSurface m_surface;
48  EGLSurface m_sharedSurface;
49  EGLContext m_context;
50  EGLContext m_resourceBuildSharedContext;
51  int m_displayWidth;
52  int m_displayHeight;
53  bool m_displayBound;
54  float m_deviceDpi;
55  float m_devicePixelScale;
56  std::string m_imageResolutionSuffix;
57 
58  GlDisplayServiceChangedEvent* m_changedEvent;
59 
60  const Eegeo::Android::Sdk::INativeWindowProvider& m_nativeWindowProvider;
62  };
63  }
64  }
65 }