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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/shapedetection/TextDetectionImpl.java

Issue 2629433003: ShapeDetection: use mojom::Bitmap for mojo interface. (Closed)
Patch Set: ShapeDetection: use mojom::Bitmap for mojo interface. Created 3 years, 11 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: chrome/android/java/src/org/chromium/chrome/browser/shapedetection/TextDetectionImpl.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/shapedetection/TextDetectionImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/shapedetection/TextDetectionImpl.java
index b6f541c20a974b2b71230a9ed8905ddfc0f98b7a..67cc2c7c1d748c7ed1926a54e874af25a58cd37e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/shapedetection/TextDetectionImpl.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/shapedetection/TextDetectionImpl.java
@@ -18,8 +18,6 @@ import org.chromium.chrome.browser.externalauth.ExternalAuthUtils;
import org.chromium.chrome.browser.externalauth.UserRecoverableErrorHandler;
import org.chromium.gfx.mojom.RectF;
import org.chromium.mojo.system.MojoException;
-import org.chromium.mojo.system.SharedBufferHandle;
-import org.chromium.mojo.system.SharedBufferHandle.MapFlags;
import org.chromium.shape_detection.mojom.TextDetection;
import org.chromium.shape_detection.mojom.TextDetectionResult;
@@ -40,8 +38,7 @@ public class TextDetectionImpl implements TextDetection {
}
@Override
- public void detect(
- SharedBufferHandle frameData, int width, int height, DetectResponse callback) {
+ public void detect(org.chromium.skia.mojom.Bitmap bitmapData, DetectResponse callback) {
if (!ExternalAuthUtils.getInstance().canUseGooglePlayServices(
mContext, new UserRecoverableErrorHandler.Silent())) {
Log.e(TAG, "Google Play Services not available");
@@ -58,9 +55,12 @@ public class TextDetectionImpl implements TextDetection {
return;
}
+ int width = bitmapData.width;
+ int height = bitmapData.height;
final long numPixels = (long) width * height;
// TODO(xianglu): https://crbug.com/670028 homogeneize overflow checking.
- if (!frameData.isValid() || width <= 0 || height <= 0 || numPixels > (Long.MAX_VALUE / 4)) {
+ if (bitmapData.pixelData == null || width <= 0 || height <= 0
+ || numPixels > (Long.MAX_VALUE / 4)) {
callback.call(new TextDetectionResult[0]);
return;
}
@@ -68,7 +68,7 @@ public class TextDetectionImpl implements TextDetection {
// Mapping |frameData| will fail if the intended mapped size is larger
// than its actual capacity, which is limited by the appropriate
// mojo::edk::Configuration entry.
- ByteBuffer imageBuffer = frameData.map(0, numPixels * 4, MapFlags.none());
+ ByteBuffer imageBuffer = ByteBuffer.wrap(bitmapData.pixelData);
if (imageBuffer.capacity() <= 0) {
callback.call(new TextDetectionResult[0]);
return;

Powered by Google App Engine
This is Rietveld 408576698