Tracker: Place window background images at top-left of extent

... instead of top-left of view bounds.

This only affects backgrounds inside windows (not on Desktop).

The view bounds may be scrolled over but we don't want to draw the
background from the scrolled over position, we want to draw from
the top-left of the window which is the top-left of the extent.

We also have to set the icon origin in the view state to the extent
instead of the view because it will be different if scrolled.

Change-Id: Ieff9d0a66086d116d46ffbd713b2dcd45d312870
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10413
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
John Scipione
2026-03-04 22:42:42 +00:00
committed by waddlesplash
parent c91678c156
commit f41b44fa34
2 changed files with 9 additions and 3 deletions
+7 -1
View File
@@ -234,7 +234,10 @@ BackgroundImage::Show(BackgroundImageInfo* info, BView* view)
}
// else fall thru
case kAtOffset:
destinationBitmapBounds.OffsetTo(info->fOffset);
if (!fIsDesktop && poseView != NULL)
destinationBitmapBounds.OffsetTo(poseView->Extent().LeftTop() + info->fOffset);
else
destinationBitmapBounds.OffsetTo(info->fOffset);
break;
case kTiled:
@@ -242,6 +245,9 @@ BackgroundImage::Show(BackgroundImageInfo* info, BView* view)
destinationBitmapBounds.OffsetBy(
(viewBounds.Width() - bitmapBounds.Width()) / 2,
(viewBounds.Height() - bitmapBounds.Height()) / 2);
} else if (poseView != NULL) {
// tile from top left of window even if scrolled over
destinationBitmapBounds.OffsetTo(poseView->Extent().LeftTop());
}
options |= B_TILE_BITMAP;
break;
+2 -2
View File
@@ -986,9 +986,9 @@ BPoseView::ScrollTo(BPoint where)
// keep the view state in sync
if (ViewMode() == kListMode)
fViewState->SetListOrigin(LeftTop());
fViewState->SetListOrigin(Extent().LeftTop());
else
fViewState->SetIconOrigin(LeftTop());
fViewState->SetIconOrigin(Extent().LeftTop());
}