diff options
| author | Rob Carr <racarr@google.com> | 2017-01-13 21:29:07 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-01-13 21:29:09 +0000 |
| commit | 1ce0793ab4a0d63618f6d18d74687faeb5ecc57e (patch) | |
| tree | 747a9261a316eac59c7825e5a8bbc9a5eefc244c /core/java | |
| parent | c854415223d2a1b894461ac4433d38bf1ad340a3 (diff) | |
| parent | 6486d31dcbffb7179127a72ceefa11a1e726271f (diff) | |
Merge "Expose SurfaceControl method to screenshot to GraphicBuffer."
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/view/SurfaceControl.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java index b87250e5f131..a12600a0d4e2 100644 --- a/core/java/android/view/SurfaceControl.java +++ b/core/java/android/view/SurfaceControl.java @@ -17,6 +17,7 @@ package android.view; import android.graphics.Bitmap; +import android.graphics.GraphicBuffer; import android.graphics.Rect; import android.graphics.Region; import android.os.IBinder; @@ -42,6 +43,9 @@ public class SurfaceControl { private static native Bitmap nativeScreenshot(IBinder displayToken, Rect sourceCrop, int width, int height, int minLayer, int maxLayer, boolean allLayers, boolean useIdentityTransform, int rotation); + private static native GraphicBuffer nativeScreenshotToBuffer(IBinder displayToken, + Rect sourceCrop, int width, int height, int minLayer, int maxLayer, + boolean allLayers, boolean useIdentityTransform, int rotation); private static native void nativeScreenshot(IBinder displayToken, Surface consumer, Rect sourceCrop, int width, int height, int minLayer, int maxLayer, boolean allLayers, boolean useIdentityTransform); @@ -828,6 +832,19 @@ public class SurfaceControl { } /** + * Like {@link SurfaceControl#screenshot(Rect, int, int, int, int, boolean, int)} + * but returns a GraphicBuffer. + */ + public static GraphicBuffer screenshotToBuffer(Rect sourceCrop, int width, int height, + int minLayer, int maxLayer, boolean useIdentityTransform, + int rotation) { + IBinder displayToken = SurfaceControl.getBuiltInDisplay( + SurfaceControl.BUILT_IN_DISPLAY_ID_MAIN); + return nativeScreenshotToBuffer(displayToken, sourceCrop, width, height, + minLayer, maxLayer, false, useIdentityTransform, rotation); + } + + /** * Like {@link SurfaceControl#screenshot(int, int, int, int, boolean)} but * includes all Surfaces in the screenshot. * |
