Skip to content

Commit

Permalink
fix: lab use history, dissolve, mosaic
Browse files Browse the repository at this point in the history
  • Loading branch information
WONG Yuk Chun authored and WONG Yuk Chun committed Mar 1, 2019
1 parent 167f9bf commit 16963f8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
1 change: 1 addition & 0 deletions ImpressionistDoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
4 changes: 3 additions & 1 deletion ImpressionistUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
};

Expand Down
19 changes: 13 additions & 6 deletions MosaicBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<unsigned char>{
readBMP(entry.path().string().c_str(), width, height),
{ width, height }
a,
ad
},
new ImageWrapper<unsigned char>{
readBMP(resultGradientPath.string().c_str(), width, height),
{ width, height }
b,
bd
},
new ImageWrapper<unsigned char>{
readBMP(resultColorPath.string().c_str(), width, height),
{ width, height }
c,
cd
}
};
}
Expand Down
6 changes: 3 additions & 3 deletions PatternBrush.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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}
});
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 16963f8

Please sign in to comment.