Loading core/java/android/view/SurfaceControl.java +6 −4 Original line number Diff line number Diff line Loading @@ -1149,7 +1149,9 @@ public class SurfaceControl implements Parcelable { } /** * Copy the current screen contents into a bitmap and return it. * Copy the current screen contents into a hardware bitmap and return it. * Note: If you want to modify the Bitmap in software, you will need to copy the Bitmap into * a software Bitmap using {@link Bitmap#copy(Bitmap.Config, boolean)} * * CAVEAT: Versions of screenshot that return a {@link Bitmap} can * be extremely slow; avoid use unless absolutely necessary; prefer Loading @@ -1174,7 +1176,7 @@ public class SurfaceControl implements Parcelable { * screenshots in its native portrait orientation by default, so this is * useful for returning screenshots that are independent of device * orientation. * @return Returns a Bitmap containing the screen contents, or null * @return Returns a hardware Bitmap containing the screen contents, or null * if an error occurs. Make sure to call Bitmap.recycle() as soon as * possible, once its content is not needed anymore. */ Loading Loading @@ -1202,7 +1204,7 @@ public class SurfaceControl implements Parcelable { } /** * Like {@link SurfaceControl#screenshot(int, int, int, int, boolean)} but * Like {@link SurfaceControl#screenshot(Rect, int, int, int, int, boolean, int)} but * includes all Surfaces in the screenshot. This will also update the orientation so it * sends the correct coordinates to SF based on the rotation value. * Loading Loading @@ -1259,7 +1261,7 @@ public class SurfaceControl implements Parcelable { } /** * Captures a layer and its children into the provided {@link Surface}. * Captures a layer and its children and returns a {@link GraphicBuffer} with the content. * * @param layerHandleToken The root layer to capture. * @param sourceCrop The portion of the root surface to capture; caller may pass in 'new Loading packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java +6 −2 Original line number Diff line number Diff line Loading @@ -161,10 +161,14 @@ class SaveImageInBackgroundTask extends AsyncTask<Void, Void, Void> { Matrix matrix = new Matrix(); int overlayColor = 0x40FFFFFF; // Bitmaps created for screenshots are hardware bitmaps. Copy to a software bitmap in order // to update size for previews. Bitmap swBitmap = data.image.copy(Bitmap.Config.ARGB_8888, true); Bitmap picture = Bitmap.createBitmap(previewWidth, previewHeight, Bitmap.Config.ARGB_8888); matrix.setTranslate((previewWidth - mImageWidth) / 2, (previewHeight - mImageHeight) / 2); c.setBitmap(picture); c.drawBitmap(data.image, matrix, paint); c.drawBitmap(swBitmap, matrix, paint); c.drawColor(overlayColor); c.setBitmap(null); Loading @@ -175,7 +179,7 @@ class SaveImageInBackgroundTask extends AsyncTask<Void, Void, Void> { matrix.postTranslate((iconSize - (scale * mImageWidth)) / 2, (iconSize - (scale * mImageHeight)) / 2); c.setBitmap(icon); c.drawBitmap(data.image, matrix, paint); c.drawBitmap(swBitmap, matrix, paint); c.drawColor(overlayColor); c.setBitmap(null); Loading Loading
core/java/android/view/SurfaceControl.java +6 −4 Original line number Diff line number Diff line Loading @@ -1149,7 +1149,9 @@ public class SurfaceControl implements Parcelable { } /** * Copy the current screen contents into a bitmap and return it. * Copy the current screen contents into a hardware bitmap and return it. * Note: If you want to modify the Bitmap in software, you will need to copy the Bitmap into * a software Bitmap using {@link Bitmap#copy(Bitmap.Config, boolean)} * * CAVEAT: Versions of screenshot that return a {@link Bitmap} can * be extremely slow; avoid use unless absolutely necessary; prefer Loading @@ -1174,7 +1176,7 @@ public class SurfaceControl implements Parcelable { * screenshots in its native portrait orientation by default, so this is * useful for returning screenshots that are independent of device * orientation. * @return Returns a Bitmap containing the screen contents, or null * @return Returns a hardware Bitmap containing the screen contents, or null * if an error occurs. Make sure to call Bitmap.recycle() as soon as * possible, once its content is not needed anymore. */ Loading Loading @@ -1202,7 +1204,7 @@ public class SurfaceControl implements Parcelable { } /** * Like {@link SurfaceControl#screenshot(int, int, int, int, boolean)} but * Like {@link SurfaceControl#screenshot(Rect, int, int, int, int, boolean, int)} but * includes all Surfaces in the screenshot. This will also update the orientation so it * sends the correct coordinates to SF based on the rotation value. * Loading Loading @@ -1259,7 +1261,7 @@ public class SurfaceControl implements Parcelable { } /** * Captures a layer and its children into the provided {@link Surface}. * Captures a layer and its children and returns a {@link GraphicBuffer} with the content. * * @param layerHandleToken The root layer to capture. * @param sourceCrop The portion of the root surface to capture; caller may pass in 'new Loading
packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java +6 −2 Original line number Diff line number Diff line Loading @@ -161,10 +161,14 @@ class SaveImageInBackgroundTask extends AsyncTask<Void, Void, Void> { Matrix matrix = new Matrix(); int overlayColor = 0x40FFFFFF; // Bitmaps created for screenshots are hardware bitmaps. Copy to a software bitmap in order // to update size for previews. Bitmap swBitmap = data.image.copy(Bitmap.Config.ARGB_8888, true); Bitmap picture = Bitmap.createBitmap(previewWidth, previewHeight, Bitmap.Config.ARGB_8888); matrix.setTranslate((previewWidth - mImageWidth) / 2, (previewHeight - mImageHeight) / 2); c.setBitmap(picture); c.drawBitmap(data.image, matrix, paint); c.drawBitmap(swBitmap, matrix, paint); c.drawColor(overlayColor); c.setBitmap(null); Loading @@ -175,7 +179,7 @@ class SaveImageInBackgroundTask extends AsyncTask<Void, Void, Void> { matrix.postTranslate((iconSize - (scale * mImageWidth)) / 2, (iconSize - (scale * mImageHeight)) / 2); c.setBitmap(icon); c.drawBitmap(data.image, matrix, paint); c.drawBitmap(swBitmap, matrix, paint); c.drawColor(overlayColor); c.setBitmap(null); Loading