Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Replace deprecated wxBitmap methods (fix build on wxWidgets 3.3) #1561

Merged
merged 1 commit into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/TextEditor/UI/SCallTip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ CVAR(Bool, txed_calltips_dim_optional, true, CVar::Flag::Save)
// -----------------------------------------------------------------------------
// SCallTip class constructor
// -----------------------------------------------------------------------------
SCallTip::SCallTip(wxWindow* parent) : wxPopupWindow(parent), buffer_{ 1000, 1000, 32 }, font_{ GetFont() }
SCallTip::SCallTip(wxWindow* parent) : wxPopupWindow(parent),
scratch_{ 1000, 1000, 32 }, buffer_{ 1, 1, 32 }, font_{ GetFont() }
{
wxPopupWindow::Show(false);

Expand Down Expand Up @@ -591,13 +592,12 @@ wxSize SCallTip::drawCallTip(wxDC& dc, int xoff, int yoff)
// -----------------------------------------------------------------------------
void SCallTip::updateBuffer()
{
buffer_.SetWidth(1000);
buffer_.SetHeight(1000);

wxMemoryDC dc(buffer_);
auto size = drawCallTip(dc);
buffer_.SetWidth(size.GetWidth());
buffer_.SetHeight(size.GetHeight());
wxSize size;
{
wxMemoryDC dc(scratch_);
size = drawCallTip(dc);
} // The bitmap needs to be released from the DC before calling GetSubBitmap()
buffer_ = scratch_.GetSubBitmap(size);
}


Expand Down
2 changes: 1 addition & 1 deletion src/TextEditor/UI/SCallTip.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class SCallTip : public wxPopupWindow
wxRect rect_btn_up_;
wxRect rect_btn_down_;
int btn_mouse_over_ = 0;
wxBitmap buffer_;
wxBitmap scratch_, buffer_;
wxFont font_;

void loadContext(unsigned long index);
Expand Down
Loading