Skip to content

Commit

Permalink
fix image cache
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Jul 22, 2019
1 parent 176a2ce commit 645ccab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion base/plugins/segment/SEGMent/Model/Image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
7 changes: 5 additions & 2 deletions base/plugins/segment/SEGMent/Model/Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <QUrl>

#include <SEGMent/Model/Model.hpp>
#include <SEGMent/ImageCache.hpp>
#include <wobjectimpl.h>
W_OBJECT_IMPL(SEGMent::SceneModel)
namespace SEGMent
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 645ccab

Please sign in to comment.