1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-05 03:50:07 +00:00

Fix for checkerboard rendering. Minor clean-ups.

This commit is contained in:
Julian Storer 2010-07-01 20:00:20 +01:00
parent a9b1c0cd4e
commit 258414bad2
7 changed files with 25 additions and 29 deletions

View file

@ -500,14 +500,17 @@ void Graphics::fillCheckerBoard (const Rectangle<int>& area,
if (! clipped.isEmpty())
{
context->clipToRectangle (clipped);
const int startX = area.getX() + ((clipped.getX() - area.getX()) / checkWidth) * checkWidth;
const int startY = area.getY() + ((clipped.getY() - area.getY()) / checkHeight) * checkHeight;
const int checkNumX = (clipped.getX() - area.getX()) / checkWidth;
const int checkNumY = (clipped.getY() - area.getY()) / checkHeight;
const int startX = area.getX() + checkNumX * checkWidth;
const int startY = area.getY() + checkNumY * checkHeight;
const int right = clipped.getRight();
const int bottom = clipped.getBottom();
for (int i = 0; i < 2; ++i)
{
context->setFill (i == 0 ? colour1 : colour2);
context->setFill (i == ((checkNumX ^ checkNumY) & 1) ? colour1 : colour2);
int cy = i;
for (int y = startY; y < bottom; y += checkHeight)