Skip to content

Commit

Permalink
add libosmscout patch 1
Browse files Browse the repository at this point in the history
  • Loading branch information
janbar committed Oct 4, 2024
1 parent 88f5556 commit 3cf9512
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions backend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ set(libosmscout_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/libosmscout")

# First apply our patches in the source of lib
list(APPEND libosmscout_patches
libosmscout.patch.1
)
foreach(patch IN LISTS libosmscout_patches)
execute_process(
Expand Down
23 changes: 23 additions & 0 deletions backend/libosmscout.patch.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff --git a/libosmscout-client-qt/src/osmscoutclientqt/TiledRenderingHelper.cpp b/libosmscout-client-qt/src/osmscoutclientqt/TiledRenderingHelper.cpp
index 9f6b45b9d..f8dd8776d 100644
--- a/libosmscout-client-qt/src/osmscoutclientqt/TiledRenderingHelper.cpp
+++ b/libosmscout-client-qt/src/osmscoutclientqt/TiledRenderingHelper.cpp
@@ -65,10 +65,16 @@ bool TiledRenderingHelper::RenderTiles(QPainter &painter,
}
}

+ // enable subpixel rendering so that magnification up to 2x remains
+ // as smooth as possible
+ static constexpr double pitchFactor = 1.5;
+ // the magnification level is adjusted taking into account the pixel
+ // ratio of the request and the fixed dpi of the OSM tile
projection.Set(request.coord,
0,
- request.magnification,
- request.dpi,
+ Magnification(request.magnification.GetMagnification()
+ * pitchFactor * request.dpi / OSMTile::tileDPI()),
+ OSMTile::tileDPI() / pitchFactor,
width,
height);

0 comments on commit 3cf9512

Please sign in to comment.