Repository navigation
Render: tiled picture fills keep their size in scaled groups and upright tiles - #1693
Conversation
… upright tiles A tiled picture fill (a:blipFill with a:tile) was sized in the shape's own units. Inside a group whose child space differs from its box (old decks write child spaces ~1800 times smaller) one tile covered hundreds of boxes, so the fill showed a single flat texel instead of the texture. PowerPoint's own PNG export of a synthetic probe deck shows the tile keeps its size, offset, anchor and mirroring in slide points whatever the group's scale, uniform or stretched unevenly, nested or flipped. The tile is now converted from points to shape units per axis (Renderer::per_point_xy, paint:: tiled_per_point), and snapped to whole device pixels per axis. Tiles with rotWithShape="0" are drawn in device pixels and were sized in pixels, ignoring the zoom (even outside groups); they are now sized to pixels first. Tests: a tile in groups of seven scales (uniform and uneven, wide and tall tile), and an upright tile in a turned shape at zoom 1 and 2. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Per-point tile scaling crates/render/src/renderer.rs, crates/render/src/paint.rs, crates/render/src/tests_wild.rs, ROADMAP.md, docs/parity-checklist.md |
The renderer calculates separate point scales for each axis and applies them to tiled picture fills and picture content. Tests cover group scales, inherited group fills, picture shapes, and reflections. The roadmap and parity checklist record the update. |
Upright tile drawing crates/render/src/paint.rs, crates/render/src/tests_wild.rs |
Upright tiled fills in turned shapes use transform scales when drawing. Tile dimensions snap to whole output pixels per axis. Tests compare tile patterns across zoom levels. |
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Possibly related issues
- Tiled SVG picture fills use the rendered size as tile size #1367: This change adjusts tiled picture size and offset conversion, but does not address the separate SVG natural-size problem described in the issue.
Suggested reviewers: echelon, dylanmtaylor
Merge Risk: 
Low · up to e90e7
-
Upright tiled fills in rotated, scaled tables or charts can render at the wrong size. The visual impact is bounded, so the change is mergeable with that limitation understood.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Title check
-
Explanation
The title names the main change: tiled picture fills keep their size in scaled groups and stay upright on turned shapes. The changeset adds per-axis scaling of tiled-picture parameters in paint.rs and renderer.rs, adds render tests for scaled groups and upright tiles, and updates the parity checklist and roadmap. The title matches the PR objectives, which describe the same goals.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 30.77% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 13 functions across 3 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
…n points too Review of storytold#1693 found two more places that drew a tiled picture fill in the shape's own (child-space) units inside a scaled group. A group nested in a scaled group stored its own tiled fill unconverted, so the members that take it (grpFill) got oversized tiles. The owning group now converts the fill with per_point_xy when it stores it, so inheriting members, directly or through a chain of grpFill groups, get the converted tile. A picture shape (p:pic) whose blip fill is a tile passed its own fill straight to paint::picture. It now goes through paint::tiled_picture_per_point, which tiled_per_point also uses. Tests: a group's tile passed to its members and a picture shape's own tile, each in outer groups scaled 1, 0.25, 1600 and 2x0.5; both fail without the change. Docs: the Picture and texture fill checklist row is re-assessed (remains P) with its status line and revision history, and the ROADMAP progress log row mentions both cases. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ints too Review of storytold#1693 found that cast_effects built the picture content that a shadow, a glow and a reflection are drawn from without converting a tiled fill to points, so inside a scaled group the reflection of a tiled picture showed child-space tiles while its face showed the right ones. The content now goes through paint::tiled_picture_per_point with per_point_xy, as the face does. Test: a tiled picture's reflection in groups scaled 0.25, 1600 and 2x0.5 shows the same colours as in an unscaled group; it fails without the change. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Landed on main, thank you @leobasilio for the contribution! If you haven't already, come join us on Discord: https://discord.gg/artcraft |
A tiled picture fill (
a:blipFillwitha:tile) on a shape inside a group whose child space differs from its box was drawn with a tile far larger or smaller than PowerPoint draws it. Textured shapes in decks with a "legacy" child space (the child rectangle ~1800 times smaller than the group's box, as old PowerPoint files write them) showed one flat texel of their texture instead of the texture.Problem
paint::picturesizes a tile asnatural size * 0.75 * sxin the shape's own units. Outside a group those units are points. Inside a group they are child-space units, so:rotWithShape="0"on a turned shape are drawn on the slide's axes in device pixels, and were sized in pixels too, so their size on the slide followed the zoom (even outside groups) and, in a group, the child scale as well.What PowerPoint does
Observed in PowerPoint's own PNG export of a synthetic probe deck (our own images, raw OOXML, six slides): the tile keeps its size, offset, anchor and mirroring in slide points, whatever the group's scale: uniform (1, 4, 0.25, 1800, 0.05), stretched unevenly (x2/y0.5, x0.5/y2, x4, x1800, y1800), nested, flipped, or turned;
sx/sy,tx/ty,algnandflipall behave as in the ungrouped control; the tile of a 75 dpi picture is 115.2 pt wide and of a 150 dpi one 57.6 pt, also in groups; a group's own tile fill (grpFillmembers) tiles from the group's corner at the same absolute size; withrotWithShape="0"the tiles stay upright at their absolute size. (The PowerPoint screenshots are not part of this PR, per AGENTS.md section 1.1.)Solution
Renderer::per_point_xygives the shape units per point along the shape's x and y axes (the existingper_pointis the isotropic version, used for 3-D sizes).paint::tiled_per_pointconverts a tiled picture'ssx,sy,txandtyfrom points to those units before painting, so the tile comes out in slide points on both axes.fill_geometryapplies it to shape fills.paint::pictureis now per axis; one scale would round a stretched tile to the wrong size.rotWithShape="0"path inpaint::fill_path, which paints in device pixels, sizes the tile to pixels with the same helper using the matrix's per-axis scale.Note the last point changes drawing outside groups too: an upright tile in a turned shape used to be 90 px wide at any zoom and is now 90 pt (120 px at 1.333 px/pt), as in PowerPoint.
Before / after
Renders of the probe decks with
deckcraft-cli render, upstreammain(0d45a64) against this branch:Verification
crates/render/src/tests_wild.rs:a_tile_keeps_its_size_in_a_group_with_scaled_child_coordinates: a wide and a tall tile in groups of seven scales, uniform and uneven (1, 1600, 0.25, 2x0.5, 0.5x2, 1800x1, 1x1800). It fails without the change (a flat purple pixel in the 1600 group).an_upright_tile_in_a_turned_shape_keeps_its_size_in_points_at_any_zoom: the same turned shape at zoom 1 and 2, ungrouped and in a 0.25 group. It fails without therotWithShape="0"change (122 of 312 samples agree).flipHon a group (16) and a 75 dpi tile with no group (19); the tile sizes look equal side by side, so I take it as sub-pixel phase or rounding, but I did not measure the phase.cargo xtask ci: all eight steps pass on this branch rebased ontomainat 0d45a64.ROADMAP.mdprogress log and revision history have an entry. I left its stale "Last updated" header lines alone.Not covered
🤖 Generated with Claude Code
Summary by CodeRabbit