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

Side by Side Diff: tools/viewer/sk_app/unix/Window_unix.h

Issue 2015213002: Revert of Add OpenGL support to Linux viewer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 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 7
8 #ifndef Window_unix_DEFINED 8 #ifndef Window_unix_DEFINED
9 #define Window_unix_DEFINED 9 #define Window_unix_DEFINED
10 10
11 #include <X11/Xlib.h> 11 #include <X11/Xlib.h>
12 #include <GL/glx.h>
13 #include "../Window.h" 12 #include "../Window.h"
14 #include "SkChecksum.h" 13 #include "SkChecksum.h"
15 #include "SkTDynamicHash.h" 14 #include "SkTDynamicHash.h"
16 15
17 typedef Window XWindow; 16 typedef Window XWindow;
18 17
19 namespace sk_app { 18 namespace sk_app {
20 19
21 struct ContextPlatformData_unix { 20 struct ContextPlatformData_unix {
22 Display* fDisplay; 21 Display* fDisplay;
23 XWindow fWindow; 22 XWindow fHWnd;
24 XVisualInfo* fVisualInfo; 23 VisualID fVisualID;
25 }; 24 };
26 25
27 class Window_unix : public Window { 26 class Window_unix : public Window {
28 public: 27 public:
29 Window_unix() : Window() 28 Window_unix() : Window() {}
30 , fDisplay(nullptr) 29 ~Window_unix() override {}
31 , fWindow(0)
32 , fGC(nullptr)
33 , fVisualInfo(nullptr)
34 , fMSAASampleCount(0) {}
35 ~Window_unix() override { this->closeWindow(); }
36 30
37 bool initWindow(Display* display, const DisplayParams* params); 31 bool init(Display* display);
38 32
39 void setTitle(const char*) override; 33 void setTitle(const char*) override;
40 void show() override; 34 void show() override;
41 35
42 bool attach(BackendType attachType, const DisplayParams& params) override; 36 bool attach(BackendType attachType, const DisplayParams& params) override;
43 37
44 void onInval() override; 38 void onInval() override;
45 39
46 bool handleEvent(const XEvent& event); 40 bool handleEvent(const XEvent& event);
47 41
48 static const XWindow& GetKey(const Window_unix& w) { 42 static const XWindow& GetKey(const Window_unix& w) {
49 return w.fWindow; 43 return w.fHWnd;
50 } 44 }
51 45
52 static uint32_t Hash(const XWindow& w) { 46 static uint32_t Hash(const XWindow& w) {
53 return SkChecksum::Mix(w); 47 return SkChecksum::Mix(w);
54 } 48 }
55 49
56 static SkTDynamicHash<Window_unix, XWindow> gWindowMap; 50 static SkTDynamicHash<Window_unix, XWindow> gWindowMap;
57 51
58 void markPendingPaint() { fPendingPaint = true; } 52 void markPendingPaint() { fPendingPaint = true; }
59 void finishPaint() { 53 void finishPaint() {
60 if (fPendingPaint) { 54 if (fPendingPaint) {
61 this->onPaint(); 55 this->onPaint();
62 fPendingPaint = false; 56 fPendingPaint = false;
63 } 57 }
64 } 58 }
65 59
66 void markPendingResize(int width, int height) { 60 void markPendingResize(int width, int height) {
67 fPendingWidth = width; 61 fPendingWidth = width;
68 fPendingHeight = height; 62 fPendingHeight = height;
69 fPendingResize = true; 63 fPendingResize = true;
70 } 64 }
71 void finishResize() { 65 void finishResize() {
72 if (fPendingResize) { 66 if (fPendingResize) {
73 this->onResize(fPendingWidth, fPendingHeight); 67 this->onResize(fPendingWidth, fPendingHeight);
74 fPendingResize = false; 68 fPendingResize = false;
75 } 69 }
76 } 70 }
77 71
78 private: 72 private:
79 void closeWindow(); 73 Display* fDisplay;
80 74 XWindow fHWnd;
81 Display* fDisplay;
82 XWindow fWindow;
83 GC fGC;
84 XVisualInfo* fVisualInfo;
85 int fMSAASampleCount;
86 75
87 Atom fWmDeleteMessage; 76 Atom fWmDeleteMessage;
88 77
89 bool fPendingPaint; 78 bool fPendingPaint;
90 int fPendingWidth; 79 int fPendingWidth;
91 int fPendingHeight; 80 int fPendingHeight;
92 bool fPendingResize; 81 bool fPendingResize;
93 }; 82 };
94 83
95 } // namespace sk_app 84 } // namespace sk_app
96 85
97 #endif 86 #endif
OLDNEW
« no previous file with comments | « tools/viewer/sk_app/unix/VulkanWindowContext_unix.cpp ('k') | tools/viewer/sk_app/unix/Window_unix.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698