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

Side by Side Diff: tools/viewer/sk_app/android/Window_android.h

Issue 1952323004: Initial commit of our new Android app to demo Skia. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Style Created 4 years, 7 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 unified diff | Download patch
OLDNEW
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 <android_native_app_glue.h>
djsollen 2016/05/06 18:45:26 remove this and all references to android_app*
liyuqian 2016/05/06 20:42:30 Done.
11 #include "../Window.h" 12 #include "../Window.h"
12 #include <android_native_app_glue.h> 13 #include "surface_glue_android.h"
13 14
14 namespace sk_app { 15 namespace sk_app {
15 16
16 enum { 17 enum {
17 /** 18 /**
18 * Leave plenty of space between this item and the ones defined in the glue layer 19 * Leave plenty of space between this item and the ones defined in the glue layer
19 */ 20 */
20 APP_CMD_INVAL_WINDOW = 64, 21 APP_CMD_INVAL_WINDOW = 64,
djsollen 2016/05/06 18:45:26 make this on of the MessageTypes in the surface gl
liyuqian 2016/05/06 20:42:30 Done.
21 }; 22 };
22 23
23 class Window_android : public Window { 24 class Window_android : public Window {
24 public: 25 public:
25 Window_android() : Window() {} 26 Window_android() : Window() {}
26 ~Window_android() override {} 27 ~Window_android() override {}
27 28
28 bool init(android_app* app_state); 29 bool init(android_app* app_state);
30 bool init(AppThread* appThread);
29 void initDisplay(ANativeWindow* window); 31 void initDisplay(ANativeWindow* window);
30 32
31 void setTitle(const char*) override; 33 void setTitle(const char*) override;
32 void show() override {} 34 void show() override {}
33 35
34 bool attach(BackEndType attachType, int msaaSampleCount, bool deepColor) ove rride; 36 bool attach(BackEndType attachType, int msaaSampleCount) override;
35 void inval() override; 37 void inval() override;
36 38
37 void paintIfNeeded(); 39 void paintIfNeeded();
38 40
39 bool scaleContentToFit() const override { return true; } 41 bool scaleContentToFit() const override { return true; }
40 bool supportsContentRect() const override { return true; } 42 bool supportsContentRect() const override { return true; }
41 SkRect getContentRect() override { return mContentRect; } 43 SkRect getContentRect() override { return mContentRect; }
42 void setContentRect(int l, int t, int r, int b) { mContentRect.set(l,t,r,b); } 44 void setContentRect(int l, int t, int r, int b) { mContentRect.set(l,t,r,b); }
43 45
44 private: 46 private:
45 android_app* mApp = nullptr; 47 android_app* mApp = nullptr;
48 AppThread* mAppThread = nullptr;
46 SkRect mContentRect; 49 SkRect mContentRect;
47 int mSampleCount = 0; 50 int mSampleCount = 0;
51 bool nativeWindowInitialized = false;
jvanverth1 2016/05/06 17:02:07 We start member variables with 'f', so this should
liyuqian 2016/05/06 20:42:30 Done.
48 }; 52 };
49 53
50 } // namespace sk_app 54 } // namespace sk_app
51 55
52 #endif 56 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698