Render-path containers survive running out of memory: std::map for QHash (12.8e)

This commit is contained in:
雷电芽衣 committed 2026-09-28 01:25:58 -04:00
1 parent 56af936a7b
commit bb8129e8d5
8 files changed
+210 -48

No files matched your search

+9 -8
View File
@@ -1,13 +1,13 @@
#pragma once
#include "Document/LayerAdjustment.h"
#include "Document/LayerAppearance.h"
#include <QHash>
#include <QImage>
#include <QPainter>
#include <QSet>
#include <QUuid>
#include <functional>
#include <map>
#include <optional>
#include <set>
#include <vector>
// Per-render dependency cache: a layer shows through its source's alpha.
@@ -39,11 +39,12 @@ private:
const Source m_source;
const DrawOwn m_drawOwn;
const qint64 m_pixelBudget;
QHash<QUuid, QImage> m_cache;
QSet<QUuid> m_visiting;
QHash<QUuid, std::vector<QUuid>> m_stacks;
QSet<QUuid> m_stacked;
QHash<QUuid, LayerBlendMode> m_stackModes;
// Standard containers: Qt 6.4's hash inserts terminate out of memory.
std::map<QUuid, QImage> m_cache;
std::set<QUuid> m_visiting;
std::map<QUuid, std::vector<QUuid>> m_stacks;
std::set<QUuid> m_stacked;
std::map<QUuid, LayerBlendMode> m_stackModes;
// Every prepared layer's mode, as Swift's `blendMode`.
QHash<QUuid, LayerBlendMode> m_modes;
std::map<QUuid, LayerBlendMode> m_modes;
};