180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru/* 380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Copyright 2011 Google Inc. 480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * 580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * Use of this source code is governed by a BSD-style license that can be 680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru * found in the LICENSE file. 780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru */ 880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#ifndef SkMesaGLContext_DEFINED 980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#define SkMesaGLContext_DEFINED 1080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 11096defe64d408e54474fe19f418c95bf1a554fc7Derek Sollenberger#include "SkGLContextHelper.h" 1280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#if SK_MESA 1480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 15096defe64d408e54474fe19f418c95bf1a554fc7Derek Sollenbergerclass SkMesaGLContext : public SkGLContextHelper { 1680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprivate: 1780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru typedef intptr_t Context; 1880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 1980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Querupublic: 2080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru SkMesaGLContext(); 2180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 2280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual ~SkMesaGLContext(); 2380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 2480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual void makeCurrent() const SK_OVERRIDE; 250a657bbc2c6fc9daf699942e023050536d5ec95fDerek Sollenberger virtual void swapBuffers() const SK_OVERRIDE; 2680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 2780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru class AutoContextRestore { 2880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru public: 2980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru AutoContextRestore(); 3080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru ~AutoContextRestore(); 3180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 3280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru private: 3380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru Context fOldContext; 3480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru GrGLint fOldWidth; 3580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru GrGLint fOldHeight; 3680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru GrGLint fOldFormat; 3780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru void* fOldImage; 3880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru }; 3980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 4080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprotected: 4180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual const GrGLInterface* createGLContext() SK_OVERRIDE; 4280bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru virtual void destroyGLContext() SK_OVERRIDE; 4380bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 4480bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queruprivate: 4580bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru Context fContext; 4680bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru GrGLubyte *fImage; 4780bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru}; 4880bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 4980bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif 5080bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru 5180bacfeb4bda06541e8695bd502229727bccfeaJean-Baptiste Queru#endif 52