]> git.saurik.com Git - wxWidgets.git/commitdiff
Added demo of strange rectangle behaviour
authorJulian Smart <julian@anthemion.co.uk>
Thu, 17 Feb 2000 11:04:26 +0000 (11:04 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 17 Feb 2000 11:04:26 +0000 (11:04 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6107 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/drawing/drawing.cpp

index a5e06a3925692ab797fa2de7a55e710ed88d7357..47a069d5d0d229141c50ca5b08ac5a32a190772c 100644 (file)
@@ -696,6 +696,37 @@ void MyCanvas::DrawDefault(wxDC& dc)
     dc.DrawLine(400, 270, 400, 310);
     dc.DrawLine(300, 300, 410, 300);
 
+    // Added by JACS to demonstrate bizarre behaviour.
+    // With a size of 70, we get a missing red RHS,
+    // and the hight is too small, so we get yellow
+    // showing. With a size of 40, it draws as expected:
+    // it just shows a white rectangle with red outline.
+    int totalWidth = 70;
+    int totalHeight = 70;
+    wxBitmap bitmap2(totalWidth, totalHeight);
+
+    wxMemoryDC memdc2;
+    memdc2.SelectObject(bitmap2);
+
+    memdc2.SetBackground(*wxWHITE_BRUSH);
+
+    // Draw a yellow rectangle filling the bitmap
+    memdc2.SetPen(wxPen(wxColour(255, 255, 0), 1, wxSOLID));
+    memdc2.SetBrush(wxBrush(wxColour(255, 255, 0), wxSOLID));
+    memdc2.DrawRectangle(0, 0, totalWidth+2, totalHeight+2); // Just to make sure!
+
+    // Now draw a white rectangle with red outline. It should
+    // entirely eclipse the yellow background.
+    memdc2.SetPen(*wxRED_PEN);
+    memdc2.SetBrush(*wxWHITE_BRUSH);
+
+    memdc2.DrawRectangle(0, 0, totalWidth, totalHeight);
+
+    memdc2.SelectObject(wxNullBitmap);
+    memdc2.SetPen(wxNullPen);
+    memdc2.SetBrush(wxNullBrush);
+
+    dc.DrawBitmap(bitmap2, 500, 270);
 }
 
 void MyCanvas::DrawText(wxDC& dc)