Decompile fn_09674 (CMergeItemWnd::FitToGrid)
Batch #12970 by cremane: 0 byte-identical, 1 confirmed by peer review. - fn_09674 CMergeItemWnd::FitToGrid: logic confirmed by peer review Peer-reviewed-by: gordaoprogramas, Tanke, codeplay Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
parent
488cceacdb
commit
91d7cbb658
1 changed files with 11 additions and 11 deletions
|
|
@ -284,19 +284,19 @@ void CMergeItemWnd::FitToGrid(int width, int height) {
|
|||
return;
|
||||
}
|
||||
|
||||
const int cell = this->m_cellSize;
|
||||
const int left = this->m_gridLeft;
|
||||
const int minHeight = this->m_gridTop + cell * 3;
|
||||
const int maxHeight = this->m_gridTop + cell * 6;
|
||||
const int minWidth = this->m_cellSize * 5;
|
||||
const int maxWidth = this->m_cellSize * 10;
|
||||
const int minHeight = this->m_gridTop + this->m_cellSize * 3;
|
||||
const int maxHeight = this->m_gridTop + this->m_cellSize * 6;
|
||||
|
||||
int columns = width - this->m_marginRight - left;
|
||||
int columns = width - this->m_marginRight - this->m_gridLeft;
|
||||
columns -= columns % this->m_cellSize;
|
||||
int clamped = cell * 5;
|
||||
if (cell * 5 + left <= columns + left) {
|
||||
int clamped = minWidth;
|
||||
if (this->m_gridLeft + minWidth <= this->m_gridLeft + columns) {
|
||||
clamped = columns;
|
||||
}
|
||||
int gridWidth = cell * 10;
|
||||
if (clamped + left <= cell * 10 + left) {
|
||||
int gridWidth = maxWidth;
|
||||
if (this->m_gridLeft + clamped <= this->m_gridLeft + maxWidth) {
|
||||
gridWidth = clamped;
|
||||
}
|
||||
|
||||
|
|
@ -309,8 +309,8 @@ void CMergeItemWnd::FitToGrid(int width, int height) {
|
|||
gridHeight = maxHeight;
|
||||
}
|
||||
|
||||
if (gridWidth + left != this->geometry.width || gridHeight != this->geometry.height) {
|
||||
this->Resize(this->m_marginRight + gridWidth + left, this->m_marginBottom + gridHeight);
|
||||
if (gridWidth + this->m_gridLeft != this->geometry.width || gridHeight != this->geometry.height) {
|
||||
this->Resize(this->m_marginRight + gridWidth + this->m_gridLeft, this->m_marginBottom + gridHeight);
|
||||
const int visibleColumns = (this->geometry.width - this->m_marginRight - this->m_gridLeft) / this->m_cellSize;
|
||||
const int visibleRows = (this->geometry.height - this->m_marginBottom - this->m_gridTop) / this->m_cellSize;
|
||||
this->m_columns = visibleColumns;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue