Keep the overlay on the photograph when the view moves
The overlay is a source-space picture; the canvas beside it shows whatever the crop, the zoom and the pan selected out of that same space. Drawn whole it stayed frame-sized while the photograph moved underneath, so zooming in left a map of the whole picture stretched over a detail of it. It now reports the visible rectangle as a clip, which the compositor applies for nothing. Resampling on the CPU instead would mean rebuilding a megapixel image on every frame of a drag, and putting it on the GPU would add a second texture to keep in step with the view. Pushed from the render path rather than the panel's sync: a pan changes no mask and no row, so nothing else needs to run, and rebuilding the row models on every frame of a drag would be waste. Straightening is handled by rotating the image. A quarter turn or a flip permutes the axes and a clip rectangle cannot say that — noted where it happens rather than left to be discovered. The proper fix is to run the overlay through the same shader prologue the photograph goes through, which is the right answer and a larger one than this. Four tests, and the one that matters asserts the clip *narrows* when zoomed — which is precisely what it failed to do.
This commit is contained in:
@@ -806,6 +806,15 @@ export component AppWindow inherits Window {
|
||||
/// opaque map hides the thing being judged.
|
||||
in property <float> overlay-strength: 0.55;
|
||||
in property <bool> overlay-on: false;
|
||||
/// Which part of the source-space overlay the view is showing, in overlay
|
||||
/// pixels. Without it the overlay stays frame-sized while the photograph
|
||||
/// moves under it.
|
||||
in property <int> overlay-clip-x;
|
||||
in property <int> overlay-clip-y;
|
||||
in property <int> overlay-clip-w;
|
||||
in property <int> overlay-clip-h;
|
||||
/// The straightening angle, so the overlay turns with the frame.
|
||||
in property <float> overlay-angle: 0.0;
|
||||
/// Clicking the canvas selects a region instead of panning.
|
||||
in property <bool> region-picking: false;
|
||||
/// Whether shift is down, tracked by the develop key scope below.
|
||||
@@ -1336,6 +1345,16 @@ in property <bool> panel-visible: true;
|
||||
width: parent.shown-w;
|
||||
height: parent.shown-h;
|
||||
source: root.region-overlay;
|
||||
// The visible part of a source-space picture, which is
|
||||
// what makes the overlay follow a zoom, a pan and a
|
||||
// crop. The compositor does the crop and the scale;
|
||||
// resampling on the CPU would mean rebuilding a
|
||||
// megapixel image on every frame of a drag.
|
||||
source-clip-x: root.overlay-clip-x;
|
||||
source-clip-y: root.overlay-clip-y;
|
||||
source-clip-width: root.overlay-clip-w;
|
||||
source-clip-height: root.overlay-clip-h;
|
||||
rotation-angle: -root.overlay-angle * 1deg;
|
||||
image-fit: fill;
|
||||
opacity: root.overlay-strength;
|
||||
// Nearest-neighbour, always. The map is proxy-sized
|
||||
|
||||
Reference in New Issue
Block a user