From bbbb1719f957b42bc33356b38fe5f60962bd6b4a Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 29 Apr 2019 12:39:15 +0100 Subject: [PATCH] Made ListBox::createSnapshotOfRows() take the list and row scale factors into account --- modules/juce_gui_basics/widgets/juce_ListBox.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/juce_gui_basics/widgets/juce_ListBox.cpp b/modules/juce_gui_basics/widgets/juce_ListBox.cpp index 2f995f742f..75c4545ddf 100644 --- a/modules/juce_gui_basics/widgets/juce_ListBox.cpp +++ b/modules/juce_gui_basics/widgets/juce_ListBox.cpp @@ -893,7 +893,8 @@ Image ListBox::createSnapshotOfRows (const SparseSet& rows, int& imageX, in imageX = imageArea.getX(); imageY = imageArea.getY(); - Image snapshot (Image::ARGB, imageArea.getWidth(), imageArea.getHeight(), true); + auto listScale = Component::getApproximateScaleFactorForComponent (this); + Image snapshot (Image::ARGB, roundToInt (imageArea.getWidth() * listScale), roundToInt (imageArea.getHeight() * listScale), true); for (int i = getNumRowsOnScreen() + 2; --i >= 0;) { @@ -904,9 +905,12 @@ Image ListBox::createSnapshotOfRows (const SparseSet& rows, int& imageX, in Graphics g (snapshot); g.setOrigin (getLocalPoint (rowComp, Point()) - imageArea.getPosition()); - if (g.reduceClipRegion (rowComp->getLocalBounds())) + auto rowScale = Component::getApproximateScaleFactorForComponent (rowComp); + + if (g.reduceClipRegion (rowComp->getLocalBounds() * rowScale)) { g.beginTransparencyLayer (0.6f); + g.addTransform (AffineTransform::scale (rowScale)); rowComp->paintEntireComponent (g, false); g.endTransparencyLayer(); }