Bug 1184534 - Add support for target size retrieval to GLX backend. r=jgilbert

This commit is contained in:
Andrew Comminos 2015-07-30 12:39:26 -04:00
parent 170612bcd9
commit e27a48201a
3 changed files with 24 additions and 0 deletions

View File

@ -32,6 +32,7 @@
#define MOZ_GL_DEBUG 1
#endif
#include "../../mfbt/Maybe.h"
#include "../../mfbt/RefPtr.h"
#include "../../mfbt/UniquePtr.h"
@ -3250,6 +3251,13 @@ public:
GLuint GetFB();
/*
* Retrieves the size of the native windowing system drawable.
*/
virtual Maybe<gfx::IntSize> GetTargetSize() {
return Maybe<gfx::IntSize>();
};
private:
void GetShaderPrecisionFormatNonES2(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) {
switch (precisiontype) {

View File

@ -50,6 +50,8 @@ public:
virtual bool SwapBuffers() override;
virtual Maybe<gfx::IntSize> GetTargetSize() override;
private:
friend class GLContextProviderGLX;

View File

@ -912,6 +912,20 @@ GLContextGLX::SwapBuffers()
return true;
}
Maybe<gfx::IntSize>
GLContextGLX::GetTargetSize()
{
unsigned int width = 0, height = 0;
Window root;
int x, y;
unsigned int border, depth;
XGetGeometry(mDisplay, mDrawable, &root, &x, &y, &width, &height,
&border, &depth);
Maybe<gfx::IntSize> size;
size.emplace(width, height);
return size;
}
GLContextGLX::GLContextGLX(
const SurfaceCaps& caps,
GLContext* shareContext,