Deprecate wxDC::{Begin,End}Drawing()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37315 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jamie Gadd
2006-02-05 11:59:59 +00:00
parent 6037dd262f
commit 68df211fae
21 changed files with 14 additions and 103 deletions

View File

@@ -118,7 +118,6 @@ void DiagramView::OnDraw(wxDC *dc)
// This part was added to preform the print preview and printing functions // This part was added to preform the print preview and printing functions
dc->BeginDrawing(); // Allows optimization of drawing code under MS Windows.
wxDiagram *diagram_p=((DiagramDocument*)GetDocument())->GetDiagram(); // Get the current diagram wxDiagram *diagram_p=((DiagramDocument*)GetDocument())->GetDiagram(); // Get the current diagram
if (diagram_p->GetShapeList()) if (diagram_p->GetShapeList())
{ {
@@ -135,7 +134,6 @@ void DiagramView::OnDraw(wxDC *dc)
current = current->GetNext(); // Procede to the next shape in the list current = current->GetNext(); // Procede to the next shape in the list
} }
} }
dc->EndDrawing(); // Allows optimization of drawing code under MS Windows.
} }
void DiagramView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint)) void DiagramView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint))

View File

@@ -174,7 +174,6 @@ void wxLEDNumberCtrl::OnPaint(wxPaintEvent &WXUNUSED(event))
wxMemoryDC MemDc; wxMemoryDC MemDc;
MemDc.SelectObject(*pMemoryBitmap); MemDc.SelectObject(*pMemoryBitmap);
MemDc.BeginDrawing();
// Draw background. // Draw background.
MemDc.SetBrush(wxBrush(GetBackgroundColour(), wxSOLID)); MemDc.SetBrush(wxBrush(GetBackgroundColour(), wxSOLID));
@@ -241,8 +240,6 @@ void wxLEDNumberCtrl::OnPaint(wxPaintEvent &WXUNUSED(event))
} }
} }
MemDc.EndDrawing();
// Blit the memory dc to screen. // Blit the memory dc to screen.
Dc.Blit(0, 0, Width, Height, &MemDc, 0, 0, wxCOPY); Dc.Blit(0, 0, Width, Height, &MemDc, 0, 0, wxCOPY);
delete pMemoryBitmap; delete pMemoryBitmap;

View File

@@ -89,7 +89,6 @@ void wxStaticPicture::OnPaint(wxPaintEvent& WXUNUSED(event))
wxPaintDC dc( this ); wxPaintDC dc( this );
PrepareDC( dc ); PrepareDC( dc );
dc.BeginDrawing();
wxSize sz = GetSize(); wxSize sz = GetSize();
wxSize bmpsz( Bitmap.GetWidth(), Bitmap.GetHeight() ); wxSize bmpsz( Bitmap.GetWidth(), Bitmap.GetHeight() );
@@ -145,7 +144,5 @@ void wxStaticPicture::OnPaint(wxPaintEvent& WXUNUSED(event))
} }
else else
dc.DrawBitmap( Bitmap, pos.x, pos.y ); dc.DrawBitmap( Bitmap, pos.x, pos.y );
dc.EndDrawing();
} }

View File

@@ -678,7 +678,6 @@ void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) {
PRectangle rcClient = GetClientRectangle(); PRectangle rcClient = GetClientRectangle();
paintingAllText = rcPaint.Contains(rcClient); paintingAllText = rcPaint.Contains(rcClient);
dc->BeginDrawing();
ClipChildren(*dc, rcPaint); ClipChildren(*dc, rcPaint);
Paint(surfaceWindow, rcPaint); Paint(surfaceWindow, rcPaint);
@@ -689,7 +688,6 @@ void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) {
FullPaint(); FullPaint();
} }
paintState = notPainting; paintState = notPainting;
dc->EndDrawing();
} }

View File

@@ -771,9 +771,7 @@ void LifeCanvas::DrawCell(wxInt32 i, wxInt32 j, bool alive)
dc.SetPen(alive? *wxBLACK_PEN : *wxWHITE_PEN); dc.SetPen(alive? *wxBLACK_PEN : *wxWHITE_PEN);
dc.SetBrush(alive? *wxBLACK_BRUSH : *wxWHITE_BRUSH); dc.SetBrush(alive? *wxBLACK_BRUSH : *wxWHITE_BRUSH);
dc.BeginDrawing();
DrawCell(i, j, dc); DrawCell(i, j, dc);
dc.EndDrawing();
} }
void LifeCanvas::DrawCell(wxInt32 i, wxInt32 j, wxDC &dc) void LifeCanvas::DrawCell(wxInt32 i, wxInt32 j, wxDC &dc)
@@ -810,8 +808,6 @@ void LifeCanvas::DrawChanged()
m_viewportY + m_viewportH, m_viewportY + m_viewportH,
true); true);
dc.BeginDrawing();
if (m_cellsize == 1) if (m_cellsize == 1)
{ {
dc.SetPen(*wxBLACK_PEN); dc.SetPen(*wxBLACK_PEN);
@@ -830,7 +826,6 @@ void LifeCanvas::DrawChanged()
for (size_t m = 0; m < ncells; m++) for (size_t m = 0; m < ncells; m++)
DrawCell(cells[m].i, cells[m].j, dc); DrawCell(cells[m].i, cells[m].j, dc);
} }
dc.EndDrawing();
} }
// event handlers // event handlers
@@ -859,7 +854,6 @@ void LifeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
bool done = m_life->FindMore(&cells, &ncells); bool done = m_life->FindMore(&cells, &ncells);
// erase all damaged cells and draw the grid // erase all damaged cells and draw the grid
dc.BeginDrawing();
dc.SetBrush(*wxWHITE_BRUSH); dc.SetBrush(*wxWHITE_BRUSH);
if (m_cellsize <= 2) if (m_cellsize <= 2)
@@ -897,8 +891,6 @@ void LifeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
// last set // last set
for (size_t m = 0; m < ncells; m++) for (size_t m = 0; m < ncells; m++)
DrawCell(cells[m].i, cells[m].j, dc); DrawCell(cells[m].i, cells[m].j, dc);
dc.EndDrawing();
} }
void LifeCanvas::OnMouse(wxMouseEvent& event) void LifeCanvas::OnMouse(wxMouseEvent& event)
@@ -951,7 +943,6 @@ void LifeCanvas::OnMouse(wxMouseEvent& event)
wxClientDC dc(this); wxClientDC dc(this);
dc.SetPen(alive? *wxBLACK_PEN : *wxWHITE_PEN); dc.SetPen(alive? *wxBLACK_PEN : *wxWHITE_PEN);
dc.SetBrush(alive? *wxBLACK_BRUSH : *wxWHITE_BRUSH); dc.SetBrush(alive? *wxBLACK_BRUSH : *wxWHITE_BRUSH);
dc.BeginDrawing();
// draw a line of cells using Bresenham's algorithm // draw a line of cells using Bresenham's algorithm
wxInt32 d, ii, jj, di, ai, si, dj, aj, sj; wxInt32 d, ii, jj, di, ai, si, dj, aj, sj;
@@ -1007,8 +998,6 @@ void LifeCanvas::OnMouse(wxMouseEvent& event)
DrawCell(ii, jj, dc); DrawCell(ii, jj, dc);
m_mi = ii; m_mi = ii;
m_mj = jj; m_mj = jj;
dc.EndDrawing();
} }
((LifeFrame *) wxGetApp().GetTopWindow())->UpdateInfoText(); ((LifeFrame *) wxGetApp().GetTopWindow())->UpdateInfoText();

View File

@@ -33,22 +33,6 @@ them.
\latexignore{\rtfignore{\wxheading{Members}}} \latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxDC::BeginDrawing}\label{wxdcbegindrawing}
\func{void}{BeginDrawing}{\void}
Allows optimization of drawing code under MS Windows. Enclose
drawing primitives between {\bf BeginDrawing} and {\bf EndDrawing}\rtfsp
calls.
Drawing to a wxDialog panel device context outside of a
system-generated OnPaint event {\it requires} this pair of calls to
enclose drawing code. This is because a Windows dialog box does not have
a retained device context associated with it, and selections such as pen
and brush settings would be lost if the device context were obtained and
released for each drawing operation.
\membersection{wxDC::Blit}\label{wxdcblit} \membersection{wxDC::Blit}\label{wxdcblit}
\func{bool}{Blit}{\param{wxCoord}{ xdest}, \param{wxCoord}{ ydest}, \param{wxCoord}{ width}, \param{wxCoord}{ height}, \func{bool}{Blit}{\param{wxCoord}{ xdest}, \param{wxCoord}{ ydest}, \param{wxCoord}{ width}, \param{wxCoord}{ height},
@@ -556,15 +540,6 @@ wxUSE\_DC\_CACHEING preprocessor symbol for portability.
Ends a document (only relevant when outputting to a printer). Ends a document (only relevant when outputting to a printer).
\membersection{wxDC::EndDrawing}\label{wxdcenddrawing}
\func{void}{EndDrawing}{\void}
Allows optimization of drawing code under MS Windows. Enclose
drawing primitives between {\bf BeginDrawing} and {\bf EndDrawing}\rtfsp
calls.
\membersection{wxDC::EndPage}\label{wxdcendpage} \membersection{wxDC::EndPage}\label{wxdcendpage}
\func{void}{EndPage}{\void} \func{void}{EndPage}{\void}

View File

@@ -136,8 +136,10 @@ public:
~wxDCBase() { } ~wxDCBase() { }
virtual void BeginDrawing() { } #if WXWIN_COMPATIBILITY_2_6
virtual void EndDrawing() { } wxDEPRECATED( virtual void BeginDrawing() );
wxDEPRECATED( virtual void EndDrawing() );
#endif // WXWIN_COMPATIBILITY_2_6
// graphic primitives // graphic primitives
// ------------------ // ------------------

View File

@@ -44,9 +44,6 @@ public:
virtual bool Ok() const; virtual bool Ok() const;
virtual void BeginDrawing() {}
virtual void EndDrawing() {}
bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style=wxFLOOD_SURFACE ); bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style=wxFLOOD_SURFACE );
bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const; bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const;

View File

@@ -202,9 +202,6 @@ public:
bool Ok() const; bool Ok() const;
virtual void BeginDrawing() {}
virtual void EndDrawing() {}
bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style=wxFLOOD_SURFACE ); bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style=wxFLOOD_SURFACE );
bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const; bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const;
void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);

View File

@@ -213,7 +213,6 @@ void MyCanvas::OnPaint (wxPaintEvent &)
size_t numImages = m_images.GetCount(); size_t numImages = m_images.GetCount();
wxPaintDC dc(this); wxPaintDC dc(this);
dc.BeginDrawing();
dc.SetTextForeground(wxColour(255, 255, 255)); dc.SetTextForeground(wxColour(255, 255, 255));
dc.DrawText(wxT("Click on the canvas to draw a duck."), 10, 10); dc.DrawText(wxT("Click on the canvas to draw a duck."), 10, 10);
@@ -222,8 +221,6 @@ void MyCanvas::OnPaint (wxPaintEvent &)
MyRenderedImage & image = m_images.Item(i); MyRenderedImage & image = m_images.Item(i);
dc.DrawBitmap(image.m_bmp, image.m_x, image.m_y, true); dc.DrawBitmap(image.m_bmp, image.m_x, image.m_y, true);
} }
dc.EndDrawing();
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -33,6 +33,16 @@
// implementation // implementation
// ============================================================================ // ============================================================================
#if WXWIN_COMPATIBILITY_2_6
void wxDCBase::BeginDrawing()
{
}
void wxDCBase::EndDrawing()
{
}
#endif // WXWIN_COMPATIBILITY_2_6
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// special symbols // special symbols
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -367,8 +367,6 @@ void wxGenericColourDialog::InitializeColours(void)
void wxGenericColourDialog::PaintBasicColours(wxDC& dc) void wxGenericColourDialog::PaintBasicColours(wxDC& dc)
{ {
dc.BeginDrawing();
int i; int i;
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
{ {
@@ -387,13 +385,10 @@ void wxGenericColourDialog::PaintBasicColours(wxDC& dc)
dc.DrawRectangle( x, y, smallRectangleSize.x, smallRectangleSize.y); dc.DrawRectangle( x, y, smallRectangleSize.x, smallRectangleSize.y);
} }
} }
dc.EndDrawing();
} }
void wxGenericColourDialog::PaintCustomColours(wxDC& dc) void wxGenericColourDialog::PaintCustomColours(wxDC& dc)
{ {
dc.BeginDrawing();
int i; int i;
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
{ {
@@ -413,7 +408,6 @@ void wxGenericColourDialog::PaintCustomColours(wxDC& dc)
dc.DrawRectangle( x, y, smallRectangleSize.x, smallRectangleSize.y); dc.DrawRectangle( x, y, smallRectangleSize.x, smallRectangleSize.y);
} }
} }
dc.EndDrawing();
} }
void wxGenericColourDialog::PaintHighlight(wxDC& dc, bool draw) void wxGenericColourDialog::PaintHighlight(wxDC& dc, bool draw)
@@ -421,8 +415,6 @@ void wxGenericColourDialog::PaintHighlight(wxDC& dc, bool draw)
if ( colourSelection < 0 ) if ( colourSelection < 0 )
return; return;
dc.BeginDrawing();
// Number of pixels bigger than the standard rectangle size // Number of pixels bigger than the standard rectangle size
// for drawing a highlight // for drawing a highlight
int deltaX = 2; int deltaX = 2;
@@ -462,14 +454,10 @@ void wxGenericColourDialog::PaintHighlight(wxDC& dc, bool draw)
dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.DrawRectangle( x, y, (smallRectangleSize.x + (2*deltaX)), (smallRectangleSize.y + (2*deltaY))); dc.DrawRectangle( x, y, (smallRectangleSize.x + (2*deltaX)), (smallRectangleSize.y + (2*deltaY)));
} }
dc.EndDrawing();
} }
void wxGenericColourDialog::PaintCustomColour(wxDC& dc) void wxGenericColourDialog::PaintCustomColour(wxDC& dc)
{ {
dc.BeginDrawing();
dc.SetPen(*wxBLACK_PEN); dc.SetPen(*wxBLACK_PEN);
wxBrush *brush = new wxBrush(colourData.m_dataColour, wxSOLID); wxBrush *brush = new wxBrush(colourData.m_dataColour, wxSOLID);
@@ -480,8 +468,6 @@ void wxGenericColourDialog::PaintCustomColour(wxDC& dc)
dc.SetBrush(wxNullBrush); dc.SetBrush(wxNullBrush);
delete brush; delete brush;
dc.EndDrawing();
} }
void wxGenericColourDialog::OnBasicColourClick(int which) void wxGenericColourDialog::OnBasicColourClick(int which)

View File

@@ -1683,8 +1683,6 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
PrepareDC( dc ); PrepareDC( dc );
AdjustDC( dc ); AdjustDC( dc );
dc.BeginDrawing();
dc.SetFont( GetFont() ); dc.SetFont( GetFont() );
// width and height of the entire header window // width and height of the entire header window
@@ -1794,8 +1792,6 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
x += wCol; x += wCol;
} }
dc.EndDrawing();
} }
void wxListHeaderWindow::DrawCurrent() void wxListHeaderWindow::DrawCurrent()
@@ -2591,8 +2587,6 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
int dev_x, dev_y; int dev_x, dev_y;
CalcScrolledPosition( 0, 0, &dev_x, &dev_y ); CalcScrolledPosition( 0, 0, &dev_x, &dev_y );
dc.BeginDrawing();
dc.SetFont( GetFont() ); dc.SetFont( GetFont() );
if ( InReportView() ) if ( InReportView() )
@@ -2700,8 +2694,6 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
} }
} }
#endif #endif
dc.EndDrawing();
} }
void wxListMainWindow::HighlightAll( bool on ) void wxListMainWindow::HighlightAll( bool on )

View File

@@ -58,12 +58,8 @@ wxMemoryDC::wxMemoryDC(wxDC *dc)
{ {
wxCHECK_RET( dc, _T("NULL dc in wxMemoryDC ctor") ); wxCHECK_RET( dc, _T("NULL dc in wxMemoryDC ctor") );
dc->BeginDrawing();
CreateCompatible(dc); CreateCompatible(dc);
dc->EndDrawing();
Init(); Init();
} }

View File

@@ -122,8 +122,6 @@ bool wxMetafile::Play(wxDC *dc)
if (!m_refData) if (!m_refData)
return false; return false;
dc->BeginDrawing();
if (dc->GetHDC() && M_METAFILEDATA->m_metafile) if (dc->GetHDC() && M_METAFILEDATA->m_metafile)
{ {
if ( !::PlayMetaFile(GetHdcOf(*dc), (HMETAFILE) if ( !::PlayMetaFile(GetHdcOf(*dc), (HMETAFILE)
@@ -133,8 +131,6 @@ bool wxMetafile::Play(wxDC *dc)
} }
} }
dc->EndDrawing();
return true; return true;
} }

View File

@@ -813,7 +813,6 @@ void wxActiveXContainer::OnPaint(wxPaintEvent& WXUNUSED(event))
// Draw only when control is windowless or deactivated // Draw only when control is windowless or deactivated
if (m_viewObject) if (m_viewObject)
{ {
dc.BeginDrawing();
int w, h; int w, h;
GetParent()->GetSize(&w, &h); GetParent()->GetSize(&w, &h);
RECT posRect; RECT posRect;
@@ -830,8 +829,6 @@ void wxActiveXContainer::OnPaint(wxPaintEvent& WXUNUSED(event))
RECTL *prcBounds = (RECTL *) &posRect; RECTL *prcBounds = (RECTL *) &posRect;
m_viewObject->Draw(DVASPECT_CONTENT, -1, NULL, NULL, NULL, m_viewObject->Draw(DVASPECT_CONTENT, -1, NULL, NULL, NULL,
(HDC)dc.GetHDC(), prcBounds, NULL, NULL, 0); (HDC)dc.GetHDC(), prcBounds, NULL, NULL, 0);
dc.EndDrawing();
} }
// We've got this one I think // We've got this one I think

View File

@@ -4079,14 +4079,11 @@ bool wxWindowMSW::HandleEraseBkgnd(WXHDC hdc)
dc.SetHDC(hdc); dc.SetHDC(hdc);
dc.SetWindow((wxWindow *)this); dc.SetWindow((wxWindow *)this);
dc.BeginDrawing();
wxEraseEvent event(m_windowId, &dc); wxEraseEvent event(m_windowId, &dc);
event.SetEventObject(this); event.SetEventObject(this);
bool rc = GetEventHandler()->ProcessEvent(event); bool rc = GetEventHandler()->ProcessEvent(event);
dc.EndDrawing();
// must be called manually as ~wxDC doesn't do anything for wxDCTemp // must be called manually as ~wxDC doesn't do anything for wxDCTemp
dc.SelectOldObjects(hdc); dc.SelectOldObjects(hdc);

View File

@@ -38,9 +38,7 @@ wxMemoryDC::wxMemoryDC(
wxDC* pOldDC wxDC* pOldDC
) )
{ {
pOldDC->BeginDrawing();
CreateCompatible(pOldDC); CreateCompatible(pOldDC);
pOldDC->EndDrawing();
Init(); Init();
} // end of wxMemoryDC::wxMemoryDC } // end of wxMemoryDC::wxMemoryDC

View File

@@ -93,13 +93,9 @@ bool wxMetafile::Play(wxDC *dc)
if (!m_refData) if (!m_refData)
return FALSE; return FALSE;
dc->BeginDrawing();
// if (dc->GetHDC() && M_METAFILEDATA->m_metafile) // if (dc->GetHDC() && M_METAFILEDATA->m_metafile)
// PlayMetaFile((HDC) dc->GetHDC(), (HMETAFILE) M_METAFILEDATA->m_metafile); // PlayMetaFile((HDC) dc->GetHDC(), (HMETAFILE) M_METAFILEDATA->m_metafile);
dc->EndDrawing();
return true; return true;
} }

View File

@@ -3737,7 +3737,6 @@ bool wxWindowOS2::HandleEraseBkgnd( WXHDC hDC )
vDC.m_hPS = (HPS)hDC; // this is really a PS vDC.m_hPS = (HPS)hDC; // this is really a PS
vDC.SetWindow((wxWindow*)this); vDC.SetWindow((wxWindow*)this);
vDC.BeginDrawing();
wxEraseEvent vEvent(m_windowId, &vDC); wxEraseEvent vEvent(m_windowId, &vDC);
@@ -3745,7 +3744,6 @@ bool wxWindowOS2::HandleEraseBkgnd( WXHDC hDC )
rc = GetEventHandler()->ProcessEvent(vEvent); rc = GetEventHandler()->ProcessEvent(vEvent);
vDC.EndDrawing();
vDC.m_hPS = NULLHANDLE; vDC.m_hPS = NULLHANDLE;
return true; return true;
} // end of wxWindowOS2::HandleEraseBkgnd } // end of wxWindowOS2::HandleEraseBkgnd

View File

@@ -678,7 +678,6 @@ void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) {
PRectangle rcClient = GetClientRectangle(); PRectangle rcClient = GetClientRectangle();
paintingAllText = rcPaint.Contains(rcClient); paintingAllText = rcPaint.Contains(rcClient);
dc->BeginDrawing();
ClipChildren(*dc, rcPaint); ClipChildren(*dc, rcPaint);
Paint(surfaceWindow, rcPaint); Paint(surfaceWindow, rcPaint);
@@ -689,7 +688,6 @@ void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) {
FullPaint(); FullPaint();
} }
paintState = notPainting; paintState = notPainting;
dc->EndDrawing();
} }