Skip to content

Commit f7c7bc0

Browse files
romtsnclaude
andcommitted
perf(screenshot): Use RGB_565 for screenshot capture bitmaps
Screen content is always opaque so the alpha channel in ARGB_8888 is wasted. RGB_565 halves the per-screenshot bitmap memory (~2B/px vs 4B/px). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 587630a commit f7c7bc0

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

sentry-android-core/src/main/java/io/sentry/android/core/ScreenshotEventProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ private boolean isMaskingEnabled() {
216216
try (final MaskRenderer maskRenderer = new MaskRenderer()) {
217217
// Make bitmap mutable if needed
218218
if (!screenshot.isMutable()) {
219-
mutableBitmap = screenshot.copy(Bitmap.Config.ARGB_8888, true);
219+
mutableBitmap = screenshot.copy(Bitmap.Config.RGB_565, true);
220220
if (mutableBitmap == null) {
221221
screenshot.recycle();
222222
return null;

sentry-android-core/src/main/java/io/sentry/android/core/internal/util/ScreenshotUtils.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,8 @@ public class ScreenshotUtils {
9797
}
9898

9999
try {
100-
// ARGB_8888 -> This configuration is very flexible and offers the best quality
101100
final Bitmap bitmap =
102-
Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
101+
Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.RGB_565);
103102

104103
final @NotNull CountDownLatch latch = new CountDownLatch(1);
105104

0 commit comments

Comments
 (0)