#pragma once #include "Document/BrushStroke.h" #include "IO/ImageImporter.h" #include #include #include #include // Immutable sparse raster; paint commits share untouched tiles. class RasterSnapshot { public: const int width; const int height; const QImage base; const QRectF baseRect; const std::vector patches; const bool isMask; // Origin of the halving grids, kept across commits. const QPointF alignment; RasterSnapshot(int width, int height, QImage base, QRectF baseRect, std::vector patches, bool isMask = false, std::optional alignment = std::nullopt); static std::shared_ptr replacing(const std::optional &source, const QRectF &sourceRect, const std::vector &patches, const QRectF &crop, bool isMask = false); void draw(const QRectF &rect, QPainter &context) const; QImage makeImage() const; bool hasMaterializedPixels() const; QImage thumbnail() const; private: mutable std::mutex m_lock; mutable QImage m_materialized; };