diff options
author | Thorsten Behrens <tbehrens@suse.com> | 2011-11-02 12:28:13 +0100 |
---|---|---|
committer | Thorsten Behrens <tbehrens@suse.com> | 2011-11-02 23:58:27 +0100 |
commit | 3c1b4b6ef70b049bc5242149e727dd5d94111d86 (patch) | |
tree | 3b0182990f092b363a00f2bdae2b32c61730ae9d /vcl | |
parent | 207bcfc5b9d3e857741cd973c3ee9615bdeb2563 (diff) |
Keep basebmp free of naked ptrs.
Moved the implementation detail that SalFrames lifetime is handled
manually in vcl out of basebmp & into vcl. Added lightweight wrapper
class to decouple damagetracker lifetime from GtkFrame lifetime.
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/unx/gtk/gtkframe.hxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk/window/gtkframe.cxx | 19 |
2 files changed, 17 insertions, 4 deletions
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx index e4cf0bed97c6..43f420d895ee 100644 --- a/vcl/inc/unx/gtk/gtkframe.hxx +++ b/vcl/inc/unx/gtk/gtkframe.hxx @@ -61,7 +61,7 @@ typedef XLIB_Window GdkNativeWindow; #define gdk_window_foreign_new_for_display(a,b) gdk_x11_window_foreign_new_for_display(a,b) #endif -class GtkSalFrame : public SalFrame, basebmp::BitmapDeviceDamageTracker +class GtkSalFrame : public SalFrame { static const int nMaxGraphics = 2; diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index 5c6414835ab0..cb780e97df92 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -346,6 +346,19 @@ GetAlternateKeyCode( const sal_uInt16 nKeyCode ) #if GTK_CHECK_VERSION(3,0,0) static int debugQueuePureRedraw = 0; static int debugRedboxRedraws = 0; + +/// Decouple SalFrame lifetime from damagetracker lifetime +struct DamageTracker : public basebmp::IBitmapDeviceDamageTracker +{ + DamageTracker(GtkSalFrame& rFrame) : m_rFrame(rFrame) + {} + virtual void damaged(const basegfx::B2IRange& rDamageRect) const + { + m_rFrame.damaged(rDamageRect); + } + + GtkSalFrame& m_rFrame; +}; #endif void GtkSalFrame::doKeyCallback( guint state, @@ -1567,9 +1580,9 @@ void GtkSalFrame::AllocateFrame() if( aFrameSize.getY() == 0 ) aFrameSize.setY( 1 ); m_aFrame = basebmp::createBitmapDevice( aFrameSize, true, - basebmp::Format::TWENTYFOUR_BIT_TC_MASK, - this ); -// basebmp::Format::THIRTYTWO_BIT_TC_MASK_ARGB ); + basebmp::Format::TWENTYFOUR_BIT_TC_MASK ); + m_aFrame->setDamageTracker( + basebmp::IBitmapDeviceDamageTrackerSharedPtr(new DamageTracker(*this)) ); fprintf( stderr, "allocated m_aFrame size of %dx%d \n", (int)maGeometry.nWidth, (int)maGeometry.nHeight ); |