Home | History | Annotate | Download | only in src
      1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef BENCH_GL_EGL_STUFF_H_
      6 #define BENCH_GL_EGL_STUFF_H_
      7 
      8 #include "base/logging.h"
      9 #include "glinterface.h"
     10 #include <EGL/egl.h>
     11 
     12 class EGLInterface : public GLInterface {
     13  public:
     14 
     15   EGLInterface() : display_(EGL_NO_DISPLAY),
     16                    config_(NULL),
     17                    surface_(NULL),
     18                    context_(NULL) { }
     19   virtual ~EGLInterface() {}
     20 
     21   virtual bool Init();
     22   virtual void Cleanup();
     23   virtual XVisualInfo* GetXVisual();
     24 
     25   virtual void SwapBuffers();
     26   virtual bool SwapInterval(int interval);
     27 
     28   virtual void CheckError();
     29 
     30   virtual bool MakeCurrent(const GLContext& context);
     31   virtual const GLContext CreateContext();
     32   virtual void DeleteContext(const GLContext& context);
     33   virtual const GLContext& GetMainContext() {
     34     return context_;
     35   }
     36 
     37   void TerminateGL();
     38 
     39   const EGLDisplay display() const {
     40     return display_;
     41   }
     42 
     43   const EGLSurface surface() const {
     44     return surface_;
     45   }
     46 
     47  private:
     48   EGLDisplay display_;
     49   EGLConfig config_;
     50   EGLSurface surface_;
     51   EGLContext context_;
     52 };
     53 
     54 #endif  // BENCH_GL_EGL_STUFF_H_
     55