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

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

Issue 1990893002: Revert of Add OpenGL context to Viewer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
« no previous file with comments | « tools/viewer/sk_app/Window.cpp ('k') | tools/viewer/sk_app/android/Window_android.h » ('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 * 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"
14 12
15 class GrContext;
16 class SkSurface; 13 class SkSurface;
17 class GrRenderTarget;
18 14
19 namespace sk_app { 15 namespace sk_app {
20 16
17 // TODO: fill this out with an interface
21 class WindowContext { 18 class WindowContext {
22 public: 19 public:
23 WindowContext() : fContext(nullptr)
24 , fSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType) {}
25
26 virtual ~WindowContext() {} 20 virtual ~WindowContext() {}
27 21
28 virtual sk_sp<SkSurface> getBackbufferSurface() = 0; 22 virtual SkSurface* getBackbufferSurface() = 0;
29 23
30 virtual void swapBuffers() = 0; 24 virtual void swapBuffers() = 0;
31 25
26 virtual bool makeCurrent() = 0;
27
32 virtual bool isValid() = 0; 28 virtual bool isValid() = 0;
33 29
34 virtual void resize(uint32_t w, uint32_t h) = 0; 30 virtual void resize(uint32_t w, uint32_t h) = 0;
35 31
36 const DisplayParams& getDisplayParams() { return fDisplayParams; } 32 virtual const DisplayParams& getDisplayParams() = 0;
37 virtual void setDisplayParams(const DisplayParams& params) = 0; 33 virtual void setDisplayParams(const DisplayParams& params) = 0;
38 34
39 SkSurfaceProps getSurfaceProps() const { return fSurfaceProps; }
40 void setSurfaceProps(const SkSurfaceProps& props) {
41 fSurfaceProps = props;
42 }
43
44 virtual GrBackendContext getBackendContext() = 0; 35 virtual GrBackendContext getBackendContext() = 0;
45
46 sk_sp<SkSurface> createRenderSurface(sk_sp<GrRenderTarget>, int colorBits);
47 void presentRenderSurface(sk_sp<SkSurface> renderSurface, sk_sp<GrRenderTarg et> rt,
48 int colorBits);
49
50 protected:
51 virtual bool isGpuContext() { return true; }
52
53 GrContext* fContext;
54
55 int fWidth;
56 int fHeight;
57 DisplayParams fDisplayParams;
58 GrPixelConfig fPixelConfig;
59 SkSurfaceProps fSurfaceProps;
60 }; 36 };
61 37
62 } // namespace sk_app 38 } // namespace sk_app
63 39
64 #endif 40 #endif
OLDNEW
« no previous file with comments | « tools/viewer/sk_app/Window.cpp ('k') | tools/viewer/sk_app/android/Window_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698