OLD | NEW |
---|---|
1 | |
2 /* | 1 /* |
3 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
4 * | 3 * |
5 * 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 |
6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
7 */ | 6 */ |
8 #ifndef RasterWindowContext_android_DEFINED | 7 #ifndef RasterWindowContext_android_DEFINED |
9 #define RasterWindowContext_android_DEFINED | 8 #define RasterWindowContext_android_DEFINED |
10 | 9 |
11 #include <android/native_window_jni.h> | |
12 | 10 |
13 #include "../RasterWindowContext.h" | 11 #include "../RasterWindowContext.h" |
12 #include <X11/Xlib.h> | |
14 | 13 |
15 namespace sk_app { | 14 namespace sk_app { |
16 | 15 |
17 class RasterWindowContext_android : public RasterWindowContext { | 16 class RasterWindowContext_unix : public RasterWindowContext { |
18 public: | 17 public: |
19 friend RasterWindowContext* RasterWindowContext::Create( | 18 static RasterWindowContext* Create(Display*, ::Window, const DisplayParams&) ; |
jvanverth1
2016/07/19 21:18:11
If you include Window_unix.h, I typedef Window as
bsalomon
2016/07/25 19:55:53
Done.
| |
20 void* platformData, const DisplayParams&); | |
21 | 19 |
22 sk_sp<SkSurface> getBackbufferSurface() override; | 20 sk_sp<SkSurface> getBackbufferSurface() override; |
23 void swapBuffers() override; | 21 void swapBuffers() override; |
24 | 22 |
25 bool isValid() override { return SkToBool(fNativeWindow); } | 23 bool isValid() override { return SkToBool(fWindow); } |
26 void resize(uint32_t w, uint32_t h) override; | 24 void resize(uint32_t w, uint32_t h) override; |
27 void setDisplayParams(const DisplayParams& params) override; | 25 void setDisplayParams(const DisplayParams& params) override; |
28 | 26 |
29 private: | 27 private: |
30 RasterWindowContext_android(void* platformData, const DisplayParams& params) ; | 28 RasterWindowContext_unix(Display*, ::Window, const DisplayParams&); |
31 void setBuffersGeometry(); | 29 |
32 sk_sp<SkSurface> fBackbufferSurface = nullptr; | 30 sk_sp<SkSurface> fBackbufferSurface = nullptr; |
33 ANativeWindow* fNativeWindow = nullptr; | 31 |
34 ANativeWindow_Buffer fBuffer; | 32 Display* fDisplay; |
35 ARect fBounds; | 33 ::Window fWindow; |
34 GC fGC; | |
36 }; | 35 }; |
37 | 36 |
38 } // namespace sk_app | 37 } // namespace sk_app |
39 | 38 |
40 #endif | 39 #endif |
OLD | NEW |