| OLD | NEW | 
|    1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
|    2 // Use of this source code is governed by a BSD-style license that can be |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 #ifndef UI_GL_GL_SURFACE_GLX_H_ |    5 #ifndef UI_GL_GL_SURFACE_GLX_H_ | 
|    6 #define UI_GL_GL_SURFACE_GLX_H_ |    6 #define UI_GL_GL_SURFACE_GLX_H_ | 
|    7  |    7  | 
|    8 #include <string> |    8 #include <string> | 
|    9  |    9  | 
|   10 #include "base/compiler_specific.h" |   10 #include "base/compiler_specific.h" | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
|   28   // These aren't particularly tied to surfaces, but since we already |   28   // These aren't particularly tied to surfaces, but since we already | 
|   29   // have the static InitializeOneOff here, it's easiest to reuse its |   29   // have the static InitializeOneOff here, it's easiest to reuse its | 
|   30   // initialization guards. |   30   // initialization guards. | 
|   31   static const char* GetGLXExtensions(); |   31   static const char* GetGLXExtensions(); | 
|   32   static bool HasGLXExtension(const char* name); |   32   static bool HasGLXExtension(const char* name); | 
|   33   static bool IsCreateContextSupported(); |   33   static bool IsCreateContextSupported(); | 
|   34   static bool IsCreateContextRobustnessSupported(); |   34   static bool IsCreateContextRobustnessSupported(); | 
|   35   static bool IsTextureFromPixmapSupported(); |   35   static bool IsTextureFromPixmapSupported(); | 
|   36   static bool IsOMLSyncControlSupported(); |   36   static bool IsOMLSyncControlSupported(); | 
|   37  |   37  | 
|   38   virtual void* GetDisplay() OVERRIDE; |   38   virtual void* GetDisplay() override; | 
|   39  |   39  | 
|   40   // Get the FB config that the surface was created with or NULL if it is not |   40   // Get the FB config that the surface was created with or NULL if it is not | 
|   41   // a GLX drawable. |   41   // a GLX drawable. | 
|   42   virtual void* GetConfig() = 0; |   42   virtual void* GetConfig() = 0; | 
|   43  |   43  | 
|   44  protected: |   44  protected: | 
|   45   virtual ~GLSurfaceGLX(); |   45   virtual ~GLSurfaceGLX(); | 
|   46  |   46  | 
|   47  private: |   47  private: | 
|   48   DISALLOW_COPY_AND_ASSIGN(GLSurfaceGLX); |   48   DISALLOW_COPY_AND_ASSIGN(GLSurfaceGLX); | 
|   49 }; |   49 }; | 
|   50  |   50  | 
|   51 // A surface used to render to a view. |   51 // A surface used to render to a view. | 
|   52 class GL_EXPORT NativeViewGLSurfaceGLX : public GLSurfaceGLX, |   52 class GL_EXPORT NativeViewGLSurfaceGLX : public GLSurfaceGLX, | 
|   53                                          public ui::PlatformEventDispatcher { |   53                                          public ui::PlatformEventDispatcher { | 
|   54  public: |   54  public: | 
|   55   explicit NativeViewGLSurfaceGLX(gfx::AcceleratedWidget window); |   55   explicit NativeViewGLSurfaceGLX(gfx::AcceleratedWidget window); | 
|   56  |   56  | 
|   57   // Implement GLSurfaceGLX. |   57   // Implement GLSurfaceGLX. | 
|   58   virtual bool Initialize() OVERRIDE; |   58   virtual bool Initialize() override; | 
|   59   virtual void Destroy() OVERRIDE; |   59   virtual void Destroy() override; | 
|   60   virtual bool Resize(const gfx::Size& size) OVERRIDE; |   60   virtual bool Resize(const gfx::Size& size) override; | 
|   61   virtual bool IsOffscreen() OVERRIDE; |   61   virtual bool IsOffscreen() override; | 
|   62   virtual bool SwapBuffers() OVERRIDE; |   62   virtual bool SwapBuffers() override; | 
|   63   virtual gfx::Size GetSize() OVERRIDE; |   63   virtual gfx::Size GetSize() override; | 
|   64   virtual void* GetHandle() OVERRIDE; |   64   virtual void* GetHandle() override; | 
|   65   virtual bool SupportsPostSubBuffer() OVERRIDE; |   65   virtual bool SupportsPostSubBuffer() override; | 
|   66   virtual void* GetConfig() OVERRIDE; |   66   virtual void* GetConfig() override; | 
|   67   virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |   67   virtual bool PostSubBuffer(int x, int y, int width, int height) override; | 
|   68   virtual VSyncProvider* GetVSyncProvider() OVERRIDE; |   68   virtual VSyncProvider* GetVSyncProvider() override; | 
|   69  |   69  | 
|   70  protected: |   70  protected: | 
|   71   virtual ~NativeViewGLSurfaceGLX(); |   71   virtual ~NativeViewGLSurfaceGLX(); | 
|   72  |   72  | 
|   73  private: |   73  private: | 
|   74   // The handle for the drawable to make current or swap. |   74   // The handle for the drawable to make current or swap. | 
|   75   gfx::AcceleratedWidget GetDrawableHandle() const; |   75   gfx::AcceleratedWidget GetDrawableHandle() const; | 
|   76  |   76  | 
|   77   // PlatformEventDispatcher implementation |   77   // PlatformEventDispatcher implementation | 
|   78   virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE; |   78   virtual bool CanDispatchEvent(const ui::PlatformEvent& event) override; | 
|   79   virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE; |   79   virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) override; | 
|   80  |   80  | 
|   81   // Window passed in at creation. Always valid. |   81   // Window passed in at creation. Always valid. | 
|   82   gfx::AcceleratedWidget parent_window_; |   82   gfx::AcceleratedWidget parent_window_; | 
|   83  |   83  | 
|   84   // Child window, used to control resizes so that they're in-order with GL. |   84   // Child window, used to control resizes so that they're in-order with GL. | 
|   85   gfx::AcceleratedWidget window_; |   85   gfx::AcceleratedWidget window_; | 
|   86  |   86  | 
|   87   void* config_; |   87   void* config_; | 
|   88   gfx::Size size_; |   88   gfx::Size size_; | 
|   89  |   89  | 
|   90   scoped_ptr<VSyncProvider> vsync_provider_; |   90   scoped_ptr<VSyncProvider> vsync_provider_; | 
|   91  |   91  | 
|   92   DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceGLX); |   92   DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceGLX); | 
|   93 }; |   93 }; | 
|   94  |   94  | 
|   95 // A surface used to render to an offscreen pbuffer. |   95 // A surface used to render to an offscreen pbuffer. | 
|   96 class GL_EXPORT PbufferGLSurfaceGLX : public GLSurfaceGLX { |   96 class GL_EXPORT PbufferGLSurfaceGLX : public GLSurfaceGLX { | 
|   97  public: |   97  public: | 
|   98   explicit PbufferGLSurfaceGLX(const gfx::Size& size); |   98   explicit PbufferGLSurfaceGLX(const gfx::Size& size); | 
|   99  |   99  | 
|  100   // Implement GLSurfaceGLX. |  100   // Implement GLSurfaceGLX. | 
|  101   virtual bool Initialize() OVERRIDE; |  101   virtual bool Initialize() override; | 
|  102   virtual void Destroy() OVERRIDE; |  102   virtual void Destroy() override; | 
|  103   virtual bool IsOffscreen() OVERRIDE; |  103   virtual bool IsOffscreen() override; | 
|  104   virtual bool SwapBuffers() OVERRIDE; |  104   virtual bool SwapBuffers() override; | 
|  105   virtual gfx::Size GetSize() OVERRIDE; |  105   virtual gfx::Size GetSize() override; | 
|  106   virtual void* GetHandle() OVERRIDE; |  106   virtual void* GetHandle() override; | 
|  107   virtual void* GetConfig() OVERRIDE; |  107   virtual void* GetConfig() override; | 
|  108  |  108  | 
|  109  protected: |  109  protected: | 
|  110   virtual ~PbufferGLSurfaceGLX(); |  110   virtual ~PbufferGLSurfaceGLX(); | 
|  111  |  111  | 
|  112  private: |  112  private: | 
|  113   gfx::Size size_; |  113   gfx::Size size_; | 
|  114   void* config_; |  114   void* config_; | 
|  115   XID pbuffer_; |  115   XID pbuffer_; | 
|  116  |  116  | 
|  117   DISALLOW_COPY_AND_ASSIGN(PbufferGLSurfaceGLX); |  117   DISALLOW_COPY_AND_ASSIGN(PbufferGLSurfaceGLX); | 
|  118 }; |  118 }; | 
|  119  |  119  | 
|  120 }  // namespace gfx |  120 }  // namespace gfx | 
|  121  |  121  | 
|  122 #endif  // UI_GL_GL_SURFACE_GLX_H_ |  122 #endif  // UI_GL_GL_SURFACE_GLX_H_ | 
| OLD | NEW |