| 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);
|
| }
|
|
|