| OLD | NEW |
| (Empty) |
| 1 | |
| 2 /* | |
| 3 * Copyright 2016 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 GLWindowContext_DEFINED | |
| 9 #define GLWindowContext_DEFINED | |
| 10 | |
| 11 | |
| 12 #include "gl/GrGLInterface.h" | |
| 13 | |
| 14 #include "SkRefCnt.h" | |
| 15 #include "GrRenderTarget.h" | |
| 16 #include "SkSurface.h" | |
| 17 | |
| 18 #include "WindowContext.h" | |
| 19 | |
| 20 class GrContext; | |
| 21 | |
| 22 namespace sk_app { | |
| 23 | |
| 24 class GLWindowContext : public WindowContext { | |
| 25 public: | |
| 26 // This is defined in the platform .cpp file | |
| 27 static GLWindowContext* Create(void* platformData, const DisplayParams& para
ms); | |
| 28 | |
| 29 sk_sp<SkSurface> getBackbufferSurface() override; | |
| 30 | |
| 31 bool isValid() override { return SkToBool(fBackendContext.get()); } | |
| 32 | |
| 33 void resize(uint32_t w, uint32_t h) override; | |
| 34 void swapBuffers() override; | |
| 35 | |
| 36 void setDisplayParams(const DisplayParams& params) override; | |
| 37 | |
| 38 GrBackendContext getBackendContext() override { | |
| 39 return (GrBackendContext) fBackendContext.get(); | |
| 40 } | |
| 41 | |
| 42 protected: | |
| 43 GLWindowContext(void*, const DisplayParams&); | |
| 44 void initializeContext(void*, const DisplayParams&); | |
| 45 virtual void onInitializeContext(void*, const DisplayParams&) = 0; | |
| 46 void destroyContext(); | |
| 47 virtual void onDestroyContext() = 0; | |
| 48 virtual void onSwapBuffers() = 0; | |
| 49 | |
| 50 SkAutoTUnref<const GrGLInterface> fBackendContext; | |
| 51 sk_sp<GrRenderTarget> fRenderTarget; | |
| 52 sk_sp<SkSurface> fSurface; | |
| 53 | |
| 54 // parameters obtained from the native window | |
| 55 int fSampleCount; | |
| 56 int fStencilBits; | |
| 57 int fColorBits; | |
| 58 int fActualColorBits; | |
| 59 }; | |
| 60 | |
| 61 } // namespace sk_app | |
| 62 | |
| 63 #endif | |
| OLD | NEW |