Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * 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 |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef Window_android_DEFINED | 8 #ifndef Window_android_DEFINED |
| 9 #define Window_android_DEFINED | 9 #define Window_android_DEFINED |
| 10 | 10 |
| 11 #include "../Window.h" | 11 #include "../Window.h" |
| 12 #include <android_native_app_glue.h> | 12 #include "surface_glue_android.h" |
| 13 | 13 |
| 14 namespace sk_app { | 14 namespace sk_app { |
| 15 | 15 |
| 16 enum { | |
| 17 /** | |
| 18 * Leave plenty of space between this item and the ones defined in the glue layer | |
| 19 */ | |
| 20 APP_CMD_INVAL_WINDOW = 64, | |
| 21 }; | |
| 22 | |
| 23 class Window_android : public Window { | 16 class Window_android : public Window { |
| 24 public: | 17 public: |
| 25 Window_android() : Window() {} | 18 Window_android() : Window() {} |
| 26 ~Window_android() override {} | 19 ~Window_android() override {} |
| 27 | 20 |
| 28 bool init(android_app* app_state); | 21 bool init(SkiaAndroidApp* skiaAndroidApp); |
| 29 void initDisplay(ANativeWindow* window); | 22 void initDisplay(ANativeWindow* window); |
| 23 void onDisplayDestroyed(); | |
| 30 | 24 |
| 31 void setTitle(const char*) override; | 25 void setTitle(const char*) override; |
| 32 void show() override {} | 26 void show() override {} |
| 33 | 27 |
| 34 bool attach(BackEndType attachType, int msaaSampleCount, bool deepColor) ove rride; | 28 bool attach(BackEndType attachType, int msaaSampleCount) override; |
| 35 void inval() override; | 29 void inval() override; |
| 36 | 30 |
| 37 void paintIfNeeded(); | 31 void paintIfNeeded(); |
|
djsollen
2016/05/09 13:17:14
remove this method.
liyuqian
2016/05/09 14:27:27
Done.
| |
| 38 | 32 |
| 39 bool scaleContentToFit() const override { return true; } | 33 bool scaleContentToFit() const override { return true; } |
| 40 bool supportsContentRect() const override { return true; } | 34 bool supportsContentRect() const override { return true; } |
| 41 SkRect getContentRect() override { return mContentRect; } | 35 SkRect getContentRect() override { return mContentRect; } |
| 42 void setContentRect(int l, int t, int r, int b) { mContentRect.set(l,t,r,b); } | 36 void setContentRect(int l, int t, int r, int b) { mContentRect.set(l,t,r,b); } |
| 43 | 37 |
| 44 private: | 38 private: |
| 45 android_app* mApp = nullptr; | 39 SkiaAndroidApp* fSkiaAndroidApp = nullptr; |
| 46 SkRect mContentRect; | 40 SkRect mContentRect; |
|
djsollen
2016/05/09 13:17:14
fContentRect and fSampleCount
liyuqian
2016/05/09 14:27:27
Done.
| |
| 47 int mSampleCount = 0; | 41 int mSampleCount = 0; |
| 42 bool fNativeWindowInitialized = false; | |
|
djsollen
2016/05/09 13:17:14
make this a field on SkiaAndroidApp
liyuqian
2016/05/09 14:27:27
This field is no longer needed as we moved paintIf
| |
| 48 }; | 43 }; |
| 49 | 44 |
| 50 } // namespace sk_app | 45 } // namespace sk_app |
| 51 | 46 |
| 52 #endif | 47 #endif |
| OLD | NEW |