Skip to content

Commit 626ce03

Browse files
committed
Rename drawing canvas GetSolidLineCount to clearer name
1 parent c38d46b commit 626ce03

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

source/DrawingCanvas.ixx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,6 @@ void DrawingCanvas::DrawGrid(uint32_t color, uint32_t step)
700700
{
701701
xLineMod = 0;
702702
}
703-
// Duplicate the alpha channel in the other three color channels.
704703
destRow[x] = pixelColor;
705704
}
706705
++yMod;
@@ -863,7 +862,9 @@ namespace
863862
return S_OK;
864863
}
865864

866-
uint32_t GetSolidLineCount(
865+
// Using the top left pixel as a reference color (like chroma key), and which direction to start from,
866+
// count how many ignorable padding lines there are of the same color.
867+
uint32_t GetIgnorablePaddingLineCount(
867868
uint32_t* pixels,
868869
size_t bytesPerRow,
869870
uint32_t width,
@@ -963,10 +964,10 @@ namespace
963964
{
964965
const size_t bytesPerRow = sourceBitmapInfo.dsBm.bmWidthBytes;
965966
uint32_t* pixels = reinterpret_cast<uint32_t*>(sourceBitmapInfo.dsBm.bmBits);
966-
top = GetSolidLineCount(pixels, bytesPerRow, bitmapWidth, bitmapHeight, bitmapHeight, 0);
967-
bottom -= GetSolidLineCount(pixels, bytesPerRow, bitmapWidth, bitmapHeight, bitmapHeight - top, 1);
968-
left = GetSolidLineCount(pixels, bytesPerRow, bitmapWidth, bitmapHeight, bitmapWidth, 2);
969-
right -= GetSolidLineCount(pixels, bytesPerRow, bitmapWidth, bitmapHeight, bitmapWidth - left, 3);
967+
top = GetIgnorablePaddingLineCount(pixels, bytesPerRow, bitmapWidth, bitmapHeight, bitmapHeight, 0);
968+
bottom -= GetIgnorablePaddingLineCount(pixels, bytesPerRow, bitmapWidth, bitmapHeight, bitmapHeight - top, 1);
969+
left = GetIgnorablePaddingLineCount(pixels, bytesPerRow, bitmapWidth, bitmapHeight, bitmapWidth, 2);
970+
right -= GetIgnorablePaddingLineCount(pixels, bytesPerRow, bitmapWidth, bitmapHeight, bitmapWidth - left, 3);
970971

971972
top = std::max(int32_t(top - padding), 0);
972973
bottom = std::min(int32_t(bottom + padding), int32_t(bitmapHeight));

0 commit comments

Comments
 (0)