Home | History | Annotate | Download | only in libOpenglRender
      1 /*
      2 * Copyright (C) 2011 The Android Open Source Project
      3 *
      4 * Licensed under the Apache License, Version 2.0 (the "License");
      5 * you may not use this file except in compliance with the License.
      6 * You may obtain a copy of the License at
      7 *
      8 * http://www.apache.org/licenses/LICENSE-2.0
      9 *
     10 * Unless required by applicable law or agreed to in writing, software
     11 * distributed under the License is distributed on an "AS IS" BASIS,
     12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 * See the License for the specific language governing permissions and
     14 * limitations under the License.
     15 */
     16 #ifndef _LIBRENDER_RENDERCONTEXT_H
     17 #define _LIBRENDER_RENDERCONTEXT_H
     18 
     19 #include "SmartPtr.h"
     20 #include <EGL/egl.h>
     21 #include "GLDecoderContextData.h"
     22 
     23 class RenderContext;
     24 typedef SmartPtr<RenderContext> RenderContextPtr;
     25 
     26 class RenderContext
     27 {
     28 public:
     29     static RenderContext *create(int p_config, RenderContextPtr p_shareContext,
     30                                  bool p_isGL2 = false);
     31     ~RenderContext();
     32     int getConfig() const { return m_config; }
     33 
     34     EGLContext getEGLContext() const { return m_ctx; }
     35     bool isGL2() const { return m_isGL2; }
     36 
     37     GLDecoderContextData & decoderContextData() { return m_contextData; }
     38 
     39 private:
     40     RenderContext();
     41 
     42 private:
     43     EGLContext m_ctx;
     44     int        m_config;
     45     bool       m_isGL2;
     46     GLDecoderContextData    m_contextData;
     47 };
     48 
     49 #endif
     50