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

Side by Side Diff: content/browser/android/content_view_render_view.cc

Issue 270933002: Make ContentViewRenderView::CompositeToBitmap not CompositeAndReadback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: contentviewrenderview: Created 6 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 | Annotate | Revision Log
OLDNEW
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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 jboolean ContentViewRenderView::Composite(JNIEnv* env, jobject obj) { 121 jboolean ContentViewRenderView::Composite(JNIEnv* env, jobject obj) {
122 if (!compositor_) 122 if (!compositor_)
123 return false; 123 return false;
124 124
125 buffers_swapped_during_composite_ = false; 125 buffers_swapped_during_composite_ = false;
126 compositor_->Composite(); 126 compositor_->Composite();
127 return buffers_swapped_during_composite_; 127 return buffers_swapped_during_composite_;
128 } 128 }
129 129
130 jboolean ContentViewRenderView::CompositeToBitmap(JNIEnv* env, jobject obj,
131 jobject java_bitmap) {
132 gfx::JavaBitmap bitmap(java_bitmap);
133 if (!compositor_ || bitmap.format() != ANDROID_BITMAP_FORMAT_RGBA_8888)
134 return false;
135 return compositor_->CompositeAndReadback(bitmap.pixels(),
136 gfx::Rect(bitmap.size()));
137 }
138
139 void ContentViewRenderView::SetOverlayVideoMode( 130 void ContentViewRenderView::SetOverlayVideoMode(
140 JNIEnv* env, jobject obj, bool enabled) { 131 JNIEnv* env, jobject obj, bool enabled) {
141 compositor_->SetHasTransparentBackground(enabled); 132 compositor_->SetHasTransparentBackground(enabled);
142 Java_ContentViewRenderView_requestRender(env, obj); 133 Java_ContentViewRenderView_requestRender(env, obj);
143 } 134 }
144 135
145 void ContentViewRenderView::ScheduleComposite() { 136 void ContentViewRenderView::ScheduleComposite() {
146 JNIEnv* env = base::android::AttachCurrentThread(); 137 JNIEnv* env = base::android::AttachCurrentThread();
147 Java_ContentViewRenderView_requestRender(env, java_obj_.obj()); 138 Java_ContentViewRenderView_requestRender(env, java_obj_.obj());
148 } 139 }
149 140
150 void ContentViewRenderView::OnSwapBuffersPosted() { 141 void ContentViewRenderView::OnSwapBuffersPosted() {
151 buffers_swapped_during_composite_ = true; 142 buffers_swapped_during_composite_ = true;
152 } 143 }
153 144
154 void ContentViewRenderView::OnSwapBuffersCompleted() { 145 void ContentViewRenderView::OnSwapBuffersCompleted() {
155 JNIEnv* env = base::android::AttachCurrentThread(); 146 JNIEnv* env = base::android::AttachCurrentThread();
156 Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_.obj()); 147 Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_.obj());
157 } 148 }
158 149
159 void ContentViewRenderView::InitCompositor() { 150 void ContentViewRenderView::InitCompositor() {
160 if (!compositor_) 151 if (!compositor_)
161 compositor_.reset(Compositor::Create(this, root_window_)); 152 compositor_.reset(Compositor::Create(this, root_window_));
162 } 153 }
163 } // namespace content 154 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698