mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-28 17:16:29 +03:00
Fix in background sizing when using pixel-density != 1. Updated new background tests due to the windowing size issues in the macOS CI.
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
@@ -710,6 +710,15 @@ Sizef UINodeDrawable::LayerDrawable::calcDrawableSize( const std::string& drawab
|
||||
size = mSize;
|
||||
} else {
|
||||
size = mDrawable->getPixelsSize();
|
||||
// For Html mode, mOffset (from calcPosition) is in CSS‑physical pixels
|
||||
// (scaled by PixelDensity via convertLength -> dpToPx), but
|
||||
// getPixelsSize() returns raw image pixels. Scale the intrinsic
|
||||
// size so both values use the same coordinate system, otherwise
|
||||
// the visible sprite‑atlas region drifts when PixelDensity != 1.
|
||||
if ( mContainer->getBackgroundMode() == BackgroundMode::Html ) {
|
||||
size = Sizef( size.x * PixelDensity::getPixelDensity(),
|
||||
size.y * PixelDensity::getPixelDensity() );
|
||||
}
|
||||
}
|
||||
} else if ( drawableSizeEq == "expand" ) {
|
||||
size = mSize;
|
||||
|
||||
@@ -1320,7 +1320,7 @@ UTEST( UIHTML, ContactFormLayout ) {
|
||||
|
||||
UTEST( UIBackground, imageAtlasPositioning ) {
|
||||
auto win = Engine::instance()->createWindow(
|
||||
WindowSettings( 960, 256, "Background Atlas Test", WindowStyle::Default,
|
||||
WindowSettings( 1024, 653, "Background Atlas Test", WindowStyle::Default,
|
||||
WindowBackend::Default, 32, {}, 1, false, true ),
|
||||
ContextSettings( false, 0, 0, GLv_default, true, false ) );
|
||||
FileSystem::changeWorkingDirectory( Sys::getProcessPath() );
|
||||
@@ -1365,7 +1365,7 @@ UTEST( UIBackground, imageAtlasPositioning ) {
|
||||
|
||||
UTEST( UIBackground, imageAtlasPositioningPixelDensity2 ) {
|
||||
auto win = Engine::instance()->createWindow(
|
||||
WindowSettings( 960, 256, "Background Atlas Test PD2", WindowStyle::Default,
|
||||
WindowSettings( 1024, 653, "Background Atlas Test PD2", WindowStyle::Default,
|
||||
WindowBackend::Default, 32, {}, 1, false, true ),
|
||||
ContextSettings( false, 0, 0, GLv_default, true, false ) );
|
||||
EE::Graphics::PixelDensity::setPixelDensity( 2.0f );
|
||||
|
||||
Reference in New Issue
Block a user