| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/android/content_view_render_view.h" | 5 #include "content/browser/android/content_view_render_view.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 jboolean ContentViewRenderView::CompositeToBitmap(JNIEnv* env, jobject obj, | 93 jboolean ContentViewRenderView::CompositeToBitmap(JNIEnv* env, jobject obj, |
| 94 jobject java_bitmap) { | 94 jobject java_bitmap) { |
| 95 gfx::JavaBitmap bitmap(java_bitmap); | 95 gfx::JavaBitmap bitmap(java_bitmap); |
| 96 if (!compositor_ || bitmap.format() != ANDROID_BITMAP_FORMAT_RGBA_8888) | 96 if (!compositor_ || bitmap.format() != ANDROID_BITMAP_FORMAT_RGBA_8888) |
| 97 return false; | 97 return false; |
| 98 return compositor_->CompositeAndReadback(bitmap.pixels(), | 98 return compositor_->CompositeAndReadback(bitmap.pixels(), |
| 99 gfx::Rect(bitmap.size())); | 99 gfx::Rect(bitmap.size())); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void ContentViewRenderView::SetOverlayVideoMode( |
| 103 JNIEnv* env, jobject obj, bool enabled) { |
| 104 compositor_->SetHasTransparentBackground(enabled); |
| 105 Java_ContentViewRenderView_requestRender(env, obj); |
| 106 } |
| 107 |
| 102 void ContentViewRenderView::ScheduleComposite() { | 108 void ContentViewRenderView::ScheduleComposite() { |
| 103 JNIEnv* env = base::android::AttachCurrentThread(); | 109 JNIEnv* env = base::android::AttachCurrentThread(); |
| 104 Java_ContentViewRenderView_requestRender(env, java_obj_.obj()); | 110 Java_ContentViewRenderView_requestRender(env, java_obj_.obj()); |
| 105 } | 111 } |
| 106 | 112 |
| 107 void ContentViewRenderView::OnSwapBuffersPosted() { | 113 void ContentViewRenderView::OnSwapBuffersPosted() { |
| 108 buffers_swapped_during_composite_ = true; | 114 buffers_swapped_during_composite_ = true; |
| 109 } | 115 } |
| 110 | 116 |
| 111 void ContentViewRenderView::OnSwapBuffersCompleted() { | 117 void ContentViewRenderView::OnSwapBuffersCompleted() { |
| 112 JNIEnv* env = base::android::AttachCurrentThread(); | 118 JNIEnv* env = base::android::AttachCurrentThread(); |
| 113 Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_.obj()); | 119 Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_.obj()); |
| 114 } | 120 } |
| 115 | 121 |
| 116 void ContentViewRenderView::InitCompositor() { | 122 void ContentViewRenderView::InitCompositor() { |
| 117 if (!compositor_) | 123 if (!compositor_) |
| 118 compositor_.reset(Compositor::Create(this, root_window_)); | 124 compositor_.reset(Compositor::Create(this, root_window_)); |
| 119 } | 125 } |
| 120 | 126 |
| 121 } // namespace content | 127 } // namespace content |
| OLD | NEW |