1 /* 2 * Copyright 2016 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef Window_android_DEFINED 9 #define Window_android_DEFINED 10 11 #include "../Window.h" 12 #include "surface_glue_android.h" 13 14 namespace sk_app { 15 16 class Window_android : public Window { 17 public: Window_android()18 Window_android() : Window() {} ~Window_android()19 ~Window_android() override {} 20 21 bool init(SkiaAndroidApp* skiaAndroidApp); 22 void initDisplay(ANativeWindow* window); 23 void onDisplayDestroyed(); 24 25 void setTitle(const char*) override; show()26 void show() override {} 27 28 bool attach(BackendType) override; 29 void onInval() override; 30 void setUIState(const Json::Value& state) override; 31 32 void paintIfNeeded(); 33 scaleContentToFit()34 bool scaleContentToFit() const override { return true; } supportsContentRect()35 bool supportsContentRect() const override { return true; } getContentRect()36 SkRect getContentRect() override { return fContentRect; } setContentRect(int l,int t,int r,int b)37 void setContentRect(int l, int t, int r, int b) { fContentRect.set(l,t,r,b); } 38 39 private: 40 SkiaAndroidApp* fSkiaAndroidApp = nullptr; 41 SkRect fContentRect; 42 BackendType fBackendType; 43 }; 44 45 } // namespace sk_app 46 47 #endif 48