CanvasContext.h revision 23b797ab5151eb2474f3bdd679f2f07bfd723042
123b797ab5151eb2474f3bdd679f2f07bfd723042John Reck/* 223b797ab5151eb2474f3bdd679f2f07bfd723042John Reck * Copyright (C) 2014 The Android Open Source Project 323b797ab5151eb2474f3bdd679f2f07bfd723042John Reck * 423b797ab5151eb2474f3bdd679f2f07bfd723042John Reck * Licensed under the Apache License, Version 2.0 (the "License"); 523b797ab5151eb2474f3bdd679f2f07bfd723042John Reck * you may not use this file except in compliance with the License. 623b797ab5151eb2474f3bdd679f2f07bfd723042John Reck * You may obtain a copy of the License at 723b797ab5151eb2474f3bdd679f2f07bfd723042John Reck * 823b797ab5151eb2474f3bdd679f2f07bfd723042John Reck * http://www.apache.org/licenses/LICENSE-2.0 923b797ab5151eb2474f3bdd679f2f07bfd723042John Reck * 1023b797ab5151eb2474f3bdd679f2f07bfd723042John Reck * Unless required by applicable law or agreed to in writing, software 1123b797ab5151eb2474f3bdd679f2f07bfd723042John Reck * distributed under the License is distributed on an "AS IS" BASIS, 1223b797ab5151eb2474f3bdd679f2f07bfd723042John Reck * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1323b797ab5151eb2474f3bdd679f2f07bfd723042John Reck * See the License for the specific language governing permissions and 1423b797ab5151eb2474f3bdd679f2f07bfd723042John Reck * limitations under the License. 1523b797ab5151eb2474f3bdd679f2f07bfd723042John Reck */ 1623b797ab5151eb2474f3bdd679f2f07bfd723042John Reck 1723b797ab5151eb2474f3bdd679f2f07bfd723042John Reck#ifndef CANVASCONTEXT_H_ 1823b797ab5151eb2474f3bdd679f2f07bfd723042John Reck#define CANVASCONTEXT_H_ 1923b797ab5151eb2474f3bdd679f2f07bfd723042John Reck 2023b797ab5151eb2474f3bdd679f2f07bfd723042John Reck#include <cutils/compiler.h> 2123b797ab5151eb2474f3bdd679f2f07bfd723042John Reck#include <EGL/egl.h> 2223b797ab5151eb2474f3bdd679f2f07bfd723042John Reck 2323b797ab5151eb2474f3bdd679f2f07bfd723042John Recknamespace android { 2423b797ab5151eb2474f3bdd679f2f07bfd723042John Recknamespace uirenderer { 2523b797ab5151eb2474f3bdd679f2f07bfd723042John Recknamespace renderthread { 2623b797ab5151eb2474f3bdd679f2f07bfd723042John Reck 2723b797ab5151eb2474f3bdd679f2f07bfd723042John Reckclass GlobalContext; 2823b797ab5151eb2474f3bdd679f2f07bfd723042John Reck 2923b797ab5151eb2474f3bdd679f2f07bfd723042John Reck// This per-renderer class manages the bridge between the global EGL context 3023b797ab5151eb2474f3bdd679f2f07bfd723042John Reck// and the render surface. 3123b797ab5151eb2474f3bdd679f2f07bfd723042John Reckclass CanvasContext { 3223b797ab5151eb2474f3bdd679f2f07bfd723042John Reckpublic: 3323b797ab5151eb2474f3bdd679f2f07bfd723042John Reck ANDROID_API CanvasContext(); 3423b797ab5151eb2474f3bdd679f2f07bfd723042John Reck ANDROID_API ~CanvasContext(); 3523b797ab5151eb2474f3bdd679f2f07bfd723042John Reck 3623b797ab5151eb2474f3bdd679f2f07bfd723042John Reck ANDROID_API bool setSurface(EGLNativeWindowType window); 3723b797ab5151eb2474f3bdd679f2f07bfd723042John Reck ANDROID_API bool swapBuffers(); 3823b797ab5151eb2474f3bdd679f2f07bfd723042John Reck ANDROID_API bool makeCurrent(); 3923b797ab5151eb2474f3bdd679f2f07bfd723042John Reck 4023b797ab5151eb2474f3bdd679f2f07bfd723042John Reck ANDROID_API static bool useGlobalPBufferSurface(); 4123b797ab5151eb2474f3bdd679f2f07bfd723042John Reck 4223b797ab5151eb2474f3bdd679f2f07bfd723042John Reckprivate: 4323b797ab5151eb2474f3bdd679f2f07bfd723042John Reck 4423b797ab5151eb2474f3bdd679f2f07bfd723042John Reck GlobalContext* mGlobalContext; 4523b797ab5151eb2474f3bdd679f2f07bfd723042John Reck EGLSurface mEglSurface; 4623b797ab5151eb2474f3bdd679f2f07bfd723042John Reck bool mDirtyRegionsEnabled; 4723b797ab5151eb2474f3bdd679f2f07bfd723042John Reck}; 4823b797ab5151eb2474f3bdd679f2f07bfd723042John Reck 4923b797ab5151eb2474f3bdd679f2f07bfd723042John Reck} /* namespace renderthread */ 5023b797ab5151eb2474f3bdd679f2f07bfd723042John Reck} /* namespace uirenderer */ 5123b797ab5151eb2474f3bdd679f2f07bfd723042John Reck} /* namespace android */ 5223b797ab5151eb2474f3bdd679f2f07bfd723042John Reck#endif /* CANVASCONTEXT_H_ */ 53