Browse Source

Made ListBox::createSnapshotOfRows() take the list and row scale factors into account

tags/2021-05-28
ed 6 years ago
parent
commit
bbbb1719f9
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      modules/juce_gui_basics/widgets/juce_ListBox.cpp

+ 6
- 2
modules/juce_gui_basics/widgets/juce_ListBox.cpp View File

@@ -893,7 +893,8 @@ Image ListBox::createSnapshotOfRows (const SparseSet<int>& rows, int& imageX, in
imageX = imageArea.getX(); imageX = imageArea.getX();
imageY = imageArea.getY(); 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;) for (int i = getNumRowsOnScreen() + 2; --i >= 0;)
{ {
@@ -904,9 +905,12 @@ Image ListBox::createSnapshotOfRows (const SparseSet<int>& rows, int& imageX, in
Graphics g (snapshot); Graphics g (snapshot);
g.setOrigin (getLocalPoint (rowComp, Point<int>()) - imageArea.getPosition()); g.setOrigin (getLocalPoint (rowComp, Point<int>()) - imageArea.getPosition());
if (g.reduceClipRegion (rowComp->getLocalBounds()))
auto rowScale = Component::getApproximateScaleFactorForComponent (rowComp);
if (g.reduceClipRegion (rowComp->getLocalBounds() * rowScale))
{ {
g.beginTransparencyLayer (0.6f); g.beginTransparencyLayer (0.6f);
g.addTransform (AffineTransform::scale (rowScale));
rowComp->paintEntireComponent (g, false); rowComp->paintEntireComponent (g, false);
g.endTransparencyLayer(); g.endTransparencyLayer();
} }


Loading…
Cancel
Save