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

Unified Diff: tools/viewer/sk_app/android/RasterWindowContext_android.h

Issue 2041193004: Implement Raster Backend on Android Viewer App (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: RasterDirect 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698