]>
git.saurik.com Git - wxWidgets.git/blob - src/dfb/dc.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/dfb/dc.cpp
4 // Author: Vaclav Slavik
7 // Copyright: (c) 2006 REA Elektronik GmbH
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // ===========================================================================
13 // ===========================================================================
15 // ---------------------------------------------------------------------------
17 // ---------------------------------------------------------------------------
19 // For compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
31 #include "wx/dfb/private.h"
33 // these values are used to initialize newly created DC
34 #define DEFAULT_FONT (*wxNORMAL_FONT)
35 #define DEFAULT_PEN (*wxBLACK_PEN)
36 #define DEFAULT_BRUSH (*wxWHITE_BRUSH)
38 // ===========================================================================
40 // ===========================================================================
42 //-----------------------------------------------------------------------------
44 //-----------------------------------------------------------------------------
46 IMPLEMENT_ABSTRACT_CLASS(wxDC
, wxDCBase
)
48 // Default constructor
54 wxDC::wxDC(const wxIDirectFBSurfacePtr
& surface
)
59 void wxDC::Init(const wxIDirectFBSurfacePtr
& surface
)
61 m_ok
= (surface
!= NULL
);
62 wxCHECK_RET( surface
!= NULL
, _T("invalid surface") );
66 m_mm_to_pix_x
= (double)wxGetDisplaySize().GetWidth() /
67 (double)wxGetDisplaySizeMM().GetWidth();
68 m_mm_to_pix_y
= (double)wxGetDisplaySize().GetHeight() /
69 (double)wxGetDisplaySizeMM().GetHeight();
71 SetFont(DEFAULT_FONT
);
73 SetBrush(DEFAULT_BRUSH
);
77 // ---------------------------------------------------------------------------
79 // ---------------------------------------------------------------------------
82 #define DO_SET_CLIPPING_BOX(rg) \
84 wxRect rect = rg.GetBox(); \
85 m_clipX1 = (wxCoord) XDEV2LOG(rect.GetLeft()); \
86 m_clipY1 = (wxCoord) YDEV2LOG(rect.GetTop()); \
87 m_clipX2 = (wxCoord) XDEV2LOG(rect.GetRight()); \
88 m_clipY2 = (wxCoord) YDEV2LOG(rect.GetBottom()); \
91 void wxDC::DoSetClippingRegion(wxCoord cx
, wxCoord cy
, wxCoord cw
, wxCoord ch
)
93 wxCHECK_RET( Ok(), wxT("invalid dc") );
98 r
.x2
= r
.x1
+ XLOG2DEVREL(cw
) - 1;
99 r
.y2
= r
.y1
+ YLOG2DEVREL(ch
) - 1;
101 if ( !m_surface
->SetClip(&r
) )
106 m_clipX2
= cx
+ cw
- 1;
107 m_clipY2
= cy
+ ch
-1;
111 void wxDC::DoSetClippingRegionAsRegion(const wxRegion
& region
)
113 // NB: this can be done because wxDFB only supports
114 // rectangular regions
115 SetClippingRegion(region
.AsRect());
118 void wxDC::DestroyClippingRegion()
120 wxCHECK_RET( Ok(), wxT("invalid dc") );
122 m_surface
->SetClip(NULL
);
127 // ---------------------------------------------------------------------------
128 // query capabilities
129 // ---------------------------------------------------------------------------
131 int wxDC::GetDepth() const
133 return m_surface
->GetDepth();
136 // ---------------------------------------------------------------------------
138 // ---------------------------------------------------------------------------
142 wxCHECK_RET( Ok(), wxT("invalid dc") );
144 if ( m_backgroundBrush
.GetStyle() == wxTRANSPARENT
)
147 wxColour clr
= m_backgroundBrush
.GetColour();
148 m_surface
->Clear(clr
.Red(), clr
.Green(), clr
.Blue(), clr
.Alpha());
151 extern bool wxDoFloodFill(wxDC
*dc
, wxCoord x
, wxCoord y
,
152 const wxColour
& col
, int style
);
154 bool wxDC::DoFloodFill(wxCoord x
, wxCoord y
,
155 const wxColour
& col
, int style
)
157 return wxDoFloodFill(this, x
, y
, col
, style
);
160 bool wxDC::DoGetPixel(wxCoord x
, wxCoord y
, wxColour
*col
) const
162 wxCHECK_MSG( col
, false, _T("NULL colour parameter in wxDC::GetPixel"));
164 wxFAIL_MSG( _T("GetPixel not implemented") );
168 void wxDC::DoCrossHair(wxCoord x
, wxCoord y
)
170 wxCHECK_RET( Ok(), wxT("invalid dc") );
172 wxFAIL_MSG( _T("CrossHair not implemented") );
175 void wxDC::DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
)
177 wxCHECK_RET( Ok(), wxT("invalid dc") );
179 if ( m_pen
.GetStyle() == wxTRANSPARENT
)
182 m_surface
->DrawLine(XLOG2DEV(x1
), YLOG2DEV(y1
),
183 XLOG2DEV(x2
), YLOG2DEV(y2
));
185 CalcBoundingBox(x1
, y1
);
186 CalcBoundingBox(x2
, y2
);
189 // Draws an arc of a circle, centred on (xc, yc), with starting point (x1, y1)
190 // and ending at (x2, y2)
191 void wxDC::DoDrawArc(wxCoord x1
, wxCoord y1
,
192 wxCoord x2
, wxCoord y2
,
193 wxCoord xc
, wxCoord yc
)
195 wxCHECK_RET( Ok(), wxT("invalid dc") );
197 wxFAIL_MSG( _T("DrawArc not implemented") );
200 void wxDC::DoDrawPoint(wxCoord x
, wxCoord y
)
202 wxCHECK_RET( Ok(), wxT("invalid dc") );
204 // NB: DirectFB API doesn't provide a function for drawing points, so
205 // implement it as 1px long line. This is inefficient, but then, so is
206 // using DrawPoint() for drawing more than a few points.
207 DoDrawLine(x
, y
, x
, y
);
209 // FIXME_DFB: implement special cases for common formats (RGB24,RGBA/RGB32)
212 void wxDC::DoDrawPolygon(int n
, wxPoint points
[], wxCoord xoffset
, wxCoord yoffset
,int WXUNUSED(fillStyle
))
214 wxCHECK_RET( Ok(), wxT("invalid dc") );
216 wxFAIL_MSG( _T("DrawPolygon not implemented") );
219 void wxDC::DoDrawLines(int n
, wxPoint points
[], wxCoord xoffset
, wxCoord yoffset
)
221 wxCHECK_RET( Ok(), wxT("invalid dc") );
223 // TODO: impl. using DirectDB's DrawLines
224 wxFAIL_MSG( _T("DrawLines not implemented") );
227 void wxDC::DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
229 wxCHECK_RET( Ok(), wxT("invalid dc") );
231 wxCoord xx
= XLOG2DEV(x
);
232 wxCoord yy
= YLOG2DEV(y
);
233 wxCoord ww
= m_signX
* XLOG2DEVREL(width
);
234 wxCoord hh
= m_signY
* YLOG2DEVREL(height
);
236 if ( ww
== 0 || hh
== 0 ) return;
249 if ( m_brush
.GetStyle() != wxTRANSPARENT
)
251 SelectColour(m_brush
.GetColour());
252 m_surface
->FillRectangle(xx
, yy
, ww
, hh
);
253 // restore pen's colour
254 SelectColour(m_pen
.GetColour());
257 if ( m_pen
.GetStyle() != wxTRANSPARENT
)
259 m_surface
->DrawRectangle(xx
, yy
, ww
, hh
);
262 CalcBoundingBox(x
, y
);
263 CalcBoundingBox(x
+ width
, y
+ height
);
266 void wxDC::DoDrawRoundedRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
, double radius
)
268 wxCHECK_RET( Ok(), wxT("invalid dc") );
270 wxFAIL_MSG( _T("DrawRoundedRectangle not implemented") );
273 void wxDC::DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
275 wxCHECK_RET( Ok(), wxT("invalid dc") );
277 wxFAIL_MSG( _T("DrawElipse not implemented") );
280 void wxDC::DoDrawEllipticArc(wxCoord x
,wxCoord y
,wxCoord w
,wxCoord h
,double sa
,double ea
)
282 wxCHECK_RET( Ok(), wxT("invalid dc") );
284 wxFAIL_MSG( _T("DrawElipticArc not implemented") );
287 void wxDC::DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
)
289 wxCHECK_RET( Ok(), wxT("invalid dc") );
291 wxCoord xx
= XLOG2DEV(x
);
292 wxCoord yy
= YLOG2DEV(y
);
294 // update the bounding box
296 CalcBoundingBox(x
, y
);
297 GetTextExtent(text
, &w
, &h
);
298 CalcBoundingBox(x
+ w
, y
+ h
);
300 // if background mode is solid, DrawText must paint text's background:
301 if ( m_backgroundMode
== wxSOLID
)
303 wxCHECK_RET( m_backgroundBrush
.Ok(), wxT("invalid background brush") );
305 SelectColour(m_backgroundBrush
.GetColour());
306 m_surface
->FillRectangle(xx
, yy
, XLOG2DEVREL(w
), YLOG2DEVREL(h
));
307 // restore pen's colour
308 SelectColour(m_pen
.GetColour());
311 // finally draw the text itself:
312 m_surface
->DrawString(wxSTR_TO_DFB(text
), -1, xx
, yy
, DSTF_LEFT
| DSTF_TOP
);
315 void wxDC::DoDrawRotatedText(const wxString
& text
,
316 wxCoord x
, wxCoord y
,
319 wxCHECK_RET( Ok(), wxT("invalid dc") );
321 wxFAIL_MSG( _T("DrawRotatedText not implemented") );
324 // ---------------------------------------------------------------------------
326 // ---------------------------------------------------------------------------
328 void wxDC::SetPen(const wxPen
& pen
)
330 m_pen
= pen
.Ok() ? pen
: DEFAULT_PEN
;
332 SelectColour(m_pen
.GetColour());
335 void wxDC::SetBrush(const wxBrush
& brush
)
337 m_brush
= brush
.Ok() ? brush
: DEFAULT_BRUSH
;
340 void wxDC::SelectColour(const wxColour
& clr
)
342 m_surface
->SetColor(clr
.Red(), clr
.Green(), clr
.Blue(), clr
.Alpha());
343 #warning "use SetColorIndex?"
347 void wxDC::SetPalette(const wxPalette
& WXUNUSED(palette
))
349 wxCHECK_RET( Ok(), wxT("invalid dc") );
351 wxFAIL_MSG( _T("SetPalette not implemented") );
353 #endif // wxUSE_PALETTE
355 void wxDC::SetFont(const wxFont
& font
)
357 wxCHECK_RET( Ok(), wxT("invalid dc") );
359 wxFont
f(font
.Ok() ? font
: DEFAULT_FONT
);
361 if ( !m_surface
->SetFont(f
.GetDirectFBFont()) )
367 void wxDC::SetBackground(const wxBrush
& brush
)
369 wxCHECK_RET( Ok(), wxT("invalid dc") );
371 if (!brush
.Ok()) return;
373 m_backgroundBrush
= brush
;
376 void wxDC::SetBackgroundMode(int mode
)
378 m_backgroundMode
= mode
;
381 void wxDC::SetLogicalFunction(int function
)
383 wxCHECK_RET( Ok(), wxT("invalid dc") );
385 wxFAIL_MSG( _T("SetLogicalFunction not implemented") );
387 m_logicalFunction
= function
;
390 bool wxDC::StartDoc(const wxString
& WXUNUSED(message
))
392 // We might be previewing, so return true to let it continue.
400 void wxDC::StartPage()
408 // ---------------------------------------------------------------------------
410 // ---------------------------------------------------------------------------
412 wxCoord
wxDC::GetCharHeight() const
414 wxCHECK_MSG( Ok(), -1, wxT("invalid dc") );
415 wxCHECK_MSG( m_font
.Ok(), -1, wxT("no font selected") );
418 m_font
.GetDirectFBFont()->GetHeight(&h
);
419 return YDEV2LOGREL(h
);
422 wxCoord
wxDC::GetCharWidth() const
424 wxCHECK_MSG( Ok(), -1, wxT("invalid dc") );
425 wxCHECK_MSG( m_font
.Ok(), -1, wxT("no font selected") );
428 m_font
.GetDirectFBFont()->GetStringWidth("H", 1, &w
);
429 // VS: YDEV is corrent, it should *not* be XDEV, because font's are only
430 // scaled according to m_scaleY
431 return YDEV2LOGREL(w
);
434 void wxDC::DoGetTextExtent(const wxString
& string
, wxCoord
*x
, wxCoord
*y
,
435 wxCoord
*descent
, wxCoord
*externalLeading
,
436 wxFont
*theFont
) const
438 wxCHECK_RET( Ok(), wxT("invalid dc") );
439 wxCHECK_RET( m_font
.Ok(), wxT("no font selected") );
440 wxCHECK_RET( !theFont
|| theFont
->Ok(), wxT("invalid font") );
443 if ( theFont
!= NULL
)
446 wxConstCast(this, wxDC
)->SetFont(*theFont
);
449 wxCoord xx
= 0, yy
= 0;
451 wxIDirectFBFontPtr f
= m_font
.GetDirectFBFont();
453 if ( f
->GetStringExtents(wxSTR_TO_DFB(string
), -1, &rect
, NULL
) )
455 // VS: YDEV is corrent, it should *not* be XDEV, because font's are
456 // only scaled according to m_scaleY
457 xx
= YDEV2LOGREL(rect
.w
);
458 yy
= YDEV2LOGREL(rect
.h
);
463 if ( f
->GetDescender(&d
) )
464 *descent
= YDEV2LOGREL(-d
);
472 if ( externalLeading
) *externalLeading
= 0;
474 if ( theFont
!= NULL
)
475 wxConstCast(this, wxDC
)->SetFont(oldFont
);
480 // ---------------------------------------------------------------------------
482 // ---------------------------------------------------------------------------
484 void wxDC::ComputeScaleAndOrigin()
486 m_scaleX
= m_logicalScaleX
* m_userScaleX
;
487 m_scaleY
= m_logicalScaleY
* m_userScaleY
;
489 // FIXME_DFB: scaling affects pixel size of font, pens, brushes, which
490 // is not currently implemented here; probably makes sense to
491 // switch to Cairo instead of implementing everything for DFB
492 wxASSERT_MSG( m_scaleX
== 1.0 && m_scaleY
== 1.0,
493 _T("scaling is not implemented in wxDFB") );
496 void wxDC::SetMapMode(int mode
)
498 #warning "move this to common code, it's shared by almost all ports!"
502 SetLogicalScale(twips2mm
*m_mm_to_pix_x
, twips2mm
*m_mm_to_pix_y
);
505 SetLogicalScale(pt2mm
*m_mm_to_pix_x
, pt2mm
*m_mm_to_pix_y
);
508 SetLogicalScale(m_mm_to_pix_x
, m_mm_to_pix_y
);
511 SetLogicalScale(m_mm_to_pix_x
/10.0, m_mm_to_pix_y
/10.0);
515 SetLogicalScale(1.0, 1.0);
518 m_mappingMode
= mode
;
521 void wxDC::SetUserScale(double x
, double y
)
523 #warning "move this to common code?"
524 // allow negative ? -> no
527 ComputeScaleAndOrigin();
530 void wxDC::SetLogicalScale(double x
, double y
)
532 #warning "move this to common code?"
536 ComputeScaleAndOrigin();
539 void wxDC::SetLogicalOrigin( wxCoord x
, wxCoord y
)
541 #warning "move this to common code?"
542 m_logicalOriginX
= x
* m_signX
; // is this still correct ?
543 m_logicalOriginY
= y
* m_signY
;
544 ComputeScaleAndOrigin();
547 void wxDC::SetDeviceOrigin( wxCoord x
, wxCoord y
)
549 #warning "move this to common code?"
550 // only wxPostScripDC has m_signX = -1, we override SetDeviceOrigin there
553 ComputeScaleAndOrigin();
556 void wxDC::SetAxisOrientation( bool xLeftRight
, bool yBottomUp
)
558 #warning "move this to common code?"
559 // only wxPostScripDC has m_signX = -1, we override SetAxisOrientation there
560 m_signX
= (xLeftRight
? 1 : -1);
561 m_signY
= (yBottomUp
? -1 : 1);
562 ComputeScaleAndOrigin();
565 // ---------------------------------------------------------------------------
566 // coordinates transformations
567 // ---------------------------------------------------------------------------
569 wxCoord
wxDCBase::DeviceToLogicalX(wxCoord x
) const
571 return ((wxDC
*)this)->XDEV2LOG(x
);
574 wxCoord
wxDCBase::DeviceToLogicalY(wxCoord y
) const
576 return ((wxDC
*)this)->YDEV2LOG(y
);
579 wxCoord
wxDCBase::DeviceToLogicalXRel(wxCoord x
) const
581 return ((wxDC
*)this)->XDEV2LOGREL(x
);
584 wxCoord
wxDCBase::DeviceToLogicalYRel(wxCoord y
) const
586 return ((wxDC
*)this)->YDEV2LOGREL(y
);
589 wxCoord
wxDCBase::LogicalToDeviceX(wxCoord x
) const
591 return ((wxDC
*)this)->XLOG2DEV(x
);
594 wxCoord
wxDCBase::LogicalToDeviceY(wxCoord y
) const
596 return ((wxDC
*)this)->YLOG2DEV(y
);
599 wxCoord
wxDCBase::LogicalToDeviceXRel(wxCoord x
) const
601 return ((wxDC
*)this)->XLOG2DEVREL(x
);
604 wxCoord
wxDCBase::LogicalToDeviceYRel(wxCoord y
) const
606 return ((wxDC
*)this)->YLOG2DEVREL(y
);
610 void wxDC::DoGetSize(int *w
, int *h
) const
612 wxCHECK_RET( Ok(), wxT("invalid dc") );
614 m_surface
->GetSize(w
, h
);
617 void wxDC::DoGetSizeMM(int *width
, int *height
) const
619 #warning "move this to common code?"
623 if ( width
) *width
= int(double(w
) / (m_userScaleX
*m_mm_to_pix_x
));
624 if ( height
) *height
= int(double(h
) / (m_userScaleY
*m_mm_to_pix_y
));
627 wxSize
wxDC::GetPPI() const
629 #warning "move this to common code?"
630 return wxSize(int(double(m_mm_to_pix_x
) * inches2mm
),
631 int(double(m_mm_to_pix_y
) * inches2mm
));
635 // ---------------------------------------------------------------------------
637 // ---------------------------------------------------------------------------
639 bool wxDC::DoBlit(wxCoord xdest
, wxCoord ydest
,
640 wxCoord width
, wxCoord height
,
641 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
,
642 int rop
, bool useMask
,
643 wxCoord xsrcMask
, wxCoord ysrcMask
)
648 wxCHECK_MSG( Ok(), false, wxT("invalid dc") );
649 wxCHECK_MSG( source
, false, wxT("invalid source dc") );
651 // transform the source DC coords to the device ones
652 xsrc
= source
->LogicalToDeviceX(xsrc
);
653 ysrc
= source
->LogicalToDeviceY(ysrc
);
655 /* FIXME_MGL: use the mask origin when drawing transparently */
656 if (xsrcMask
== -1 && ysrcMask
== -1)
658 xsrcMask
= xsrc
; ysrcMask
= ysrc
;
662 xsrcMask
= source
->LogicalToDeviceX(xsrcMask
);
663 ysrcMask
= source
->LogicalToDeviceY(ysrcMask
);
666 CalcBoundingBox(xdest
, ydest
);
667 CalcBoundingBox(xdest
+ width
, ydest
+ height
);
669 /* scale/translate size and position */
670 wxCoord xx
= XLOG2DEV(xdest
);
671 wxCoord yy
= YLOG2DEV(ydest
);
672 wxCoord ww
= XLOG2DEVREL(width
);
673 wxCoord hh
= YLOG2DEVREL(height
);
675 if ( source
->m_isMemDC
)
677 wxMemoryDC
*memDC
= (wxMemoryDC
*) source
;
678 DoDrawSubBitmap(memDC
->GetSelectedObject(), xsrc
, ysrc
, ww
, hh
,
679 xdest
, ydest
, rop
, useMask
);
683 m_MGLDC
->makeCurrent(); // will go away with MGL6.0
684 m_MGLDC
->bitBlt(*source
->GetMGLDC(),
685 xsrc
, ysrc
, xsrc
+ ww
, ysrc
+ hh
,
686 xx
, yy
, LogicalFunctionToMGLRop(rop
));
693 void wxDC::DoDrawBitmap(const wxBitmap
&bmp
, wxCoord x
, wxCoord y
, bool useMask
)
695 wxCHECK_RET( Ok(), wxT("invalid dc") );
696 wxCHECK_RET( bmp
.Ok(), wxT("invalid bitmap") );
698 wxCoord w
= bmp
.GetWidth();
699 wxCoord h
= bmp
.GetHeight();
701 DoDrawSubBitmap(bmp
, 0, 0, w
, h
, x
, y
, m_logicalFunction
, useMask
);
704 void wxDC::DoDrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
)
706 // VZ: egcs 1.0.3 refuses to compile this without cast, no idea why
707 DoDrawBitmap((const wxBitmap
&)icon
, x
, y
, true);
710 void wxDC::DoDrawSubBitmap(const wxBitmap
&bmp
,
711 wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
,
712 wxCoord destx
, wxCoord desty
, int rop
, bool useMask
)
715 wxCHECK_RET( Ok(), wxT("invalid dc") );
716 wxCHECK_RET( bmp
.Ok(), wxT("invalid bitmap") );
718 CalcBoundingBox(x
, y
);
719 CalcBoundingBox(x
+ w
, y
+ h
);
721 wxCoord dx
= XLOG2DEV(destx
);
722 wxCoord dy
= YLOG2DEV(desty
);
723 wxCoord dw
= XLOG2DEVREL(w
);
724 wxCoord dh
= YLOG2DEVREL(h
);
726 m_MGLDC
->makeCurrent(); // will go away with MGL6.0
728 bool useStretching
= ((w
!= dw
) || (h
!= dh
));
729 bool putSection
= (w
!= bmp
.GetWidth() || h
!= bmp
.GetHeight());
730 MGL_writeModeType mglRop
= (MGL_writeModeType
)LogicalFunctionToMGLRop(rop
);
732 if ( bmp
.GetDepth() == 1 )
734 // Mono bitmaps are handled in special way -- all 1s are drawn in
735 // foreground colours, all 0s in background colour.
737 ((wxBitmap
&)bmp
).SetMonoPalette(m_textForegroundColour
, m_textBackgroundColour
);
740 if ( useMask
&& bmp
.GetMask() )
742 // Since MGL does not support masks directly (in MGL, mask is handled
743 // in same way as in wxImage, i.e. there is one "key" color), we
744 // simulate masked bitblt in 6 steps (same as in MSW):
746 // 1. Create a temporary bitmap and copy the destination area into it.
747 // 2. Copy the source area into the temporary bitmap using the
748 // specified logical function.
749 // 3. Set the masked area in the temporary bitmap to BLACK by ANDing
750 // the mask bitmap with the temp bitmap with the foreground colour
751 // set to WHITE and the bg colour set to BLACK.
752 // 4. Set the unmasked area in the destination area to BLACK by
753 // ANDing the mask bitmap with the destination area with the
754 // foreground colour set to BLACK and the background colour set
756 // 5. OR the temporary bitmap with the destination area.
757 // 6. Delete the temporary bitmap.
759 // This sequence of operations ensures that the source's transparent
760 // area need not be black, and logical functions are supported.
762 wxBitmap
*mask
= bmp
.GetMask()->GetBitmap();
766 if ( GetDepth() <= 8 )
768 temp
= new MGLMemoryDC(dw
, dh
, GetDepth(), NULL
);
770 tempdc
.SetMGLDC(temp
, false);
771 tempdc
.SetPalette(m_palette
);
776 m_MGLDC
->getPixelFormat(pf
);
777 temp
= new MGLMemoryDC(dw
, dh
, GetDepth(), &pf
);
780 wxCHECK_RET( temp
->isValid(), wxT("cannot create temporary dc") );
782 temp
->bitBlt(*m_MGLDC
, dx
, dy
, dx
+ dw
, dy
+ dh
, 0, 0, MGL_REPLACE_MODE
);
784 DoBitBlt(bmp
, temp
, x
, y
, w
, h
, 0, 0, dw
, dh
, mglRop
,
785 useStretching
, putSection
);
787 mask
->SetMonoPalette(wxColour(0,0,0), wxColour(255,255,255));
788 DoBitBlt(*mask
, temp
, x
, y
, w
, h
, 0, 0, dw
, dh
, MGL_R2_MASKSRC
,
789 useStretching
, putSection
);
790 DoBitBlt(*mask
, m_MGLDC
, x
, y
, w
, h
, dx
, dy
, dw
, dh
, MGL_R2_MASKNOTSRC
,
791 useStretching
, putSection
);
793 m_MGLDC
->bitBlt(*temp
, 0, 0, dw
, dh
, dx
, dy
, MGL_OR_MODE
);
800 DoBitBlt(bmp
, m_MGLDC
, x
, y
, w
, h
, dx
, dy
, dw
, dh
, mglRop
,
801 useStretching
, putSection
);