-
-
Notifications
You must be signed in to change notification settings - Fork 51
Add screenshot capturing for ensure/assert events on Android #1097
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
fed5eef
c961290
da8b30f
7911e5e
2c04a6c
c85c424
7619f2e
99edd23
a819fac
fb0bb64
d11e277
9851487
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
// Copyright (c) 2025 Sentry. All Rights Reserved. | ||
|
||
#include "SentryScreenshotUtils.h" | ||
|
||
#include "HighResScreenshot.h" | ||
#include "SentryDefines.h" | ||
|
||
#include "Engine/Engine.h" | ||
#include "Engine/GameViewportClient.h" | ||
#include "Framework/Application/SlateApplication.h" | ||
#include "HighResScreenshot.h" | ||
#include "ImageUtils.h" | ||
#include "Misc/EngineVersionComparison.h" | ||
#include "Misc/FileHelper.h" | ||
|
@@ -55,6 +54,30 @@ bool SentryScreenshotUtils::CaptureScreenshot(const FString& ScreenshotSavePath) | |
return false; | ||
} | ||
|
||
#if PLATFORM_ANDROID | ||
FString RHIName = GDynamicRHI ? GDynamicRHI->GetName() : TEXT("Unknown"); | ||
if (RHIName.Contains(TEXT("OpenGL"))) | ||
{ | ||
UE_LOG(LogSentrySdk, Log, TEXT("Applying OpenGL flip/mirror correction for captured screenshot")); | ||
|
||
Algo::Reverse(*Bitmap); | ||
|
||
for (int32 Y = 0; Y < ViewportSize.Y; ++Y) | ||
{ | ||
int32 RowStart = Y * ViewportSize.X; | ||
int32 RowEnd = RowStart + ViewportSize.X - 1; | ||
for (int32 X = 0; X < ViewportSize.X / 2; ++X) | ||
{ | ||
Swap((*Bitmap)[RowStart + X], (*Bitmap)[RowEnd - X]); | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
UE_LOG(LogSentrySdk, Log, TEXT("No flip/mirror correction required captured screenshot (Vulkan or other RHI)")); | ||
} | ||
#endif | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Android Screenshot Orientation Correction FlawThe Android screenshot correction logic has two issues. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we know what the performance impact for this operation is? For high resolution screens for example? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
#if UE_VERSION_OLDER_THAN(5, 0, 0) | ||
GetHighResScreenshotConfig().MergeMaskIntoAlpha(*Bitmap); | ||
TArray<uint8>* CompressedBitmap = new TArray<uint8>(); | ||
|
Uh oh!
There was an error while loading. Please reload this page.