From 645ccab70e9a424dba957d70cbe283f406eb4e9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Micha=C3=ABl=20Celerier?= Date: Mon, 22 Jul 2019 22:17:45 +0200 Subject: [PATCH] fix image cache --- base/plugins/segment/SEGMent/Model/Image.hpp | 1 - base/plugins/segment/SEGMent/Model/Scene.cpp | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/base/plugins/segment/SEGMent/Model/Image.hpp b/base/plugins/segment/SEGMent/Model/Image.hpp index a7d30c9..7032ed3 100644 --- a/base/plugins/segment/SEGMent/Model/Image.hpp +++ b/base/plugins/segment/SEGMent/Model/Image.hpp @@ -19,7 +19,6 @@ struct Image Image& operator=(Image&&) = default; QString path; - mutable QPixmap cache; operator QString&() { return path; } operator const QString&() const { return path; } diff --git a/base/plugins/segment/SEGMent/Model/Scene.cpp b/base/plugins/segment/SEGMent/Model/Scene.cpp index 1b08733..66ca3d8 100644 --- a/base/plugins/segment/SEGMent/Model/Scene.cpp +++ b/base/plugins/segment/SEGMent/Model/Scene.cpp @@ -3,6 +3,7 @@ #include #include +#include #include W_OBJECT_IMPL(SEGMent::SceneModel) namespace SEGMent @@ -181,8 +182,10 @@ void JSONObjectReader::read(const SEGMent::SceneModel& v) obj["Ambience"] = toJsonObject(v.m_ambience); obj["Image"] = v.m_image.path; - obj["ImageSize"] - = QJsonArray{v.m_image.cache.width(), v.m_image.cache.height()}; + + auto parent_doc = score::IDocument::documentFromObject(v); + auto& cache = SEGMent::ImageCache::instance().cache(SEGMent::toLocalFile(v.m_image.path, parent_doc->context())); + obj["ImageSize"] = QJsonArray{cache.full_size.width(), cache.full_size.height()}; obj["Rect"] = toJsonValue(v.m_rect); obj["SceneType"] = (int)v.m_sceneType; obj["StartText"] = v.m_startText;