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

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

Issue 1950983007: Add sRGB mode toggle to Viewer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Bundle window surface parameters in struct, use SkColorType/SkColorProfileType 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/VulkanWindowContext.cpp ('k') | tools/viewer/sk_app/Window.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 * 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 7
8 #ifndef Window_DEFINED 8 #ifndef Window_DEFINED
9 #define Window_DEFINED 9 #define Window_DEFINED
10 10
11 #include "DisplayParams.h"
11 #include "SkTypes.h" 12 #include "SkTypes.h"
12 #include "SkRect.h" 13 #include "SkRect.h"
13 14
14 class SkCanvas; 15 class SkCanvas;
15 16
16 namespace sk_app { 17 namespace sk_app {
17 18
18 class WindowContext; 19 class WindowContext;
19 20
20 class Window { 21 class Window {
21 public: 22 public:
22 static Window* CreateNativeWindow(void* platformData); 23 static Window* CreateNativeWindow(void* platformData);
23 24
24 virtual ~Window() {}; 25 virtual ~Window() {};
25 26
26 virtual void setTitle(const char*) = 0; 27 virtual void setTitle(const char*) = 0;
27 virtual void show() = 0; 28 virtual void show() = 0;
28 virtual void inval() = 0; 29 virtual void inval() = 0;
29 30
30 virtual bool scaleContentToFit() const { return false; } 31 virtual bool scaleContentToFit() const { return false; }
31 virtual bool supportsContentRect() const { return false; } 32 virtual bool supportsContentRect() const { return false; }
32 virtual SkRect getContentRect() { return SkRect::MakeEmpty(); } 33 virtual SkRect getContentRect() { return SkRect::MakeEmpty(); }
33 34
34 enum BackEndType { 35 enum BackEndType {
35 kNativeGL_BackendType, 36 kNativeGL_BackendType,
36 kVulkan_BackendType 37 kVulkan_BackendType
37 }; 38 };
38 39
39 virtual bool attach(BackEndType attachType, int msaaSampleCount) = 0; 40 virtual bool attach(BackEndType attachType, const DisplayParams& params) = 0;
40 void detach(); 41 void detach();
41 42
42 // input handling 43 // input handling
43 enum Key { 44 enum Key {
44 kNONE_Key, //corresponds to android's UNKNOWN 45 kNONE_Key, //corresponds to android's UNKNOWN
45 46
46 kLeftSoftKey_Key, 47 kLeftSoftKey_Key,
47 kRightSoftKey_Key, 48 kRightSoftKey_Key,
48 49
49 kHome_Key, //!< the home key - added to match android 50 kHome_Key, //!< the home key - added to match android
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 123
123 bool onChar(SkUnichar c, uint32_t modifiers); 124 bool onChar(SkUnichar c, uint32_t modifiers);
124 bool onKey(Key key, InputState state, uint32_t modifiers); 125 bool onKey(Key key, InputState state, uint32_t modifiers);
125 bool onMouse(int x, int y, InputState state, uint32_t modifiers); 126 bool onMouse(int x, int y, InputState state, uint32_t modifiers);
126 void onPaint(); 127 void onPaint();
127 void onResize(uint32_t width, uint32_t height); 128 void onResize(uint32_t width, uint32_t height);
128 129
129 uint32_t width() { return fWidth; } 130 uint32_t width() { return fWidth; }
130 uint32_t height() { return fHeight; } 131 uint32_t height() { return fHeight; }
131 132
133 const DisplayParams& getDisplayParams();
134 void setDisplayParams(const DisplayParams& params);
135
132 protected: 136 protected:
133 Window(); 137 Window();
134 138
135 uint32_t fWidth; 139 uint32_t fWidth;
136 uint32_t fHeight; 140 uint32_t fHeight;
137 141
138 OnCharFunc fCharFunc; 142 OnCharFunc fCharFunc;
139 void* fCharUserData; 143 void* fCharUserData;
140 OnKeyFunc fKeyFunc; 144 OnKeyFunc fKeyFunc;
141 void* fKeyUserData; 145 void* fKeyUserData;
142 OnMouseFunc fMouseFunc; 146 OnMouseFunc fMouseFunc;
143 void* fMouseUserData; 147 void* fMouseUserData;
144 OnPaintFunc fPaintFunc; 148 OnPaintFunc fPaintFunc;
145 void* fPaintUserData; 149 void* fPaintUserData;
146 150
147 WindowContext* fWindowContext; 151 WindowContext* fWindowContext;
148 }; 152 };
149 153
150 } // namespace sk_app 154 } // namespace sk_app
151 #endif 155 #endif
OLDNEW
« no previous file with comments | « tools/viewer/sk_app/VulkanWindowContext.cpp ('k') | tools/viewer/sk_app/Window.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698