Permalink
Browse files

Fix flickering on Linux

Apparently just call Refresh() when wanting to repaint the widget
instead of manually re-painting fixes the flickering on Linux.
  • Loading branch information...
khaledhosny authored and brawer committed Nov 18, 2017
1 parent e5b1703 commit d7e7be588d6006535841a155e703d12d0c967abc
Showing with 4 additions and 15 deletions.
  1. +2 −2 src/fontview/main.cpp
  2. +2 −11 src/fontview/sample_text.cpp
  3. +0 −2 src/fontview/sample_text.h
View
@@ -353,7 +353,7 @@ void MyFrame::OnChangeSampleText(wxCommandEvent& event) {
// This is needed on GTK+, where wxWidgets doesn't use UTF8 internally.
std::string text(dialog.GetValue().mb_str(wxConvUTF8));
sampleText_->SetText(text, true);
sampleText_->Paint();
sampleText_->Refresh();
}
void MyFrame::OnAbout(wxCommandEvent& event) {
@@ -407,7 +407,7 @@ void MyFrame::OnTextSettingsChanged() {
if (!sampleText_->HasCustomText() && curStyle) {
sampleText_->SetText(curStyle->GetSampleText(), false);
}
sampleText_->Paint();
sampleText_->Refresh();
}
processingModelChange_ = false;
@@ -67,16 +67,6 @@ wxSize SampleText::DoGetBestSize() const {
return wxSize(600, 300);
}
void SampleText::Paint() {
wxWindowDC dc(this);
Paint(dc);
}
void SampleText::OnPaint(wxPaintEvent& event) {
wxPaintDC dc(this);
Paint(dc);
}
static void CopyAlpha(const FT_Bitmap& source,
int leftOffset, int topOffset,
wxBitmap* target) {
@@ -166,7 +156,8 @@ void SampleText::DrawGlyph(wxDC& dc, FT_Face face, FT_UInt glyph,
FT_Bitmap_Done(face->glyph->library, &ftBitmap);
}
void SampleText::Paint(wxDC& dc) {
void SampleText::OnPaint(wxPaintEvent& event) {
wxPaintDC dc(this);
if (!fontFace_ || !dc.IsOk()) {
return;
}
@@ -43,15 +43,13 @@ class SampleText : public wxScrolledCanvas {
void SetTextLanguage(const std::string& language); // BCP47 code
void SetFontFace(FT_Face fontFace);
void SetFontSize(double size);
void Paint();
wxDECLARE_EVENT_TABLE();
protected:
virtual wxSize DoGetBestSize() const;
private:
void OnPaint(wxPaintEvent& event);
void Paint(wxDC& dc);
void DrawGlyph(wxDC& dc, FT_Face face, FT_UInt glyph, double x, double y);
bool hasCustomText_;

0 comments on commit d7e7be5

Please sign in to comment.