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

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

Issue 286513002: Revert of Make ContentViewRenderView::CompositeToBitmap not CompositeAndReadback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
130 void ContentViewRenderView::SetOverlayVideoMode( 139 void ContentViewRenderView::SetOverlayVideoMode(
131 JNIEnv* env, jobject obj, bool enabled) { 140 JNIEnv* env, jobject obj, bool enabled) {
132 compositor_->SetHasTransparentBackground(enabled); 141 compositor_->SetHasTransparentBackground(enabled);
133 Java_ContentViewRenderView_requestRender(env, obj); 142 Java_ContentViewRenderView_requestRender(env, obj);
134 } 143 }
135 144
136 void ContentViewRenderView::ScheduleComposite() { 145 void ContentViewRenderView::ScheduleComposite() {
137 JNIEnv* env = base::android::AttachCurrentThread(); 146 JNIEnv* env = base::android::AttachCurrentThread();
138 Java_ContentViewRenderView_requestRender(env, java_obj_.obj()); 147 Java_ContentViewRenderView_requestRender(env, java_obj_.obj());
139 } 148 }
140 149
141 void ContentViewRenderView::OnSwapBuffersPosted() { 150 void ContentViewRenderView::OnSwapBuffersPosted() {
142 buffers_swapped_during_composite_ = true; 151 buffers_swapped_during_composite_ = true;
143 } 152 }
144 153
145 void ContentViewRenderView::OnSwapBuffersCompleted() { 154 void ContentViewRenderView::OnSwapBuffersCompleted() {
146 JNIEnv* env = base::android::AttachCurrentThread(); 155 JNIEnv* env = base::android::AttachCurrentThread();
147 Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_.obj()); 156 Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_.obj());
148 } 157 }
149 158
150 void ContentViewRenderView::InitCompositor() { 159 void ContentViewRenderView::InitCompositor() {
151 if (!compositor_) 160 if (!compositor_)
152 compositor_.reset(Compositor::Create(this, root_window_)); 161 compositor_.reset(Compositor::Create(this, root_window_));
153 } 162 }
154 } // namespace content 163 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698