OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef BLIMP_CLIENT_ANDROID_BLIMP_VIEW_H_ | |
6 #define BLIMP_CLIENT_ANDROID_BLIMP_VIEW_H_ | |
7 | |
8 #include "base/android/jni_android.h" | |
9 #include "base/macros.h" | |
10 #include "base/memory/scoped_ptr.h" | |
11 | |
12 namespace gfx { | |
13 class Size; | |
14 } | |
15 | |
16 namespace blimp { | |
17 | |
18 class BlimpCompositorAndroid; | |
19 | |
20 // The native component of org.chromium.blimp.BlimpView. This builds and | |
21 // maintains a BlimpCompositorAndroid and handles notifying the compositor of | |
22 // SurfaceView surface changes (size, creation, destruction, etc.). | |
23 class BlimpView { | |
24 public: | |
25 static bool RegisterJni(JNIEnv* env); | |
26 | |
27 // |real_size| is the total display area including system decorations (see | |
28 // android.view.Display.getRealSize()). |size| is the total display | |
29 // area not including system decorations (see android.view.Display.getSize()). | |
30 // |dp_to_px| is the scale factor that is required to convert dp (device | |
31 // pixels) to px. | |
Wez
2015/09/03 19:56:08
This still describes "dp" as "device pixels", when
| |
32 BlimpView(JNIEnv* env, | |
33 jobject jobj, | |
34 const gfx::Size& real_size, | |
35 const gfx::Size& size, | |
36 float dp_to_px); | |
37 | |
38 // Methods called from Java via JNI. | |
39 void Destroy(JNIEnv* env, jobject jobj); | |
40 void SetNeedsComposite(JNIEnv* env, jobject jobj); | |
41 void OnSurfaceChanged(JNIEnv* env, | |
42 jobject jobj, | |
43 jint format, | |
44 jint width, | |
45 jint height, | |
46 jobject jsurface); | |
47 void OnSurfaceCreated(JNIEnv* env, jobject jobj); | |
48 void OnSurfaceDestroyed(JNIEnv* env, jobject jobj); | |
49 void SetVisibility(JNIEnv* env, jobject jobj, jboolean visible); | |
50 | |
51 private: | |
52 virtual ~BlimpView(); | |
53 | |
54 // Reference to the Java object which owns this class. | |
55 base::android::ScopedJavaGlobalRef<jobject> java_obj_; | |
56 | |
57 scoped_ptr<BlimpCompositorAndroid> compositor_; | |
58 | |
59 // The format of the current surface owned by |compositor_|. See | |
60 // android.graphics.PixelFormat.java. | |
61 int current_surface_format_; | |
62 | |
63 DISALLOW_COPY_AND_ASSIGN(BlimpView); | |
64 }; | |
65 | |
66 } // namespace blimp | |
67 | |
68 #endif // BLIMP_CLIENT_ANDROID_BLIMP_VIEW_H_ | |
OLD | NEW |