Index: tools/viewer/sk_app/android/RasterWindowContext_android.h |
diff --git a/tools/viewer/sk_app/android/RasterWindowContext_android.h b/tools/viewer/sk_app/android/RasterWindowContext_android.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..027901eafd5612bff336db9b9535aa3cfd73654a |
--- /dev/null |
+++ b/tools/viewer/sk_app/android/RasterWindowContext_android.h |
@@ -0,0 +1,46 @@ |
+ |
+/* |
+ * Copyright 2016 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+#ifndef RasterWindowContext_android_DEFINED |
+#define RasterWindowContext_android_DEFINED |
+ |
+#include <android/native_window_jni.h> |
+ |
+#include "../WindowContext.h" |
+ |
+namespace sk_app { |
+ |
+class RasterWindowContext_android : public WindowContext { |
+public: |
+ RasterWindowContext_android(void* platformData, const DisplayParams& params); |
+ sk_sp<SkSurface> getBackbufferSurface() override; |
+ void swapBuffers() override; |
+ |
+ bool isValid() override { return true; } |
djsollen
2016/06/07 19:31:48
should only return true if fNativeWindow != nullpt
liyuqian
2016/06/07 19:53:02
Done.
|
+ void resize(uint32_t w, uint32_t h) override { |
djsollen
2016/06/07 19:31:48
implement this because I may want to try to use th
liyuqian
2016/06/07 19:53:02
In the next CL.
|
+ SkDEBUGFAIL("Resize is currently unsupported."); |
+ } |
+ void setDisplayParams(const DisplayParams& params) override { |
+ SkDEBUGFAIL("setDisplayParams is currently unsupported."); |
+ } |
+ |
+ // Explicitly convert nullptr to GrBackendContext is needed for compiling |
+ GrBackendContext getBackendContext() override { return (GrBackendContext) nullptr; } |
djsollen
2016/06/07 19:31:48
put in common RasterWindowContext.h
liyuqian
2016/06/07 19:53:02
Done.
|
+ |
+protected: |
djsollen
2016/06/07 19:31:48
put in common RasterWindowContext.h
liyuqian
2016/06/07 19:53:02
Done.
|
+ bool isGpuContext() override { return false; } |
+ |
+private: |
+ sk_sp<SkSurface> fBackbufferSurface = nullptr; |
+ ANativeWindow* fNativeWindow = nullptr; |
+ ANativeWindow_Buffer fBuffer; |
+ ARect fBounds; |
+}; |
+ |
+} // namespace sk_app |
+ |
+#endif |