From 3f2f562a1eaf8f7feb190305e950956d5d1fa36c Mon Sep 17 00:00:00 2001 From: samisalreadytaken <46823719+samisalreadytaken@users.noreply.github.com> Date: Sun, 22 Jan 2023 17:30:46 +0300 Subject: [PATCH] Fix image rotation in vgui::ImagePanel --- sp/src/public/vgui_controls/ImagePanel.h | 4 ++++ sp/src/vgui2/vgui_controls/ImagePanel.cpp | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/sp/src/public/vgui_controls/ImagePanel.h b/sp/src/public/vgui_controls/ImagePanel.h index bba8f88b..f4f5ce85 100644 --- a/sp/src/public/vgui_controls/ImagePanel.h +++ b/sp/src/public/vgui_controls/ImagePanel.h @@ -61,7 +61,11 @@ public: int GetNumFrames(); void SetFrame( int nFrame ); +#ifdef MAPBASE + void SetRotation( int iRotation ); +#else void SetRotation( int iRotation ) { m_iRotation = iRotation; } +#endif protected: virtual void PaintBackground(); diff --git a/sp/src/vgui2/vgui_controls/ImagePanel.cpp b/sp/src/vgui2/vgui_controls/ImagePanel.cpp index 1a77bd2a..e045666e 100644 --- a/sp/src/vgui2/vgui_controls/ImagePanel.cpp +++ b/sp/src/vgui2/vgui_controls/ImagePanel.cpp @@ -73,6 +73,13 @@ void ImagePanel::OnSizeChanged(int newWide, int newTall) //----------------------------------------------------------------------------- void ImagePanel::SetImage(IImage *image) { +#ifdef MAPBASE + if ( image ) + { + image->SetRotation( m_iRotation ); + } +#endif + m_pImage = image; Repaint(); } @@ -471,3 +478,15 @@ void ImagePanel::SetFrame( int nFrame ) return m_pImage->SetFrame( nFrame ); } + +#ifdef MAPBASE +void ImagePanel::SetRotation( int iRotation ) +{ + m_iRotation = iRotation; + + if ( m_pImage ) + { + m_pImage->SetRotation( m_iRotation ); + } +} +#endif