Skip to content

Commit

Permalink
Small optimisation for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
timothyschoen committed May 9, 2022
1 parent bdf74f2 commit 0d61157
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Source/Standalone/PlugDataWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ class PlugDataWindow : public DocumentWindow
{
// Replacement for native Windows shadow, to allow rounded corners
#if CUSTOM_SHADOW
Image shadowImage;
Image shadowImageT, shadowImageB, shadowImageL, shadowImageR;
DropShadow shadow = DropShadow(Colour(20, 20, 20).withAlpha(0.3f), 4, Point<int>(0, 0));
#endif

Expand Down Expand Up @@ -592,7 +592,11 @@ class PlugDataWindow : public DocumentWindow
#if CUSTOM_SHADOW
void paint(Graphics& g) override
{
g.drawImageAt(shadowImage, 0, 0);

g.drawImageAt(shadowImageT, 0, 0);
g.drawImageAt(shadowImageB, 0, getHeight() - 6);
g.drawImageAt(shadowImageL, 0, 0);
g.drawImageAt(shadowImageR, getWidth() - 6, 0);
}
#endif

Expand All @@ -607,7 +611,7 @@ class PlugDataWindow : public DocumentWindow
getLookAndFeel().positionDocumentWindowButtons(*this, titleBarArea.getX(), titleBarArea.getY(), titleBarArea.getWidth(), titleBarArea.getHeight(), getMinimiseButton(), getMaximiseButton(), getCloseButton(), false);

#if CUSTOM_SHADOW
shadowImage = Image (Image::PixelFormat::ARGB, getWidth(), getHeight(), true);
auto shadowImage = Image (Image::PixelFormat::ARGB, getWidth(), getHeight(), true);
Graphics g(shadowImage);
auto b = getLocalBounds();
Path localPath;
Expand All @@ -617,6 +621,12 @@ class PlugDataWindow : public DocumentWindow
g.setColour(Colour(186, 186, 186));
g.drawRoundedRectangle(b.toFloat().reduced(4), 6.0f, 1.0f);
#endif
shadowImageT = shadowImage.getClippedImage({0, 0, getWidth(), 6});
shadowImageB = shadowImage.getClippedImage({0, getHeight() - 6, getWidth(), 6});
shadowImageL = shadowImage.getClippedImage({0, 0, 6, getHeight()});
shadowImageR = shadowImage.getClippedImage({getWidth() - 6, 0, 6, getHeight()});


}

virtual StandalonePluginHolder* getPluginHolder()
Expand Down

0 comments on commit 0d61157

Please sign in to comment.