Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ui): save canvas to gallery does nothing
The root issue is the compositing cache. When we save the canvas to gallery, we need to first composite raster layers together and then upload the image. The compositor makes extensive use of caching to reduce the number of images created and improve performance. There are two "layers" of caching: 1. Caching the composite canvas element, which is used both for uploading the canvas and for generation mode analysis. 2. Caching the uploaded composite canvas element as an image. The combination of these caches allows for the various processes that require composite canvases to do minimal work. But this causes a problem in this situation, because the user expects a new image to be uploaded when they click save to gallery. For example, suppose we have already composited and uploaded the raster layer state for use in a generation. Then, we ask the compositor to save the canvas to gallery. The compositor sees that we are requesting an image for the current canvas state, and instead of recompositing and uploading the image again, it just returns the cached image. In this case, no image is uploaded and it the button does nothing. We need to be able to opt out of the caching at some level, for certain actions. A `forceUpload` arg is added to the compositor's high-level `getCompositeImageDTO` method to do this. When true, we ignore the uppermost caching layer (the uploaded image layer), but still use the lower caching layer (the canvas element layer). So we don't recompute the canvas element, but we do upload it as a new image to the server.
- Loading branch information