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

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

Issue 173023005: Adds support for capturing a sub rect of the compositing surface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to reland Created 6 years, 10 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 43e166f29315f087a54e727f25df9e4b0ea218f8..df8988f9b6bd9812907efa8baa47058937238c95 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
@@ -27,7 +27,6 @@ import android.provider.Settings;
import android.text.Editable;
import android.text.TextUtils;
import android.util.Log;
-import android.util.Pair;
import android.view.ActionMode;
import android.view.HapticFeedbackConstants;
import android.view.InputDevice;
@@ -1035,58 +1034,6 @@ public class ContentViewCore
return mRenderCoordinates.getContentWidthCss();
}
- public Bitmap getBitmap() {
- return getBitmap(getViewportWidthPix(), getViewportHeightPix());
- }
-
- public Bitmap getBitmap(int width, int height) {
- if (width == 0 || height == 0
- || getViewportWidthPix() == 0 || getViewportHeightPix() == 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.getChildCount() > 0) {
- Canvas c = new Canvas(b);
- c.scale(width / (float) getViewportWidthPix(),
- height / (float) getViewportHeightPix());
- mContainerView.draw(c);
- }
- return b;
- }
-
- return null;
- }
-
- /**
- * Generates a bitmap of the content that is performance optimized based on capture time.
- *
- * <p>
- * To have a consistent capture time across devices, we will scale down the captured bitmap
- * where necessary to reduce the time to generate the bitmap.
- *
- * @param width The width of the content to be captured.
- * @param height The height of the content to be captured.
- * @return A pair of the generated bitmap, and the scale that needs to be applied to return the
- * bitmap to it's original size (i.e. if the bitmap is scaled down 50%, this
- * will be 2).
- */
- public Pair<Bitmap, Float> getScaledPerformanceOptimizedBitmap(int width, int height) {
- float scale = 1f;
- // On tablets, always scale down to MDPI for performance reasons.
- if (DeviceUtils.isTablet(getContext())) {
- scale = getContext().getResources().getDisplayMetrics().density;
- }
- return Pair.create(
- getBitmap((int) (width / scale), (int) (height / scale)),
- scale);
- }
-
// TODO(teddchoc): Remove all these navigation controller methods from here and have the
// embedders manage it.
/**
@@ -3444,9 +3391,6 @@ public class ContentViewCore
private native boolean nativeOnAnimate(long nativeContentViewCoreImpl, long frameTimeMicros);
- private native boolean nativePopulateBitmapFromCompositor(long nativeContentViewCoreImpl,
- Bitmap bitmap);
-
private native void nativeWasResized(long nativeContentViewCoreImpl);
private native boolean nativeIsRenderWidgetHostViewReady(long nativeContentViewCoreImpl);

Powered by Google App Engine
This is Rietveld 408576698