Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1123)

Side by Side Diff: tools/viewer/sk_app/GLWindowContext.h

Issue 2169543002: Use Windowing system-specific WindowContext factories. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: more xlib Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/vk/GrVkBackendContext.cpp ('k') | tools/viewer/sk_app/GLWindowContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2016 Google Inc. 3 * Copyright 2016 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #ifndef GLWindowContext_DEFINED 8 #ifndef GLWindowContext_DEFINED
9 #define GLWindowContext_DEFINED 9 #define GLWindowContext_DEFINED
10 10
11 11
12 #include "gl/GrGLInterface.h" 12 #include "gl/GrGLInterface.h"
13 13
14 #include "SkRefCnt.h" 14 #include "SkRefCnt.h"
15 #include "GrRenderTarget.h" 15 #include "GrRenderTarget.h"
16 #include "SkSurface.h" 16 #include "SkSurface.h"
17 17
18 #include "WindowContext.h" 18 #include "WindowContext.h"
19 19
20 class GrContext; 20 class GrContext;
21 21
22 namespace sk_app { 22 namespace sk_app {
23 23
24 class GLWindowContext : public WindowContext { 24 class GLWindowContext : public WindowContext {
25 public: 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; 26 sk_sp<SkSurface> getBackbufferSurface() override;
30 27
31 bool isValid() override { return SkToBool(fBackendContext.get()); } 28 bool isValid() override { return SkToBool(fBackendContext.get()); }
32 29
33 void resize(uint32_t w, uint32_t h) override; 30 void resize(uint32_t w, uint32_t h) override;
34 void swapBuffers() override; 31 void swapBuffers() override;
35 32
36 void setDisplayParams(const DisplayParams& params) override; 33 void setDisplayParams(const DisplayParams& params) override;
37 34
38 GrBackendContext getBackendContext() override { 35 GrBackendContext getBackendContext() override {
39 return (GrBackendContext) fBackendContext.get(); 36 return (GrBackendContext) fBackendContext.get();
40 } 37 }
41 38
42 protected: 39 protected:
43 GLWindowContext(void*, const DisplayParams&); 40 GLWindowContext(const DisplayParams&);
44 void initializeContext(void*, const DisplayParams&); 41 // This should be called by subclass constructor. It is also called when win dow/display
45 virtual void onInitializeContext(void*, const DisplayParams&) = 0; 42 // parameters change. This will in turn call onInitializeContext().
43 void initializeContext();
44 virtual void onInitializeContext() = 0;
45
46 // This should be called by subclass destructor. It is also called when wind ow/display
47 // parameters change prior to initializing a new GL context. This will in tu rn call
48 // onDestroyContext().
46 void destroyContext(); 49 void destroyContext();
47 virtual void onDestroyContext() = 0; 50 virtual void onDestroyContext() = 0;
51
48 virtual void onSwapBuffers() = 0; 52 virtual void onSwapBuffers() = 0;
49 53
50 SkAutoTUnref<const GrGLInterface> fBackendContext; 54 SkAutoTUnref<const GrGLInterface> fBackendContext;
51 sk_sp<GrRenderTarget> fRenderTarget; 55 sk_sp<GrRenderTarget> fRenderTarget;
52 sk_sp<SkSurface> fSurface; 56 sk_sp<SkSurface> fSurface;
53 57
54 // parameters obtained from the native window 58 // parameters obtained from the native window
55 // Note that the platform .cpp file is responsible for 59 // Note that the platform .cpp file is responsible for
56 // initializing fSampleCount, fStencilBits, and fColorBits! 60 // initializing fSampleCount, fStencilBits, and fColorBits!
57 int fSampleCount; 61 int fSampleCount;
58 int fStencilBits; 62 int fStencilBits;
59 int fColorBits; 63 int fColorBits;
60 int fActualColorBits; 64 int fActualColorBits;
61 }; 65 };
62 66
63 } // namespace sk_app 67 } // namespace sk_app
64 68
65 #endif 69 #endif
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkBackendContext.cpp ('k') | tools/viewer/sk_app/GLWindowContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698