| 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 "chrome/browser/android/compositor/compositor_view.h" | 5 #include "chrome/browser/android/compositor/compositor_view.h" |
| 6 | 6 |
| 7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
| 8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 current_surface_format_ = format; | 155 current_surface_format_ = format; |
| 156 compositor_->SetSurface(surface); | 156 compositor_->SetSurface(surface); |
| 157 } | 157 } |
| 158 gfx::Size size = gfx::Size(width, height); | 158 gfx::Size size = gfx::Size(width, height); |
| 159 compositor_->SetWindowBounds(size); | 159 compositor_->SetWindowBounds(size); |
| 160 content_width_ = size.width(); | 160 content_width_ = size.width(); |
| 161 content_height_ = size.height(); | 161 content_height_ = size.height(); |
| 162 root_layer_->SetBounds(gfx::Size(content_width_, content_height_)); | 162 root_layer_->SetBounds(gfx::Size(content_width_, content_height_)); |
| 163 } | 163 } |
| 164 | 164 |
| 165 void CompositorView::SetLayoutViewport(JNIEnv* env, | 165 void CompositorView::SetLayoutBounds(JNIEnv* env, |
| 166 const JavaParamRef<jobject>& object, | 166 const JavaParamRef<jobject>& object) { |
| 167 jfloat x, | |
| 168 jfloat y, | |
| 169 jfloat width, | |
| 170 jfloat height, | |
| 171 jfloat visible_x_offset, | |
| 172 jfloat visible_y_offset, | |
| 173 jfloat dp_to_pixel) { | |
| 174 compositor_->setDeviceScaleFactor(dp_to_pixel); | |
| 175 root_layer_->SetBounds(gfx::Size(content_width_, content_height_)); | 167 root_layer_->SetBounds(gfx::Size(content_width_, content_height_)); |
| 176 } | 168 } |
| 177 | 169 |
| 178 void CompositorView::SetBackground(bool visible, SkColor color) { | 170 void CompositorView::SetBackground(bool visible, SkColor color) { |
| 179 if (overlay_video_mode_) | 171 if (overlay_video_mode_) |
| 180 visible = false; | 172 visible = false; |
| 181 root_layer_->SetBackgroundColor(color); | 173 root_layer_->SetBackgroundColor(color); |
| 182 root_layer_->SetIsDrawable(visible); | 174 root_layer_->SetIsDrawable(visible); |
| 183 } | 175 } |
| 184 | 176 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 // The Android TERMINATION_STATUS_OOM_PROTECTED hack causes us to never go | 253 // The Android TERMINATION_STATUS_OOM_PROTECTED hack causes us to never go |
| 262 // through here but through BrowserChildProcessHostDisconnected() instead. | 254 // through here but through BrowserChildProcessHostDisconnected() instead. |
| 263 } | 255 } |
| 264 | 256 |
| 265 // Register native methods | 257 // Register native methods |
| 266 bool RegisterCompositorView(JNIEnv* env) { | 258 bool RegisterCompositorView(JNIEnv* env) { |
| 267 return RegisterNativesImpl(env); | 259 return RegisterNativesImpl(env); |
| 268 } | 260 } |
| 269 | 261 |
| 270 } // namespace android | 262 } // namespace android |
| OLD | NEW |