OLD | NEW |
---|---|
(Empty) | |
1 | |
2 /* | |
3 * Copyright 2016 Google Inc. | |
4 * | |
5 * Use of this source code is governed by a BSD-style license that can be | |
6 * found in the LICENSE file. | |
7 */ | |
8 #ifndef RasterWindowContext_DEFINED | |
9 #define RasterWindowContext_DEFINED | |
10 | |
11 #include <android/native_window_jni.h> | |
12 | |
13 #include "SkImage.h" | |
14 #include "WindowContext.h" | |
15 | |
16 namespace sk_app { | |
17 | |
18 class RasterWindowContext : public WindowContext { | |
19 public: | |
20 sk_sp<SkSurface> getBackbufferSurface() override; | |
21 | |
22 bool isValid() override { return true; } | |
23 | |
24 void resize(uint32_t w, uint32_t h) override { | |
djsollen
2016/06/07 16:05:29
why doesn't the android subclass override this and
liyuqian
2016/06/07 19:19:57
I'm deleting RasterWindowContext since there isn't
| |
25 // Override this in the subclass to allow resize | |
26 SkDEBUGFAIL("Resize is currently unsupported."); | |
27 } | |
28 | |
29 void swapBuffers() override; | |
30 | |
31 void setDisplayParams(const DisplayParams& params) override { | |
32 // Override this in the subclass to allow setDisplayParams in runtime | |
33 SkDEBUGFAIL("setDisplayParams is currently unsupported."); | |
djsollen
2016/06/07 16:05:29
why doesn't the android subclass override this?
liyuqian
2016/06/07 19:19:57
I'm deleting RasterWindowContext since there isn't
| |
34 } | |
35 | |
36 GrBackendContext getBackendContext() override { return (GrBackendContext) nu llptr; } | |
djsollen
2016/06/07 16:05:29
no need to cast the nullptr
liyuqian
2016/06/07 19:19:57
If not, it won't compile...
| |
37 | |
38 protected: | |
39 // Make sure the the subclass will initialize fDisplayParams. | |
40 // The subclass shall also set fWidth, fHeight in their constructions. | |
41 RasterWindowContext(const DisplayParams& params) { | |
42 fDisplayParams = params; | |
43 } | |
44 | |
45 bool isGpuContext() override { return false; } | |
46 | |
47 SkImageInfo getImageInfo(); | |
djsollen
2016/06/07 16:05:29
remove this function.
liyuqian
2016/06/07 19:19:57
Removed. Previously, we need this because of some
| |
48 | |
49 // The only method required to be implemented in the subclass | |
50 virtual void onSwapBuffers(sk_sp<SkImage> image) = 0; | |
51 | |
52 private: | |
53 sk_sp<SkSurface> fBackbufferSurface = nullptr; | |
djsollen
2016/06/07 16:05:29
we shouldn't need to store this.
liyuqian
2016/06/07 19:19:57
We need to store this because one might call getBa
| |
54 }; | |
55 | |
56 } // namespace sk_app | |
57 | |
58 #endif | |
OLD | NEW |