blob: 75edf2d82d24f7674bd56894b6c7634e62ab20b7 (
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
|
/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef WindowContext_DEFINED
#define WindowContext_DEFINED
#include "DisplayParams.h"
#include "GrTypes.h"
#include "SkRefCnt.h"
#include "SkSurfaceProps.h"
class GrContext;
class SkSurface;
class GrRenderTarget;
namespace sk_app {
class WindowContext {
public:
WindowContext() : fContext(nullptr)
, fSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType) {}
virtual ~WindowContext() {}
virtual sk_sp<SkSurface> getBackbufferSurface() = 0;
virtual void swapBuffers() = 0;
virtual bool isValid() = 0;
virtual void resize(int w, int h) = 0;
const DisplayParams& getDisplayParams() { return fDisplayParams; }
virtual void setDisplayParams(const DisplayParams& params) = 0;
SkSurfaceProps getSurfaceProps() const { return fSurfaceProps; }
void setSurfaceProps(const SkSurfaceProps& props) {
fSurfaceProps = props;
}
virtual GrBackendContext getBackendContext() = 0;
GrContext* getGrContext() const { return fContext; }
protected:
virtual bool isGpuContext() { return true; }
GrContext* fContext;
int fWidth;
int fHeight;
DisplayParams fDisplayParams;
GrPixelConfig fPixelConfig;
SkSurfaceProps fSurfaceProps;
};
} // namespace sk_app
#endif
|