Fixed double painting of letters on grid

This commit is contained in:
2015-06-06 13:13:10 +03:00
parent f9b9af5c8e
commit befbe90a88
4 changed files with 26 additions and 5 deletions

View File

@@ -119,16 +119,35 @@ void MainFrame::SetGridImage(GridType &grid, size_t w) {
}
if (_words.size() > 0) {
using std::vector;
vector< vector< bool > > usedCells(
grid.size(),
vector<bool>(grid.at(0).size(), false)
);
cur_f = dc.GetFont();
cur_f.SetPointSize(sq_h*0.6);
dc.SetFont(cur_f);
for (size_t i = 0; i < winfos.size(); ++i){
if (winfos.at(i).direct == true){
for (size_t j = 0; j < winfos.at(i).len; ++j)
dc.DrawText(_words.at(i).at(j),sq_w*(winfos.at(i).x+j)+sq_w*0.24, sq_h*winfos.at(i).y);
if ( !usedCells.at(i).at(j) ){
dc.DrawText(
_words.at(i).at(j),
sq_w*(winfos.at(i).x+j) + sq_w*0.24,
sq_h*winfos.at(i).y
);
usedCells.at(i).at(j) = true;
}
} else {
for (size_t j = 0; j < winfos.at(i).len; ++j)
dc.DrawText(_words.at(i).at(j),sq_w*winfos.at(i).x+sq_w*0.24, sq_h*(winfos.at(i).y+j));
if ( !usedCells.at(i).at(j) ){
dc.DrawText(
_words.at(i).at(j),
sq_w*winfos.at(i).x + sq_w*0.24,
sq_h*(winfos.at(i).y+j)
);
usedCells.at(i).at(j) = true;
}
}
}

View File

@@ -13,7 +13,7 @@ CurrentFileName :=
CurrentFilePath :=
CurrentFileFullPath :=
User :=Aleksey Lobanov
Date :=31/05/15
Date :=06/06/15
CodeLitePath :="/home/alex/.codelite"
LinkerName :=/usr/bin/g++-4.8
SharedObjectLinkerName :=/usr/bin/g++-4.8 -shared -fPIC