Flutter Engine
The Flutter Engine
GLWindowContext.h
Go to the documentation of this file.
1/*
2 * Copyright 2023 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7#ifndef GLWindowContext_DEFINED
8#define GLWindowContext_DEFINED
9
10
12
15
17
18namespace skwindow::internal {
19
21public:
23
24 bool isValid() override { return SkToBool(fBackendContext.get()); }
25
26 void resize(int w, int h) override;
27
28 void setDisplayParams(const DisplayParams& params) override;
29
30protected:
32 // This should be called by subclass constructor. It is also called when window/display
33 // parameters change. This will in turn call onInitializeContext().
34 void initializeContext();
36
37 // This should be called by subclass destructor. It is also called when window/display
38 // parameters change prior to initializing a new GL context. This will in turn call
39 // onDestroyContext().
40 void destroyContext();
41 virtual void onDestroyContext() = 0;
42
45};
46
47} // namespace skwindow::internal
48
49#endif
static constexpr bool SkToBool(const T &x)
Definition: SkTo.h:35
T * get() const
Definition: SkRefCnt.h:303
void resize(int w, int h) override
sk_sp< const GrGLInterface > fBackendContext
virtual sk_sp< const GrGLInterface > onInitializeContext()=0
GLWindowContext(const DisplayParams &)
sk_sp< SkSurface > getBackbufferSurface() override
void setDisplayParams(const DisplayParams &params) override
const EmbeddedViewParams * params
SkScalar w
SkScalar h