X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c67daf87774c71ae9f73af9969008af220e52a11..a5e13868ca700aa39bae26b8fb13c640f466d9f0:/src/gtk1/dcclient.cpp?ds=inline diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp index ca39cfbb84..3e8025961b 100644 --- a/src/gtk1/dcclient.cpp +++ b/src/gtk1/dcclient.cpp @@ -2,9 +2,8 @@ // Name: dcclient.cpp // Purpose: // Author: Robert Roebling -// Created: 01/02/97 // RCS-ID: $Id$ -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Copyright: (c) 1998 Robert Roebling, Markus Holzem, Chris Breeze // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -92,6 +91,7 @@ wxPaintDC::wxPaintDC(void) m_textGC = (GdkGC *) NULL; m_bgGC = (GdkGC *) NULL; m_cmap = (GdkColormap *) NULL; + m_isMemDC = FALSE; } wxPaintDC::wxPaintDC( wxWindow *window ) @@ -112,22 +112,25 @@ wxPaintDC::wxPaintDC( wxWindow *window ) else m_cmap = gtk_widget_get_colormap( window->m_widget ); - m_isDrawable = TRUE; + m_isMemDC = FALSE; SetUpDC(); } wxPaintDC::~wxPaintDC(void) { + Destroy(); } void wxPaintDC::FloodFill( long WXUNUSED(x1), long WXUNUSED(y1), wxColour *WXUNUSED(col), int WXUNUSED(style) ) { + wxFAIL_MSG( "wxPaintDC::FloodFill not implemented" ); } bool wxPaintDC::GetPixel( long WXUNUSED(x1), long WXUNUSED(y1), wxColour *WXUNUSED(col) ) const { + wxFAIL_MSG( "wxPaintDC::GetPixel not implemented" ); return FALSE; } @@ -274,10 +277,10 @@ void wxPaintDC::DrawLines( wxList *points, long xoffset, long yoffset ) } } -void wxPaintDC::DrawPolygon( int n, wxPoint points[], - long xoffset, long yoffset, int WXUNUSED(fillStyle) ) - { - if (!Ok()) return; +void wxPaintDC::DrawPolygon( int n, wxPoint points[], long xoffset, long yoffset, int WXUNUSED(fillStyle) ) +{ + if (!Ok()) return; + if (!n) return; // Nothing to draw GdkPoint *gdkpoints = new GdkPoint[n+1]; int i; @@ -299,12 +302,11 @@ void wxPaintDC::DrawPolygon( int n, wxPoint points[], delete[] gdkpoints; } -void wxPaintDC::DrawPolygon( wxList *lines, long xoffset, - long yoffset, int WXUNUSED(fillStyle)) - { +void wxPaintDC::DrawPolygon( wxList *lines, long xoffset, long yoffset, int WXUNUSED(fillStyle)) +{ + if (!Ok()) return; + int n = lines->Number(); - - if (!Ok()) return; GdkPoint *gdkpoints = new GdkPoint[n]; wxNode *node = lines->First(); int cnt=0; @@ -478,26 +480,25 @@ bool wxPaintDC::Blit( long xdest, long ydest, long width, long height, { if (!Ok()) return FALSE; - // CMB 20/5/98: add blitting of bitmaps - if (source->IsKindOf(CLASSINFO(wxMemoryDC))) + wxClientDC *csrc = (wxClientDC*)source; + + if (csrc->m_isMemDC) { wxMemoryDC* srcDC = (wxMemoryDC*)source; - GdkBitmap* bmap = srcDC->m_selected.GetBitmap(); + GdkBitmap* bmap = srcDC->m_selected.GetBitmap(); if (bmap) { - gdk_draw_bitmap ( - m_window, - m_textGC, - bmap, - source->DeviceToLogicalX(xsrc), source->DeviceToLogicalY(ysrc), - XLOG2DEV(xdest), YLOG2DEV(ydest), - source->DeviceToLogicalXRel(width), source->DeviceToLogicalYRel(height) - ); + gdk_draw_bitmap( m_window, m_textGC, bmap, + source->DeviceToLogicalX(xsrc), + source->DeviceToLogicalY(ysrc), + XLOG2DEV(xdest), + YLOG2DEV(ydest), + source->DeviceToLogicalXRel(width), + source->DeviceToLogicalYRel(height) ); return TRUE; } } - wxClientDC *csrc = (wxClientDC*)source; gdk_window_copy_area ( m_window, m_penGC, XLOG2DEV(xdest), YLOG2DEV(ydest), csrc->GetWindow(), @@ -588,9 +589,7 @@ void wxPaintDC::Clear(void) { if (!Ok()) return; -// DestroyClippingRegion(); - - if (m_isDrawable) + if (!m_isMemDC) { gdk_window_clear( m_window ); } @@ -829,15 +828,12 @@ void wxPaintDC::DestroyClippingRegion(void) void wxPaintDC::SetUpDC(void) { + Destroy(); m_ok = TRUE; m_logicalFunction = wxCOPY; - if (m_penGC) gdk_gc_unref( m_penGC ); m_penGC = gdk_gc_new( m_window ); - if (m_brushGC) gdk_gc_unref( m_brushGC ); m_brushGC = gdk_gc_new( m_window ); - if (m_textGC) gdk_gc_unref( m_textGC ); m_textGC = gdk_gc_new( m_window ); - if (m_bgGC) gdk_gc_unref( m_bgGC ); m_bgGC = gdk_gc_new( m_window ); SetTextForeground( m_textForegroundColour ); SetTextBackground( m_textBackgroundColour ); @@ -859,6 +855,18 @@ void wxPaintDC::SetUpDC(void) } } +void wxPaintDC::Destroy(void) +{ + if (m_penGC) gdk_gc_unref( m_penGC ); + m_penGC = (GdkGC*) NULL; + if (m_brushGC) gdk_gc_unref( m_brushGC ); + m_brushGC = (GdkGC*) NULL; + if (m_textGC) gdk_gc_unref( m_textGC ); + m_textGC = (GdkGC*) NULL; + if (m_bgGC) gdk_gc_unref( m_bgGC ); + m_bgGC = (GdkGC*) NULL; +} + GdkWindow *wxPaintDC::GetWindow(void) { return m_window; @@ -979,7 +987,7 @@ static void wx_spline_draw_point_array(wxDC *dc) } } -void wxPaintDC::DrawOpenSpline( wxList *points ) +void wxPaintDC::DrawSpline( wxList *points ) { wxPoint *p; double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;