tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

GLContextProvider.h (2685B)


      1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
      2 * This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 #ifndef GLCONTEXTPROVIDER_H_
      7 #define GLCONTEXTPROVIDER_H_
      8 
      9 #include "mozilla/AlreadyAddRefed.h"
     10 
     11 #include "GLContextTypes.h"
     12 #include "SurfaceTypes.h"
     13 
     14 #include "nsSize.h"  // for gfx::IntSize (needed by GLContextProviderImpl.h below)
     15 #include "nsStringFwd.h"  // needed by GLContextProviderImpl.h below
     16 
     17 class nsIWidget;
     18 
     19 namespace mozilla {
     20 namespace widget {
     21 class CompositorWidget;
     22 }
     23 namespace gl {
     24 
     25 #define IN_GL_CONTEXT_PROVIDER_H
     26 
     27 // Null is always there
     28 #define GL_CONTEXT_PROVIDER_NAME GLContextProviderNull
     29 
     30 // This header uses `already_AddRefed`.
     31 #include "GLContextProviderImpl.h"
     32 #undef GL_CONTEXT_PROVIDER_NAME
     33 
     34 #ifdef XP_WIN
     35 #  define GL_CONTEXT_PROVIDER_NAME GLContextProviderWGL
     36 #  include "GLContextProviderImpl.h"
     37 #  undef GL_CONTEXT_PROVIDER_NAME
     38 #  define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderWGL
     39 #  define DEFAULT_IMPL WGL
     40 #endif
     41 
     42 #ifdef XP_MACOSX
     43 #  define GL_CONTEXT_PROVIDER_NAME GLContextProviderCGL
     44 #  include "GLContextProviderImpl.h"
     45 #  undef GL_CONTEXT_PROVIDER_NAME
     46 #  define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderCGL
     47 #endif
     48 
     49 #define GL_CONTEXT_PROVIDER_NAME GLContextProviderEGL
     50 #include "GLContextProviderImpl.h"
     51 #undef GL_CONTEXT_PROVIDER_NAME
     52 
     53 #if defined(MOZ_WIDGET_GTK)
     54 #  ifdef MOZ_X11
     55 #    define GL_CONTEXT_PROVIDER_NAME GLContextProviderGLX
     56 #    include "GLContextProviderImpl.h"
     57 #    undef GL_CONTEXT_PROVIDER_NAME
     58 #  endif
     59 #  define GL_CONTEXT_PROVIDER_NAME GLContextProviderLinux
     60 #  include "GLContextProviderImpl.h"
     61 #  undef GL_CONTEXT_PROVIDER_NAME
     62 #  define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderLinux
     63 #endif
     64 
     65 #if defined(MOZ_WIDGET_UIKIT)
     66 #  define GL_CONTEXT_PROVIDER_NAME GLContextProviderEAGL
     67 #  include "GLContextProviderImpl.h"
     68 #  undef GL_CONTEXT_PROVIDER_NAME
     69 #  ifndef GL_CONTEXT_PROVIDER_DEFAULT
     70 #    define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderEAGL
     71 #  endif
     72 #endif
     73 
     74 #ifndef GL_CONTEXT_PROVIDER_DEFAULT
     75 #  define GL_CONTEXT_PROVIDER_DEFAULT GLContextProviderEGL
     76 #endif
     77 
     78 #ifdef MOZ_GL_PROVIDER
     79 #  define GL_CONTEXT_PROVIDER_NAME MOZ_GL_PROVIDER
     80 #  include "GLContextProviderImpl.h"
     81 #  undef GL_CONTEXT_PROVIDER_NAME
     82 #  define GL_CONTEXT_PROVIDER_DEFAULT MOZ_GL_PROVIDER
     83 #endif
     84 
     85 #ifdef GL_CONTEXT_PROVIDER_DEFAULT
     86 typedef GL_CONTEXT_PROVIDER_DEFAULT GLContextProvider;
     87 #else
     88 typedef GLContextProviderNull GLContextProvider;
     89 #endif
     90 
     91 #undef IN_GL_CONTEXT_PROVIDER_H
     92 
     93 }  // namespace gl
     94 }  // namespace mozilla
     95 
     96 #endif