Fixed BAD_SURFACE on eglQuerySurfaceSize on some Android devices

This commit is contained in:
r.kuznetsov 2018-06-19 13:05:02 +03:00 committed by Daria Volvenkova
parent 61ccc67ee3
commit 4fec678eab
3 changed files with 18 additions and 4 deletions

View file

@ -174,7 +174,7 @@ bool Framework::IsDrapeEngineCreated()
void Framework::Resize(int w, int h)
{
m_contextFactory->CastFactory<AndroidOGLContextFactory>()->UpdateSurfaceSize();
m_contextFactory->CastFactory<AndroidOGLContextFactory>()->UpdateSurfaceSize(w, h);
m_work.OnSize(w, h);
//TODO: remove after correct visible rect calculation.

View file

@ -214,10 +214,24 @@ int AndroidOGLContextFactory::GetHeight() const
return m_surfaceHeight;
}
void AndroidOGLContextFactory::UpdateSurfaceSize()
void AndroidOGLContextFactory::UpdateSurfaceSize(int w, int h)
{
ASSERT(IsValid(), ());
QuerySurfaceSize();
if ((m_surfaceWidth != w && m_surfaceWidth != h) ||
(m_surfaceHeight != w && m_surfaceHeight != h))
{
LOG(LINFO, ("Surface size changed and must be re-queried."));
if (!QuerySurfaceSize())
{
m_surfaceWidth = w;
m_surfaceHeight = h;
}
}
else
{
m_surfaceWidth = w;
m_surfaceHeight = h;
}
}
bool AndroidOGLContextFactory::QuerySurfaceSize()

View file

@ -27,7 +27,7 @@ public:
int GetWidth() const;
int GetHeight() const;
void UpdateSurfaceSize();
void UpdateSurfaceSize(int w, int h);
bool IsSupportedOpenGLES3() const { return m_supportedES3; }