Skip to content

Commit

Permalink
Fix display density when exiting VR video mode
Browse files Browse the repository at this point in the history
We should also take the texture scale into account
to compute the actual width and height for the placement

Signed-off-by: Songlin Jiang <[email protected]>
  • Loading branch information
HollowMan6 committed Jan 23, 2024
1 parent 916adb3 commit ba5837a
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -580,13 +580,15 @@ public void resumeCompositor() {
}

public void enableVRVideoMode(int aVideoWidth, int aVideoHeight, boolean aResetBorder) {
final int actualWidth = (int) (mWidth / getPlacement().textureScale);
final int actualHeight = (int) (mHeight / getPlacement().textureScale);
if (!mIsInVRVideoMode) {
mWidthBackup = mWidth;
mHeightBackup = mHeight;
mWidthBackup = actualWidth;
mHeightBackup = actualHeight;
mIsInVRVideoMode = true;
}
boolean borderChanged = aResetBorder && mBorderWidth > 0;
if (aVideoWidth == mWidth && aVideoHeight == mHeight && !borderChanged) {
if (aVideoWidth == actualWidth && aVideoHeight == actualHeight && !borderChanged) {
return;
}
if (aResetBorder) {
Expand All @@ -606,9 +608,11 @@ public void disableVRVideoMode() {
}
mIsInVRVideoMode = false;

final int actualWidth = (int) (mWidth / getPlacement().textureScale);
final int actualHeight = (int) (mHeight / getPlacement().textureScale);
// TODO: Fix the compositor to support correct border offset
int border = 0; // SettingsStore.getInstance(getContext()).getTransparentBorderWidth();
if (mWidthBackup == mWidth && mHeightBackup == mHeight && border == mBorderWidth) {
if (mWidthBackup == actualWidth && mHeightBackup == actualHeight && border == mBorderWidth) {
return;
}
mBorderWidth = border;
Expand Down

0 comments on commit ba5837a

Please sign in to comment.