| @@ -573,7 +573,7 @@ public: | |||||
| void paint (Graphics& g) override | void paint (Graphics& g) override | ||||
| { | { | ||||
| g.fillCheckerBoard (getLocalBounds(), 48, 48, | |||||
| g.fillCheckerBoard (getLocalBounds().toFloat(), 48.0f, 48.0f, | |||||
| Colours::lightgrey, Colours::white); | Colours::lightgrey, Colours::white); | ||||
| } | } | ||||
| @@ -74,7 +74,7 @@ public: | |||||
| void paint (Graphics& g) override | void paint (Graphics& g) override | ||||
| { | { | ||||
| g.fillCheckerBoard (getLocalBounds(), 48, 48, Colours::lightgrey, Colours::white); | |||||
| g.fillCheckerBoard (getLocalBounds().toFloat(), 48.0f, 48.0f, Colours::lightgrey, Colours::white); | |||||
| if (shader == nullptr || shader->getFragmentShaderCode() != fragmentCode) | if (shader == nullptr || shader->getFragmentShaderCode() != fragmentCode) | ||||
| { | { | ||||
| @@ -60,8 +60,7 @@ public: | |||||
| p.addRectangle (area); | p.addRectangle (area); | ||||
| DropShadow (Colours::black.withAlpha (0.5f), 6, Point<int> (0, 1)).drawForPath (g, p); | DropShadow (Colours::black.withAlpha (0.5f), 6, Point<int> (0, 1)).drawForPath (g, p); | ||||
| g.fillCheckerBoard (area.getSmallestIntegerContainer(), 24, 24, | |||||
| Colour (0xffffffff), Colour (0xffeeeeee)); | |||||
| g.fillCheckerBoard (area, 24.0f, 24.0f, Colour (0xffffffff), Colour (0xffeeeeee)); | |||||
| drawable->draw (g, 1.0f, RectanglePlacement (RectanglePlacement::stretchToFit) | drawable->draw (g, 1.0f, RectanglePlacement (RectanglePlacement::stretchToFit) | ||||
| .getTransformToFit (contentBounds, area.toFloat())); | .getTransformToFit (contentBounds, area.toFloat())); | ||||
| @@ -356,7 +356,7 @@ private: | |||||
| void paint (Graphics& g) override | void paint (Graphics& g) override | ||||
| { | { | ||||
| if (jucerComp == nullptr) | if (jucerComp == nullptr) | ||||
| g.fillCheckerBoard (getLocalBounds(), 50, 50, | |||||
| g.fillCheckerBoard (getLocalBounds().toFloat(), 50.0f, 50.0f, | |||||
| Colour::greyLevel (0.9f).withAlpha (0.4f), | Colour::greyLevel (0.9f).withAlpha (0.4f), | ||||
| Colour::greyLevel (0.8f).withAlpha (0.4f)); | Colour::greyLevel (0.8f).withAlpha (0.4f)); | ||||
| } | } | ||||
| @@ -285,7 +285,7 @@ private: | |||||
| void paint (Graphics& g) override | void paint (Graphics& g) override | ||||
| { | { | ||||
| g.fillCheckerBoard (getLocalBounds(), 50, 50, | |||||
| g.fillCheckerBoard (getLocalBounds().toFloat(), 50.0f, 50.0f, | |||||
| Colours::lightgrey.withAlpha (0.5f), | Colours::lightgrey.withAlpha (0.5f), | ||||
| Colours::darkgrey.withAlpha (0.5f)); | Colours::darkgrey.withAlpha (0.5f)); | ||||
| } | } | ||||
| @@ -407,8 +407,8 @@ private: | |||||
| image = Image (Image::RGB, 100, 100, true); | image = Image (Image::RGB, 100, 100, true); | ||||
| Graphics g (image); | Graphics g (image); | ||||
| g.fillCheckerBoard (image.getBounds(), | |||||
| image.getWidth() / 2, image.getHeight() / 2, | |||||
| g.fillCheckerBoard (image.getBounds().toFloat(), | |||||
| image.getWidth() * 0.5f, image.getHeight() * 0.5f, | |||||
| Colours::white, Colours::lightgrey); | Colours::white, Colours::lightgrey); | ||||
| g.setFont (12.0f); | g.setFont (12.0f); | ||||
| @@ -61,8 +61,8 @@ public: | |||||
| { | { | ||||
| g.fillAll (Colours::grey); | g.fillAll (Colours::grey); | ||||
| g.fillCheckerBoard (getLocalBounds().reduced (2, 2), | |||||
| 10, 10, | |||||
| g.fillCheckerBoard (getLocalBounds().reduced (2, 2).toFloat(), | |||||
| 10.0f, 10.0f, | |||||
| Colour (0xffdddddd).overlaidWith (colour), | Colour (0xffdddddd).overlaidWith (colour), | ||||
| Colour (0xffffffff).overlaidWith (colour)); | Colour (0xffffffff).overlaidWith (colour)); | ||||
| @@ -525,8 +525,9 @@ void PaintRoutine::fillWithBackground (Graphics& g, const bool drawOpaqueBackgro | |||||
| { | { | ||||
| if ((! backgroundColour.isOpaque()) && drawOpaqueBackground) | if ((! backgroundColour.isOpaque()) && drawOpaqueBackground) | ||||
| { | { | ||||
| g.fillCheckerBoard (Rectangle<int> (0, 0, g.getClipBounds().getRight(), g.getClipBounds().getBottom()), | |||||
| 50, 50, | |||||
| g.fillCheckerBoard (Rectangle<float> ((float) g.getClipBounds().getRight(), | |||||
| (float) g.getClipBounds().getBottom()), | |||||
| 50.0f, 50.0f, | |||||
| Colour (0xffdddddd).overlaidWith (backgroundColour), | Colour (0xffdddddd).overlaidWith (backgroundColour), | ||||
| Colour (0xffffffff).overlaidWith (backgroundColour)); | Colour (0xffffffff).overlaidWith (backgroundColour)); | ||||
| } | } | ||||
| @@ -66,8 +66,8 @@ private: | |||||
| const Colour colour (getColour()); | const Colour colour (getColour()); | ||||
| g.fillAll (Colours::grey); | g.fillAll (Colours::grey); | ||||
| g.fillCheckerBoard (getLocalBounds().reduced (2), | |||||
| 10, 10, | |||||
| g.fillCheckerBoard (getLocalBounds().reduced (2).toFloat(), | |||||
| 10.0f, 10.0f, | |||||
| Colour (0xffdddddd).overlaidWith (colour), | Colour (0xffdddddd).overlaidWith (colour), | ||||
| Colour (0xffffffff).overlaidWith (colour)); | Colour (0xffffffff).overlaidWith (colour)); | ||||
| @@ -512,8 +512,7 @@ void Graphics::drawArrow (Line<float> line, float lineThickness, float arrowhead | |||||
| fillPath (p); | fillPath (p); | ||||
| } | } | ||||
| void Graphics::fillCheckerBoard (Rectangle<int> area, | |||||
| const int checkWidth, const int checkHeight, | |||||
| void Graphics::fillCheckerBoard (Rectangle<float> area, float checkWidth, float checkHeight, | |||||
| Colour colour1, Colour colour2) const | Colour colour1, Colour colour2) const | ||||
| { | { | ||||
| jassert (checkWidth > 0 && checkHeight > 0); // can't be zero or less! | jassert (checkWidth > 0 && checkHeight > 0); // can't be zero or less! | ||||
| @@ -525,31 +524,33 @@ void Graphics::fillCheckerBoard (Rectangle<int> area, | |||||
| if (colour1 == colour2) | if (colour1 == colour2) | ||||
| { | { | ||||
| context.setFill (colour1); | context.setFill (colour1); | ||||
| context.fillRect (area, false); | |||||
| context.fillRect (area); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| auto clipped = context.getClipBounds().getIntersection (area); | |||||
| auto clipped = context.getClipBounds().getIntersection (area.getSmallestIntegerContainer()); | |||||
| if (! clipped.isEmpty()) | if (! clipped.isEmpty()) | ||||
| { | { | ||||
| context.clipToRectangle (clipped); | |||||
| 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(); | |||||
| const int checkNumX = (int) ((clipped.getX() - area.getX()) / checkWidth); | |||||
| const int checkNumY = (int) ((clipped.getY() - area.getY()) / checkHeight); | |||||
| const float startX = area.getX() + checkNumX * checkWidth; | |||||
| const float startY = area.getY() + checkNumY * checkHeight; | |||||
| const float right = clipped.getRight(); | |||||
| const float bottom = clipped.getBottom(); | |||||
| for (int i = 0; i < 2; ++i) | for (int i = 0; i < 2; ++i) | ||||
| { | { | ||||
| context.setFill (i == ((checkNumX ^ checkNumY) & 1) ? colour1 : colour2); | |||||
| int cy = i; | int cy = i; | ||||
| for (int y = startY; y < bottom; y += checkHeight) | |||||
| for (int x = startX + (cy++ & 1) * checkWidth; x < right; x += checkWidth * 2) | |||||
| context.fillRect (Rectangle<int> (x, y, checkWidth, checkHeight), false); | |||||
| RectangleList<float> checks; | |||||
| for (float y = startY; y < bottom; y += checkHeight) | |||||
| for (float x = startX + (cy++ & 1) * checkWidth; x < right; x += checkWidth * 2.0f) | |||||
| checks.addWithoutMerging ({ x, y, checkWidth, checkHeight }); | |||||
| checks.clipTo (area); | |||||
| context.setFill (i == ((checkNumX ^ checkNumY) & 1) ? colour1 : colour2); | |||||
| context.fillRectList (checks); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -300,8 +300,8 @@ public: | |||||
| float cornerSize) const; | float cornerSize) const; | ||||
| /** Fills a rectangle with a checkerboard pattern, alternating between two colours. */ | /** Fills a rectangle with a checkerboard pattern, alternating between two colours. */ | ||||
| void fillCheckerBoard (Rectangle<int> area, | |||||
| int checkWidth, int checkHeight, | |||||
| void fillCheckerBoard (Rectangle<float> area, | |||||
| float checkWidth, float checkHeight, | |||||
| Colour colour1, Colour colour2) const; | Colour colour1, Colour colour2) const; | ||||
| /** Draws a rectangular outline, using the current colour or brush. | /** Draws a rectangular outline, using the current colour or brush. | ||||
| @@ -53,7 +53,7 @@ public: | |||||
| } | } | ||||
| /** Creates a list containing just one rectangle. */ | /** Creates a list containing just one rectangle. */ | ||||
| RectangleList (const RectangleType& rect) | |||||
| RectangleList (RectangleType rect) | |||||
| { | { | ||||
| addWithoutMerging (rect); | addWithoutMerging (rect); | ||||
| } | } | ||||
| @@ -106,7 +106,7 @@ public: | |||||
| The rectangle can have any size and may be empty, but if it's floating point | The rectangle can have any size and may be empty, but if it's floating point | ||||
| then it's expected to not contain any INF values. | then it's expected to not contain any INF values. | ||||
| */ | */ | ||||
| void add (const RectangleType& rect) | |||||
| void add (RectangleType rect) | |||||
| { | { | ||||
| jassert (rect.isFinite()); // You must provide a valid rectangle to this method! | jassert (rect.isFinite()); // You must provide a valid rectangle to this method! | ||||
| @@ -176,7 +176,7 @@ public: | |||||
| The rectangle can have any size and may be empty, but if it's floating point | The rectangle can have any size and may be empty, but if it's floating point | ||||
| then it's expected to not contain any INF values. | then it's expected to not contain any INF values. | ||||
| */ | */ | ||||
| void addWithoutMerging (const RectangleType& rect) | |||||
| void addWithoutMerging (RectangleType rect) | |||||
| { | { | ||||
| jassert (rect.isFinite()); // You must provide a valid rectangle to this method! | jassert (rect.isFinite()); // You must provide a valid rectangle to this method! | ||||
| @@ -200,7 +200,7 @@ public: | |||||
| Any rectangles in the list which overlap this will be clipped and subdivided | Any rectangles in the list which overlap this will be clipped and subdivided | ||||
| if necessary. | if necessary. | ||||
| */ | */ | ||||
| void subtract (const RectangleType& rect) | |||||
| void subtract (RectangleType rect) | |||||
| { | { | ||||
| if (auto numRects = rects.size()) | if (auto numRects = rects.size()) | ||||
| { | { | ||||
| @@ -310,7 +310,7 @@ public: | |||||
| @see getIntersectionWith | @see getIntersectionWith | ||||
| */ | */ | ||||
| bool clipTo (const RectangleType& rect) | |||||
| bool clipTo (RectangleType rect) | |||||
| { | { | ||||
| jassert (rect.isFinite()); // You must provide a valid rectangle to this method! | jassert (rect.isFinite()); // You must provide a valid rectangle to this method! | ||||
| @@ -377,7 +377,7 @@ public: | |||||
| @see clipTo | @see clipTo | ||||
| */ | */ | ||||
| bool getIntersectionWith (const RectangleType& rect, RectangleList& destRegion) const | |||||
| bool getIntersectionWith (RectangleType rect, RectangleList& destRegion) const | |||||
| { | { | ||||
| jassert (rect.isFinite()); // You must provide a valid rectangle to this method! | jassert (rect.isFinite()); // You must provide a valid rectangle to this method! | ||||
| @@ -428,7 +428,7 @@ public: | |||||
| defined by this object | defined by this object | ||||
| @see intersectsRectangle, containsPoint | @see intersectsRectangle, containsPoint | ||||
| */ | */ | ||||
| bool containsRectangle (const RectangleType& rectangleToCheck) const | |||||
| bool containsRectangle (RectangleType rectangleToCheck) const | |||||
| { | { | ||||
| if (rects.size() > 1) | if (rects.size() > 1) | ||||
| { | { | ||||
| @@ -456,7 +456,7 @@ public: | |||||
| defined by this object | defined by this object | ||||
| @see containsRectangle | @see containsRectangle | ||||
| */ | */ | ||||
| bool intersectsRectangle (const RectangleType& rectangleToCheck) const noexcept | |||||
| bool intersectsRectangle (RectangleType rectangleToCheck) const noexcept | |||||
| { | { | ||||
| for (auto& r : rects) | for (auto& r : rects) | ||||
| if (r.intersects (rectangleToCheck)) | if (r.intersects (rectangleToCheck)) | ||||
| @@ -466,7 +466,6 @@ public: | |||||
| } | } | ||||
| /** Checks whether this region intersects any part of another one. | /** Checks whether this region intersects any part of another one. | ||||
| @see intersectsRectangle | @see intersectsRectangle | ||||
| */ | */ | ||||
| bool intersects (const RectangleList& other) const noexcept | bool intersects (const RectangleList& other) const noexcept | ||||
| @@ -553,7 +553,7 @@ struct TextEditor::Iterator | |||||
| Graphics::ScopedSaveState state (g); | Graphics::ScopedSaveState state (g); | ||||
| g.reduceClipRegion ({ startX, baselineY, endX - startX, 1 }); | g.reduceClipRegion ({ startX, baselineY, endX - startX, 1 }); | ||||
| g.fillCheckerBoard ({ endX, baselineY + 1 }, 3, 1, colour, Colours::transparentBlack); | |||||
| g.fillCheckerBoard ({ (float) endX, baselineY + 1.0f }, 3.0f, 1.0f, colour, Colours::transparentBlack); | |||||
| } | } | ||||
| void drawSelectedText (Graphics& g, Range<int> selected, Colour selectedTextColour) const | void drawSelectedText (Graphics& g, Range<int> selected, Colour selectedTextColour) const | ||||
| @@ -261,7 +261,7 @@ public: | |||||
| { | { | ||||
| const Colour c (owner.getSwatchColour (index)); | const Colour c (owner.getSwatchColour (index)); | ||||
| g.fillCheckerBoard (getLocalBounds(), 6, 6, | |||||
| g.fillCheckerBoard (getLocalBounds().toFloat(), 6.0f, 6.0f, | |||||
| Colour (0xffdddddd).overlaidWith (c), | Colour (0xffdddddd).overlaidWith (c), | ||||
| Colour (0xffffffff).overlaidWith (c)); | Colour (0xffffffff).overlaidWith (c)); | ||||
| } | } | ||||
| @@ -430,9 +430,9 @@ void ColourSelector::paint (Graphics& g) | |||||
| if ((flags & showColourAtTop) != 0) | if ((flags & showColourAtTop) != 0) | ||||
| { | { | ||||
| const Colour currentColour (getCurrentColour()); | |||||
| auto currentColour = getCurrentColour(); | |||||
| g.fillCheckerBoard (previewArea, 10, 10, | |||||
| g.fillCheckerBoard (previewArea.toFloat(), 10.0f, 10.0f, | |||||
| Colour (0xffdddddd).overlaidWith (currentColour), | Colour (0xffdddddd).overlaidWith (currentColour), | ||||
| Colour (0xffffffff).overlaidWith (currentColour)); | Colour (0xffffffff).overlaidWith (currentColour)); | ||||
| @@ -410,7 +410,7 @@ struct ColourEditorComp : public Component, | |||||
| void paint (Graphics& g) override | void paint (Graphics& g) override | ||||
| { | { | ||||
| g.fillCheckerBoard (getLocalBounds(), 6, 6, | |||||
| g.fillCheckerBoard (getLocalBounds().toFloat(), 6.0f, 6.0f, | |||||
| Colour (0xffdddddd).overlaidWith (getColour()), | Colour (0xffdddddd).overlaidWith (getColour()), | ||||
| Colour (0xffffffff).overlaidWith (getColour())); | Colour (0xffffffff).overlaidWith (getColour())); | ||||
| } | } | ||||