diff --git a/ImpressionistDoc.cpp b/ImpressionistDoc.cpp index 6da54a1..36cfbb8 100644 --- a/ImpressionistDoc.cpp +++ b/ImpressionistDoc.cpp @@ -181,6 +181,7 @@ void ImpressionistDoc::runBayesian() { char* newfile = fl_file_chooser("Open File?", "*.bmp", getImageName()); if (newfile != NULL) { + recordHistory(); m_bayesian->solve(newfile); if(m_ucAnother) { diff --git a/ImpressionistUI.cpp b/ImpressionistUI.cpp index c019277..e01f0a6 100644 --- a/ImpressionistUI.cpp +++ b/ImpressionistUI.cpp @@ -646,10 +646,12 @@ void ImpressionistUI::cb_dissolve(Fl_Widget* o, void*) auto* fileName = fl_file_chooser("Open File?", "*.bmp", nullptr); if (fileName != nullptr) { + uiPtr->m_pDoc->recordHistory(); auto width = 0; auto height = 0; + auto oPtr = readBMP(fileName, width, height); ImageWrapper imageWrapper = { - readBMP(fileName, width, height), + oPtr, { width, height } }; diff --git a/MosaicBuilder.cpp b/MosaicBuilder.cpp index 6bb2088..f50f3f5 100644 --- a/MosaicBuilder.cpp +++ b/MosaicBuilder.cpp @@ -212,18 +212,25 @@ bool MosaicBuilder::loadAllTiles() auto width = 0; auto height = 0; + auto a = readBMP(entry.path().string().c_str(), width, height); + const Dim ad = { width, height }; + auto b = readBMP(resultGradientPath.string().c_str(), width, height); + const Dim bd = { width, height }; + auto c = readBMP(resultColorPath.string().c_str(), width, height); + const Dim cd = { width, height }; + imagePool[name] = ImageSet{ new ImageWrapper{ - readBMP(entry.path().string().c_str(), width, height), - { width, height } + a, + ad }, new ImageWrapper{ - readBMP(resultGradientPath.string().c_str(), width, height), - { width, height } + b, + bd }, new ImageWrapper{ - readBMP(resultColorPath.string().c_str(), width, height), - { width, height } + c, + cd } }; } diff --git a/PatternBrush.cpp b/PatternBrush.cpp index 0885dbb..3dae784 100644 --- a/PatternBrush.cpp +++ b/PatternBrush.cpp @@ -46,9 +46,9 @@ void PatternBrush::setPatterns(const std::string& directoryName) //Entry should be an alpha map. auto width = 0; auto height = 0; - + auto xxxxx = readBMP(entry.path().string().c_str(), width, height); patterns.push_back({ - readBMP(entry.path().string().c_str(), width, height), + xxxxx, {width, height} }); } @@ -126,7 +126,7 @@ void PatternBrush::BrushMove(const Point source, const Point target) { //Make new pattern const auto i = dis(gen); - if (i < 0 || scaledPatterns.size() >= i) return; + if (i < 0 || i >= scaledPatterns.size()) return; auto& alpha = scaledPatterns[i]; const int tX0 = target.x - alpha.dim.width / 2;