| 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 ANGLEWindowContext_DEFINED |
| 8 |
#define ANGLEWindowContext_DEFINED |
| 9 |
|
| 10 |
#define EGL_EGL_PROTOTYPES 1 |
| 11 |
|
| 12 |
#include <EGL/egl.h> |
| 13 |
#include <EGL/eglext.h> |
| 14 |
#include "tools/window/GLWindowContext.h" |
| 15 |
|
| 16 |
namespace skwindow::internal { |
| 17 |
|
| 18 |
class ANGLEWindowContext : public GLWindowContext { |
| 19 |
public: |
| 20 |
using GLWindowContext::GLWindowContext; |
| 21 |
~ANGLEWindowContext() override; |
| 22 |
|
| 23 |
protected: |
| 24 |
void onSwapBuffers() override; |
| 25 |
|
| 26 |
sk_sp<const GrGLInterface> onInitializeContext() override; |
| 27 |
void onDestroyContext() override; |
| 28 |
|
| 29 |
virtual EGLDisplay onGetEGLDisplay( |
| 30 |
PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT) const = 0; |
| 31 |
virtual NativeWindowType onGetNativeWindow() const = 0; |
| 32 |
virtual SkISize onGetSize() const = 0; |
| 33 |
virtual int onGetStencilBits() const = 0; |
| 34 |
|
| 35 |
private: |
| 36 |
EGLDisplay fDisplay = EGL_NO_DISPLAY; |
| 37 |
EGLContext fEGLContext = EGL_NO_CONTEXT; |
| 38 |
EGLSurface fEGLSurface = EGL_NO_SURFACE; |
| 39 |
}; |
| 40 |
|
| 41 |
} // namespace skwindow::internal |
| 42 |
|
| 43 |
#endif |