mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:27:35 +00:00
LibGfx: Fix incorrect origin for checkerboard pattern fills
The checkerboard pattern used in transparency backgrounds was sometimes misaligned with the grid. This happened because it was incorrectly anchoring the pattern to the clipped rect instead of the global grid of the underlying paint target.
This commit is contained in:
parent
da4928feea
commit
07850ccf51
1 changed files with 4 additions and 2 deletions
|
@ -178,9 +178,11 @@ void Painter::fill_rect_with_checkerboard(const IntRect& a_rect, const IntSize&
|
|||
const size_t dst_skip = m_target->pitch() / sizeof(RGBA32);
|
||||
|
||||
for (int i = 0; i < rect.height(); ++i) {
|
||||
int y = rect.y() + i;
|
||||
int cell_row = y / cell_size.height();
|
||||
for (int j = 0; j < rect.width(); ++j) {
|
||||
int cell_row = i / cell_size.height();
|
||||
int cell_col = j / cell_size.width();
|
||||
int x = rect.x() + j;
|
||||
int cell_col = x / cell_size.width();
|
||||
dst[j] = ((cell_row % 2) ^ (cell_col % 2)) ? color_light.value() : color_dark.value();
|
||||
}
|
||||
dst += dst_skip;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue