CanvasContext.h revision 23b797ab5151eb2474f3bdd679f2f07bfd723042
1/* 2 * Copyright (C) 2014 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 17#ifndef CANVASCONTEXT_H_ 18#define CANVASCONTEXT_H_ 19 20#include <cutils/compiler.h> 21#include <EGL/egl.h> 22 23namespace android { 24namespace uirenderer { 25namespace renderthread { 26 27class GlobalContext; 28 29// This per-renderer class manages the bridge between the global EGL context 30// and the render surface. 31class CanvasContext { 32public: 33 ANDROID_API CanvasContext(); 34 ANDROID_API ~CanvasContext(); 35 36 ANDROID_API bool setSurface(EGLNativeWindowType window); 37 ANDROID_API bool swapBuffers(); 38 ANDROID_API bool makeCurrent(); 39 40 ANDROID_API static bool useGlobalPBufferSurface(); 41 42private: 43 44 GlobalContext* mGlobalContext; 45 EGLSurface mEglSurface; 46 bool mDirtyRegionsEnabled; 47}; 48 49} /* namespace renderthread */ 50} /* namespace uirenderer */ 51} /* namespace android */ 52#endif /* CANVASCONTEXT_H_ */ 53