summaryrefslogtreecommitdiff
path: root/gfx/gl/SkiaGLGlue.h
blob: 4110c0c5471d305a63731e2c2d21121db0446e88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40; -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef SKIA_GL_GLUE_H_
#define SKIA_GL_GLUE_H_

#ifdef USE_SKIA_GPU

#include "skia/include/core/SkRefCnt.h"
#include "mozilla/RefPtr.h"

struct GrGLInterface;
class GrContext;

namespace mozilla {
namespace gl {

class GLContext;

class SkiaGLGlue : public GenericAtomicRefCounted
{
public:
  MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SkiaGLGlue)
  explicit SkiaGLGlue(GLContext* context);
  GLContext* GetGLContext() const { return mGLContext.get(); }
  GrContext* GetGrContext() const { return mGrContext.get(); }

protected:
  virtual ~SkiaGLGlue();

private:
  RefPtr<GLContext> mGLContext;
  sk_sp<GrGLInterface> mGrGLInterface;
  sk_sp<GrContext> mGrContext;
};

} // namespace gl
} // namespace mozilla

#else // USE_SKIA_GPU

class GrContext;

namespace mozilla {
namespace gl {

class GLContext;

class SkiaGLGlue : public GenericAtomicRefCounted
{
public:
  SkiaGLGlue(GLContext* context);
  GLContext* GetGLContext() const { return nullptr; }
  GrContext* GetGrContext() const { return nullptr; }
};

} // namespace gl
} // namespace mozilla

#endif // USE_SKIA_GPU

#endif // SKIA_GL_GLUE_H_