| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "blimp/client/app/android/blimp_view.h" | 5 #include "blimp/client/app/android/blimp_view.h" |
| 6 | 6 |
| 7 #include <android/native_window_jni.h> | 7 #include <android/native_window_jni.h> |
| 8 | 8 |
| 9 #include "blimp/client/app/android/blimp_client_session_android.h" | 9 #include "blimp/client/app/android/blimp_client_session_android.h" |
| 10 #include "blimp/client/app/android/blimp_compositor_manager_android.h" |
| 10 #include "jni/BlimpView_jni.h" | 11 #include "jni/BlimpView_jni.h" |
| 11 #include "ui/events/android/motion_event_android.h" | 12 #include "ui/events/android/motion_event_android.h" |
| 12 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
| 13 | 14 |
| 14 namespace blimp { | 15 namespace blimp { |
| 15 namespace client { | 16 namespace client { |
| 16 | 17 |
| 17 static jlong Init(JNIEnv* env, | 18 static jlong Init(JNIEnv* env, |
| 18 const JavaParamRef<jobject>& jobj, | 19 const JavaParamRef<jobject>& jobj, |
| 19 const JavaParamRef<jobject>& blimp_client_session, | 20 const JavaParamRef<jobject>& blimp_client_session, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 40 return RegisterNativesImpl(env); | 41 return RegisterNativesImpl(env); |
| 41 } | 42 } |
| 42 | 43 |
| 43 BlimpView::BlimpView(JNIEnv* env, | 44 BlimpView::BlimpView(JNIEnv* env, |
| 44 const JavaParamRef<jobject>& jobj, | 45 const JavaParamRef<jobject>& jobj, |
| 45 const gfx::Size& real_size, | 46 const gfx::Size& real_size, |
| 46 const gfx::Size& size, | 47 const gfx::Size& size, |
| 47 float dp_to_px, | 48 float dp_to_px, |
| 48 RenderWidgetFeature* render_widget_feature) | 49 RenderWidgetFeature* render_widget_feature) |
| 49 : device_scale_factor_(dp_to_px), | 50 : device_scale_factor_(dp_to_px), |
| 50 compositor_manager_( | 51 compositor_manager_(BlimpCompositorManagerAndroid::Create(real_size, |
| 51 BlimpCompositorManagerAndroid::Create(real_size, | 52 size, |
| 52 size, | 53 render_widget_feature)), |
| 53 render_widget_feature, | |
| 54 this)), | |
| 55 current_surface_format_(0), | 54 current_surface_format_(0), |
| 56 window_(gfx::kNullAcceleratedWidget) { | 55 window_(gfx::kNullAcceleratedWidget) { |
| 57 java_obj_.Reset(env, jobj); | 56 java_obj_.Reset(env, jobj); |
| 58 } | 57 } |
| 59 | 58 |
| 60 BlimpView::~BlimpView() { | 59 BlimpView::~BlimpView() { |
| 61 ReleaseAcceleratedWidget(); | 60 ReleaseAcceleratedWidget(); |
| 62 } | 61 } |
| 63 | 62 |
| 64 void BlimpView::Destroy(JNIEnv* env, const JavaParamRef<jobject>& jobj) { | 63 void BlimpView::Destroy(JNIEnv* env, const JavaParamRef<jobject>& jobj) { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 android_button_state, | 167 android_button_state, |
| 169 android_meta_state, | 168 android_meta_state, |
| 170 raw_pos_x - pos_x_0, | 169 raw_pos_x - pos_x_0, |
| 171 raw_pos_y - pos_y_0, | 170 raw_pos_y - pos_y_0, |
| 172 pointer0, | 171 pointer0, |
| 173 pointer1); | 172 pointer1); |
| 174 | 173 |
| 175 return compositor_manager_->OnTouchEvent(event); | 174 return compositor_manager_->OnTouchEvent(event); |
| 176 } | 175 } |
| 177 | 176 |
| 178 void BlimpView::OnSwapBuffersCompleted() { | |
| 179 JNIEnv* env = base::android::AttachCurrentThread(); | |
| 180 Java_BlimpView_onSwapBuffersCompleted(env, java_obj_.obj()); | |
| 181 } | |
| 182 | |
| 183 } // namespace client | 177 } // namespace client |
| 184 } // namespace blimp | 178 } // namespace blimp |
| OLD | NEW |