blob: 14a3ca7b272e272162c411857d09de9f0af399c9 [file] [log] [blame]
bsalomon@google.com373a6632011-10-19 20:43:20 +00001
2/*
3 * Copyright 2011 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8#ifndef SkMesaGLContext_DEFINED
9#define SkMesaGLContext_DEFINED
10
11#include "SkGLContext.h"
12
13#if SK_MESA
14
15class SkMesaGLContext : public SkGLContext {
bsalomon@google.com57f5d982011-10-24 21:17:53 +000016private:
17 typedef intptr_t Context;
18
bsalomon@google.com373a6632011-10-19 20:43:20 +000019public:
20 SkMesaGLContext();
21
22 virtual ~SkMesaGLContext();
23
24 virtual void makeCurrent() const SK_OVERRIDE;
25
bsalomon@google.com57f5d982011-10-24 21:17:53 +000026 class AutoContextRestore {
27 public:
28 AutoContextRestore();
29 ~AutoContextRestore();
30
31 private:
32 Context fOldContext;
bsalomon@google.comb3400ba2012-04-19 19:27:19 +000033 GrGLint fOldWidth;
34 GrGLint fOldHeight;
35 GrGLint fOldFormat;
bsalomon@google.com57f5d982011-10-24 21:17:53 +000036 void* fOldImage;
37 };
38
bsalomon@google.com373a6632011-10-19 20:43:20 +000039protected:
40 virtual const GrGLInterface* createGLContext() SK_OVERRIDE;
bsalomon@google.com74913722011-10-27 20:44:19 +000041 virtual void destroyGLContext() SK_OVERRIDE;
bsalomon@google.com373a6632011-10-19 20:43:20 +000042
43private:
bsalomon@google.com373a6632011-10-19 20:43:20 +000044 Context fContext;
45 GrGLubyte *fImage;
46};
47
48#endif
49
bsalomon@google.com57f5d982011-10-24 21:17:53 +000050#endif