From 8cce89407079e4a25bffdf466777af89f943f5b2 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Fri, 29 Mar 2002 17:23:54 +0000 Subject: [PATCH] Preventing bitmap crash differently. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14863 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/bitmap.cpp | 4 ++-- src/gtk/dcclient.cpp | 11 +++++------ src/gtk1/bitmap.cpp | 4 ++-- src/gtk1/dcclient.cpp | 11 +++++------ 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/gtk/bitmap.cpp b/src/gtk/bitmap.cpp index 92bd009d71..1b3afbebba 100644 --- a/src/gtk/bitmap.cpp +++ b/src/gtk/bitmap.cpp @@ -328,8 +328,8 @@ bool wxBitmap::CreateFromXpm( const char **bits ) } gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) ); - - M_BMPDATA->m_bpp = visual->depth; // ? + + M_BMPDATA->m_bpp = visual->depth; // Can we get a different depth from create_from_xpm_d() ? return TRUE; } diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index ffd39ac0a7..2d4299ad5a 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -1011,10 +1011,6 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, use_bitmap = bitmap; } -#ifdef __WXGTK20__ - useMask = FALSE; -#endif - /* apply mask if any */ GdkBitmap *mask = (GdkBitmap *) NULL; if (use_bitmap.GetMask()) mask = use_bitmap.GetMask()->GetBitmap(); @@ -1022,6 +1018,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, if (useMask && mask) { GdkBitmap *new_mask = (GdkBitmap*) NULL; +#ifndef __WXGTK20__ // TODO fix crash if (!m_currentClippingRegion.IsNull()) { GdkColor col; @@ -1041,7 +1038,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, gdk_draw_rectangle( new_mask, gc, TRUE, 0, 0, ww, hh ); gdk_gc_unref( gc ); } - +#endif if (is_mono) { if (new_mask) @@ -1058,6 +1055,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, gdk_gc_set_clip_mask( m_penGC, mask ); gdk_gc_set_clip_origin( m_penGC, xx, yy ); } + if (new_mask) gdk_bitmap_unref( new_mask ); } @@ -1223,6 +1221,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, if (useMask && mask) { GdkBitmap *new_mask = (GdkBitmap*) NULL; +#ifndef __WXGTK20__ // TODO fix crash if (!m_currentClippingRegion.IsNull()) { GdkColor col; @@ -1242,7 +1241,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, gdk_draw_rectangle( new_mask, gc, TRUE, 0, 0, bm_ww, bm_hh ); gdk_gc_unref( gc ); } - +#endif if (is_mono) { if (new_mask) diff --git a/src/gtk1/bitmap.cpp b/src/gtk1/bitmap.cpp index 92bd009d71..1b3afbebba 100644 --- a/src/gtk1/bitmap.cpp +++ b/src/gtk1/bitmap.cpp @@ -328,8 +328,8 @@ bool wxBitmap::CreateFromXpm( const char **bits ) } gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) ); - - M_BMPDATA->m_bpp = visual->depth; // ? + + M_BMPDATA->m_bpp = visual->depth; // Can we get a different depth from create_from_xpm_d() ? return TRUE; } diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp index ffd39ac0a7..2d4299ad5a 100644 --- a/src/gtk1/dcclient.cpp +++ b/src/gtk1/dcclient.cpp @@ -1011,10 +1011,6 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, use_bitmap = bitmap; } -#ifdef __WXGTK20__ - useMask = FALSE; -#endif - /* apply mask if any */ GdkBitmap *mask = (GdkBitmap *) NULL; if (use_bitmap.GetMask()) mask = use_bitmap.GetMask()->GetBitmap(); @@ -1022,6 +1018,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, if (useMask && mask) { GdkBitmap *new_mask = (GdkBitmap*) NULL; +#ifndef __WXGTK20__ // TODO fix crash if (!m_currentClippingRegion.IsNull()) { GdkColor col; @@ -1041,7 +1038,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, gdk_draw_rectangle( new_mask, gc, TRUE, 0, 0, ww, hh ); gdk_gc_unref( gc ); } - +#endif if (is_mono) { if (new_mask) @@ -1058,6 +1055,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, gdk_gc_set_clip_mask( m_penGC, mask ); gdk_gc_set_clip_origin( m_penGC, xx, yy ); } + if (new_mask) gdk_bitmap_unref( new_mask ); } @@ -1223,6 +1221,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, if (useMask && mask) { GdkBitmap *new_mask = (GdkBitmap*) NULL; +#ifndef __WXGTK20__ // TODO fix crash if (!m_currentClippingRegion.IsNull()) { GdkColor col; @@ -1242,7 +1241,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, gdk_draw_rectangle( new_mask, gc, TRUE, 0, 0, bm_ww, bm_hh ); gdk_gc_unref( gc ); } - +#endif if (is_mono) { if (new_mask) -- 2.47.2