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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java

Issue 11234008: Enable texture readback support for Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
index 040baab5e84f6ec863dd8555b006dddc72fe21d5..ae3046a2f5c4d61603f3ce498af9d83609bbdbcd 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
@@ -710,11 +710,23 @@ public class ContentViewCore implements MotionEventDelegate {
}
public Bitmap getBitmap(int width, int height) {
- return getBitmap(width, height, Bitmap.Config.ARGB_8888);
- }
+ if (getWidth() == 0 || getHeight() == 0) return null;
+
+ Bitmap b = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
+
+ if (mNativeContentViewCore != 0 &&
+ nativePopulateBitmapFromCompositor(mNativeContentViewCore, b)) {
+ // If we successfully grabbed a bitmap, check if we have to draw the Android overlay
+ // components as well.
+ if (mContainerView.getParent() != null &&
+ mContainerView.getVisibility() == View.VISIBLE) {
+ Canvas c = new Canvas(b);
+ c.scale(width / (float) getWidth(), height / (float) getHeight());
+ mContainerView.draw(c);
+ }
+ return b;
+ }
- public Bitmap getBitmap(int width, int height, Bitmap.Config config) {
- // TODO(nileshagrawal): Implement this.
return null;
}
@@ -2198,4 +2210,7 @@ public class ContentViewCore implements MotionEventDelegate {
private native void nativeUpdateVSyncParameters(int nativeContentViewCoreImpl,
long timebaseMicros, long intervalMicros);
+
+ private native boolean nativePopulateBitmapFromCompositor(int nativeContentViewCoreImpl,
+ Bitmap bitmap);
}

Powered by Google App Engine
This is Rietveld 408576698