2011-10-19 20:43:20 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright 2011 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
#ifndef SkMesaGLContext_DEFINED
|
|
|
|
#define SkMesaGLContext_DEFINED
|
|
|
|
|
|
|
|
#include "SkGLContext.h"
|
|
|
|
|
|
|
|
#if SK_MESA
|
|
|
|
|
|
|
|
class SkMesaGLContext : public SkGLContext {
|
2011-10-24 21:17:53 +00:00
|
|
|
private:
|
|
|
|
typedef intptr_t Context;
|
|
|
|
|
2011-10-19 20:43:20 +00:00
|
|
|
public:
|
|
|
|
SkMesaGLContext();
|
|
|
|
|
|
|
|
virtual ~SkMesaGLContext();
|
|
|
|
|
|
|
|
virtual void makeCurrent() const SK_OVERRIDE;
|
|
|
|
|
2011-10-24 21:17:53 +00:00
|
|
|
class AutoContextRestore {
|
|
|
|
public:
|
|
|
|
AutoContextRestore();
|
|
|
|
~AutoContextRestore();
|
|
|
|
|
|
|
|
private:
|
|
|
|
Context fOldContext;
|
2012-04-19 19:27:19 +00:00
|
|
|
GrGLint fOldWidth;
|
|
|
|
GrGLint fOldHeight;
|
|
|
|
GrGLint fOldFormat;
|
2011-10-24 21:17:53 +00:00
|
|
|
void* fOldImage;
|
|
|
|
};
|
|
|
|
|
2011-10-19 20:43:20 +00:00
|
|
|
protected:
|
|
|
|
virtual const GrGLInterface* createGLContext() SK_OVERRIDE;
|
2011-10-27 20:44:19 +00:00
|
|
|
virtual void destroyGLContext() SK_OVERRIDE;
|
2011-10-19 20:43:20 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
Context fContext;
|
|
|
|
GrGLubyte *fImage;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2011-10-24 21:17:53 +00:00
|
|
|
#endif
|