https://bugs.kde.org/show_bug.cgi?id=441286
--- Comment #5 from Sanji <[email protected]> --- This still occurs with Gwenview 26.08.3 on Wayland. An SVG is drawn too large and displaced towards the bottom-right, with parts outside the viewport. Fit does not make the full drawing visible, and panning cannot reach the missing parts. The same drawing rendered to PNG displays correctly in Gwenview. ## Environment - CachyOS, packages: `gwenview 26.08.3-1.1`, `qt6-base 6.12.0-4`, `qt6-svg 6.12.0-1.1`. - Plasma: `plasma-workspace 6.8.2-1.1`. - Session: Wayland; a separate Qt screen query reports devicePixelRatio 2.0. ## Minimal reproduction and measurements The attached `minimal.svg` uses only rectangles and a path, without nested SVGs, fonts, CSS or external resources. It reproduces the geometry mismatch in a small C++ harness linked to the installed `libgwenviewlib.so.5`. The harness uses Gwenview's actual `DocumentFactory` and `SvgViewAdapter`, not a reimplementation of their calculations. The full Gwenview UI was tested with the original drawing and with a version without its nested SVG element; the minimal rectangles-only file was tested in the library harness. For a 1440 × 980 SVG in an 1800 × 1000 logical-pixel view at zoom 1, with Fit active: ```text DPR 1: visibleDocumentRect: (180, 10, 1440, 980) actual SVG bounds: (180, 10, 1440, 980) DPR 2: visibleDocumentRect: (540, 255, 720, 490) actual SVG bounds: (540, 255, 1440, 980) requested scroll: (1000, 1000) accepted scroll: (0, 0) ``` The DPR 2 run reproduces the displaced, clipped image. The view calculates centering and scroll limits for 720 × 490 but draws the SVG at 1440 × 980. The probe leaves the adapter's default settings unchanged; it does not call `loadConfig()`. ## Likely cause In the v26.08.3 source, `AbstractImageView::dipDocumentSize()` divides document size by `devicePixelRatio()`. Centering and scroll limits use that size. However, `SvgImageView::onZoomChanged()` uses `mSvgItem->setScale(zoom())` without the corresponding DPR correction. The non-Fit/non-Fill load path in `finishLoadFromDocument()` also uses `setScale(zoom())`. In the harness, setting only the SVG item's scale to `zoom() / DPR` makes its bounds match `visibleDocumentRect()`. This is a geometry experiment, not a complete patch: background handling, interactive zoom/pan, and moving between screens have not been validated after this change. Source references: - https://invent.kde.org/graphics/gwenview/-/blob/v26.08.3/lib/documentview/abstractimageview.cpp - https://invent.kde.org/graphics/gwenview/-/blob/v26.08.3/lib/documentview/svgviewadapter.cpp ## Attachments - `minimal.svg`: rectangles-only reproduction. - `diagnostics.txt`: measured bounds and scroll values at DPR 1 and 2. - `dpr-1-corrected-0.png` and `dpr-2-corrected-0.png`: unmodified adapter rendering from the harness, not UI screenshots. - `probe.cpp` and the version-matched headers: source for the harness. -- You are receiving this mail because: You are watching all bug changes.
