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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/shapedetection/FaceDetectionImpl.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: content/public/android/java/src/org/chromium/content/browser/shapedetection/FaceDetectionImpl.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/shapedetection/FaceDetectionImpl.java b/content/public/android/java/src/org/chromium/content/browser/shapedetection/FaceDetectionImpl.java
index 17ff5506fbb5d171d838b16d1d25147d0d52b0c0..14272fe4c7839e4ff7f250c1e03ddadd1c9a841e 100644
--- a/content/public/android/java/src/org/chromium/content/browser/shapedetection/FaceDetectionImpl.java
+++ b/content/public/android/java/src/org/chromium/content/browser/shapedetection/FaceDetectionImpl.java
@@ -12,8 +12,6 @@ import android.media.FaceDetector.Face;
import org.chromium.base.Log;
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.FaceDetection;
import org.chromium.shape_detection.mojom.FaceDetectionResult;
import org.chromium.shape_detection.mojom.FaceDetectorOptions;
@@ -36,19 +34,21 @@ public class FaceDetectionImpl implements FaceDetection {
}
@Override
- public void detect(
- SharedBufferHandle frameData, int width, int height, DetectResponse callback) {
+ public void detect(org.chromium.skia.mojom.Bitmap bitmapData, DetectResponse callback) {
+ 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)) {
Log.d(TAG, "Invalid argument(s).");
callback.call(new FaceDetectionResult());
return;
}
- ByteBuffer imageBuffer = frameData.map(0, numPixels * 4, MapFlags.none());
+ ByteBuffer imageBuffer = ByteBuffer.wrap(bitmapData.pixelData);
if (imageBuffer.capacity() <= 0) {
- Log.d(TAG, "Failed to map from SharedBufferHandle.");
+ Log.d(TAG, "Failed to wrap from Bitmap.");
callback.call(new FaceDetectionResult());
return;
}

Powered by Google App Engine
This is Rietveld 408576698