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

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

Issue 1978573003: Add OpenGL context to Viewer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix Android stuff Created 4 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #ifndef WindowContext_DEFINED 7 #ifndef WindowContext_DEFINED
8 #define WindowContext_DEFINED 8 #define WindowContext_DEFINED
9 9
10 #include "DisplayParams.h" 10 #include "DisplayParams.h"
11 #include "GrTypes.h" 11 #include "GrTypes.h"
12 #include "SkRefCnt.h"
13 #include "SkSurfaceProps.h"
12 14
15 class GrContext;
13 class SkSurface; 16 class SkSurface;
14 17
15 namespace sk_app { 18 namespace sk_app {
16 19
17 // TODO: fill this out with an interface
18 class WindowContext { 20 class WindowContext {
19 public: 21 public:
22 WindowContext() : fContext(nullptr)
23 , fSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType) {}
24
20 virtual ~WindowContext() {} 25 virtual ~WindowContext() {}
21 26
22 virtual SkSurface* getBackbufferSurface() = 0; 27 virtual sk_sp<SkSurface> getBackbufferSurface() = 0;
23 28
24 virtual void swapBuffers() = 0; 29 virtual void swapBuffers() = 0;
25 30
26 virtual bool makeCurrent() = 0;
27
28 virtual bool isValid() = 0; 31 virtual bool isValid() = 0;
29 32
30 virtual void resize(uint32_t w, uint32_t h) = 0; 33 virtual void resize(uint32_t w, uint32_t h) = 0;
31 34
32 virtual const DisplayParams& getDisplayParams() = 0; 35 virtual const DisplayParams& getDisplayParams() = 0;
33 virtual void setDisplayParams(const DisplayParams& params) = 0; 36 virtual void setDisplayParams(const DisplayParams& params) = 0;
34 37
35 virtual GrBackendContext getBackendContext() = 0; 38 virtual GrBackendContext getBackendContext() = 0;
39
40 protected:
41 GrContext* fContext;
42
43 DisplayParams fDisplayParams;
44 GrPixelConfig fPixelConfig;
45 SkSurfaceProps fSurfaceProps;
36 }; 46 };
37 47
38 } // namespace sk_app 48 } // namespace sk_app
39 49
40 #endif 50 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698