]>
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 // ===========================================================================
35 // ===========================================================================
37 //-----------------------------------------------------------------------------
39 //-----------------------------------------------------------------------------
41 IMPLEMENT_ABSTRACT_CLASS(wxDC
, wxDCBase
)
43 // Default constructor
49 wxDC::wxDC(const IDirectFBSurfacePtr
& surface
)
54 void wxDC::Init(const IDirectFBSurfacePtr
& surface
)
56 m_ok
= (surface
!= NULL
);
57 wxCHECK_RET( surface
!= NULL
, _T("invalid surface") );
61 m_mm_to_pix_x
= (double)wxGetDisplaySize().GetWidth() /
62 (double)wxGetDisplaySizeMM().GetWidth();
63 m_mm_to_pix_y
= (double)wxGetDisplaySize().GetHeight() /
64 (double)wxGetDisplaySizeMM().GetHeight();
66 SetFont(*wxNORMAL_FONT
);
68 SetBrush(*wxWHITE_BRUSH
);
72 // ---------------------------------------------------------------------------
74 // ---------------------------------------------------------------------------
77 #define DO_SET_CLIPPING_BOX(rg) \
79 wxRect rect = rg.GetBox(); \
80 m_clipX1 = (wxCoord) XDEV2LOG(rect.GetLeft()); \
81 m_clipY1 = (wxCoord) YDEV2LOG(rect.GetTop()); \
82 m_clipX2 = (wxCoord) XDEV2LOG(rect.GetRight()); \
83 m_clipY2 = (wxCoord) YDEV2LOG(rect.GetBottom()); \
86 void wxDC::DoSetClippingRegion(wxCoord cx
, wxCoord cy
, wxCoord cw
, wxCoord ch
)
88 wxCHECK_RET( Ok(), wxT("invalid dc") );
93 r
.x2
= r
.x1
+ XLOG2DEVREL(cw
) - 1;
94 r
.y2
= r
.y1
+ XLOG2DEVREL(ch
) - 1;
96 if ( !DFB_CALL( m_surface
->SetClip(m_surface
, &r
) ) )
101 m_clipX2
= cx
+ cw
- 1;
102 m_clipY2
= cy
+ ch
-1;
106 void wxDC::DoSetClippingRegionAsRegion(const wxRegion
& region
)
108 // NB: this can be done because wxDFB only supports
109 // rectangular regions
110 SetClippingRegion(region
.AsRect());
113 void wxDC::DestroyClippingRegion()
115 wxCHECK_RET( Ok(), wxT("invalid dc") );
117 DFB_CALL( m_surface
->SetClip(m_surface
, NULL
) );
122 // ---------------------------------------------------------------------------
123 // query capabilities
124 // ---------------------------------------------------------------------------
126 int wxDC::GetDepth() const
128 return wxDfbGetSurfaceDepth(m_surface
);
131 // ---------------------------------------------------------------------------
133 // ---------------------------------------------------------------------------
137 wxCHECK_RET( Ok(), wxT("invalid dc") );
139 if ( m_backgroundBrush
.GetStyle() == wxTRANSPARENT
)
142 wxColour clr
= m_backgroundBrush
.GetColour();
143 DFB_CALL( m_surface
->Clear(m_surface
,
144 clr
.Red(), clr
.Green(), clr
.Blue(), 255) );
147 extern bool wxDoFloodFill(wxDC
*dc
, wxCoord x
, wxCoord y
,
148 const wxColour
& col
, int style
);
150 bool wxDC::DoFloodFill(wxCoord x
, wxCoord y
,
151 const wxColour
& col
, int style
)
153 return wxDoFloodFill(this, x
, y
, col
, style
);
156 bool wxDC::DoGetPixel(wxCoord x
, wxCoord y
, wxColour
*col
) const
158 wxCHECK_MSG( col
, false, _T("NULL colour parameter in wxDC::GetPixel"));
160 wxFAIL_MSG( _T("GetPixel not implemented") );
164 void wxDC::DoCrossHair(wxCoord x
, wxCoord y
)
166 wxCHECK_RET( Ok(), wxT("invalid dc") );
168 wxFAIL_MSG( _T("CrossHair not implemented") );
171 void wxDC::DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
)
173 wxCHECK_RET( Ok(), wxT("invalid dc") );
175 if ( m_pen
.GetStyle() == wxTRANSPARENT
)
178 DFB_CALL( m_surface
->DrawLine(m_surface
,
179 XLOG2DEV(x1
), YLOG2DEV(y1
),
180 XLOG2DEV(x2
), YLOG2DEV(y2
)) );
182 CalcBoundingBox(x1
, y1
);
183 CalcBoundingBox(x2
, y2
);
186 // Draws an arc of a circle, centred on (xc, yc), with starting point (x1, y1)
187 // and ending at (x2, y2)
188 void wxDC::DoDrawArc(wxCoord x1
, wxCoord y1
,
189 wxCoord x2
, wxCoord y2
,
190 wxCoord xc
, wxCoord yc
)
192 wxCHECK_RET( Ok(), wxT("invalid dc") );
194 wxFAIL_MSG( _T("DrawArc not implemented") );
197 void wxDC::DoDrawPoint(wxCoord x
, wxCoord y
)
199 wxCHECK_RET( Ok(), wxT("invalid dc") );
201 wxFAIL_MSG( _T("DrawPoint not implemented") );
204 void wxDC::DoDrawPolygon(int n
, wxPoint points
[], wxCoord xoffset
, wxCoord yoffset
,int WXUNUSED(fillStyle
))
206 wxCHECK_RET( Ok(), wxT("invalid dc") );
208 wxFAIL_MSG( _T("DrawPolygon not implemented") );
211 void wxDC::DoDrawLines(int n
, wxPoint points
[], wxCoord xoffset
, wxCoord yoffset
)
213 wxCHECK_RET( Ok(), wxT("invalid dc") );
215 // TODO: impl. using DirectDB's DrawLines
216 wxFAIL_MSG( _T("DrawLines not implemented") );
219 void wxDC::DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
221 wxCHECK_RET( Ok(), wxT("invalid dc") );
223 wxCoord xx
= XLOG2DEV(x
);
224 wxCoord yy
= YLOG2DEV(y
);
225 wxCoord ww
= m_signX
* XLOG2DEVREL(width
);
226 wxCoord hh
= m_signY
* YLOG2DEVREL(height
);
228 if ( ww
== 0 || hh
== 0 ) return;
241 if ( m_brush
.GetStyle() != wxTRANSPARENT
)
243 SelectColour(m_brush
.GetColour());
244 DFB_CALL( m_surface
->FillRectangle(m_surface
, xx
, yy
, ww
, hh
) );
245 // restore pen's colour
246 SelectColour(m_pen
.GetColour());
249 if ( m_pen
.GetStyle() != wxTRANSPARENT
)
251 DFB_CALL( m_surface
->DrawRectangle(m_surface
, xx
, yy
, ww
, hh
) );
254 CalcBoundingBox(x
, y
);
255 CalcBoundingBox(x
+ width
, y
+ height
);
258 void wxDC::DoDrawRoundedRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
, double radius
)
260 wxCHECK_RET( Ok(), wxT("invalid dc") );
262 wxFAIL_MSG( _T("DrawRoundedRectangle not implemented") );
265 void wxDC::DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
267 wxCHECK_RET( Ok(), wxT("invalid dc") );
269 wxFAIL_MSG( _T("DrawElipse not implemented") );
272 void wxDC::DoDrawEllipticArc(wxCoord x
,wxCoord y
,wxCoord w
,wxCoord h
,double sa
,double ea
)
274 wxCHECK_RET( Ok(), wxT("invalid dc") );
276 wxFAIL_MSG( _T("DrawElipticArc not implemented") );
279 void wxDC::DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
)
281 wxCHECK_RET( Ok(), wxT("invalid dc") );
283 wxCoord xx
= XLOG2DEV(x
);
284 wxCoord yy
= XLOG2DEV(y
);
286 // update the bounding box
288 CalcBoundingBox(x
, y
);
289 GetTextExtent(text
, &w
, &h
);
290 CalcBoundingBox(x
+ w
, y
+ h
);
292 // if background mode is solid, DrawText must paint text's background:
293 if ( m_backgroundMode
== wxSOLID
)
295 wxCHECK_RET( m_backgroundBrush
.Ok(), wxT("invalid background brush") );
297 SelectColour(m_backgroundBrush
.GetColour());
298 DFB_CALL( m_surface
->FillRectangle(m_surface
,
300 XLOG2DEVREL(w
), YLOG2DEVREL(h
)) );
301 // restore pen's colour
302 SelectColour(m_pen
.GetColour());
305 // finally draw the text itself:
306 DFB_CALL(m_surface
->DrawString(m_surface
,
307 wxSTR_TO_DFB(text
), -1,
309 DFBSurfaceTextFlags(DSTF_LEFT
| DSTF_TOP
)));
312 void wxDC::DoDrawRotatedText(const wxString
& text
,
313 wxCoord x
, wxCoord y
,
316 wxCHECK_RET( Ok(), wxT("invalid dc") );
318 wxFAIL_MSG( _T("DrawRotatedText not implemented") );
321 // ---------------------------------------------------------------------------
323 // ---------------------------------------------------------------------------
325 void wxDC::SetPen(const wxPen
& pen
)
327 if ( !pen
.Ok() ) return;
330 SelectColour(m_pen
.GetColour());
333 void wxDC::SetBrush(const wxBrush
& brush
)
335 if ( !brush
.Ok() ) return;
339 void wxDC::SelectColour(const wxColour
& clr
)
341 DFB_CALL( m_surface
->SetColor(m_surface
,
342 clr
.Red(), clr
.Green(), clr
.Blue(), 255) );
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") );
362 if ( !DFB_CALL( m_surface
->SetFont(m_surface
, font
.GetDirectFBFont()) ) )
368 void wxDC::SetBackground(const wxBrush
& brush
)
370 wxCHECK_RET( Ok(), wxT("invalid dc") );
372 if (!brush
.Ok()) return;
374 m_backgroundBrush
= brush
;
377 void wxDC::SetBackgroundMode(int mode
)
379 m_backgroundMode
= mode
;
382 void wxDC::SetLogicalFunction(int function
)
384 wxCHECK_RET( Ok(), wxT("invalid dc") );
386 wxFAIL_MSG( _T("SetLogicalFunction not implemented") );
388 m_logicalFunction
= function
;
391 bool wxDC::StartDoc(const wxString
& WXUNUSED(message
))
393 // We might be previewing, so return true to let it continue.
401 void wxDC::StartPage()
409 // ---------------------------------------------------------------------------
411 // ---------------------------------------------------------------------------
413 wxCoord
wxDC::GetCharHeight() const
415 wxCHECK_MSG( Ok(), -1, wxT("invalid dc") );
416 wxCHECK_MSG( m_font
.Ok(), -1, wxT("no font selected") );
419 IDirectFBFontPtr f
= m_font
.GetDirectFBFont();
420 DFB_CALL( f
->GetHeight(f
, &h
) );
421 return YDEV2LOGREL(h
);
424 wxCoord
wxDC::GetCharWidth() const
426 wxCHECK_MSG( Ok(), -1, wxT("invalid dc") );
427 wxCHECK_MSG( m_font
.Ok(), -1, wxT("no font selected") );
430 IDirectFBFontPtr f
= m_font
.GetDirectFBFont();
431 DFB_CALL( f
->GetStringWidth(f
, "H", 1, &w
) );
432 // VS: YDEV is corrent, it should *not* be XDEV, because font's are only
433 // scaled according to m_scaleY
434 return YDEV2LOGREL(w
);
437 void wxDC::DoGetTextExtent(const wxString
& string
, wxCoord
*x
, wxCoord
*y
,
438 wxCoord
*descent
, wxCoord
*externalLeading
,
439 wxFont
*theFont
) const
441 wxCHECK_RET( Ok(), wxT("invalid dc") );
442 wxCHECK_RET( m_font
.Ok(), wxT("no font selected") );
443 wxCHECK_RET( !theFont
|| theFont
->Ok(), wxT("invalid font") );
446 if ( theFont
!= NULL
)
449 wxConstCast(this, wxDC
)->SetFont(*theFont
);
452 wxCoord xx
= 0, yy
= 0;
454 IDirectFBFontPtr f
= m_font
.GetDirectFBFont();
456 if (DFB_CALL(f
->GetStringExtents(f
, wxSTR_TO_DFB(string
), -1, &rect
, NULL
)))
458 // VS: YDEV is corrent, it should *not* be XDEV, because font's are
459 // only scaled according to m_scaleY
460 xx
= YDEV2LOGREL(rect
.w
);
461 yy
= YDEV2LOGREL(rect
.h
);
466 if ( DFB_CALL( f
->GetDescender(f
, &d
) ) )
467 *descent
= YDEV2LOGREL(-d
);
475 if ( externalLeading
) *externalLeading
= 0;
477 if ( theFont
!= NULL
)
478 wxConstCast(this, wxDC
)->SetFont(oldFont
);
483 // ---------------------------------------------------------------------------
485 // ---------------------------------------------------------------------------
487 void wxDC::ComputeScaleAndOrigin()
489 m_scaleX
= m_logicalScaleX
* m_userScaleX
;
490 m_scaleY
= m_logicalScaleY
* m_userScaleY
;
492 // FIXME_DFB: scaling affects pixel size of font, pens, brushes, which
493 // is not currently implemented here; probably makes sense to
494 // switch to Cairo instead of implementing everything for DFB
495 wxASSERT_MSG( m_scaleX
== 1.0 && m_scaleY
== 1.0,
496 _T("scaling is not implemented in wxDFB") );
499 void wxDC::SetMapMode(int mode
)
501 #warning "move this to common code, it's shared by almost all ports!"
505 SetLogicalScale(twips2mm
*m_mm_to_pix_x
, twips2mm
*m_mm_to_pix_y
);
508 SetLogicalScale(pt2mm
*m_mm_to_pix_x
, pt2mm
*m_mm_to_pix_y
);
511 SetLogicalScale(m_mm_to_pix_x
, m_mm_to_pix_y
);
514 SetLogicalScale(m_mm_to_pix_x
/10.0, m_mm_to_pix_y
/10.0);
518 SetLogicalScale(1.0, 1.0);
521 m_mappingMode
= mode
;
524 void wxDC::SetUserScale(double x
, double y
)
526 #warning "move this to common code?"
527 // allow negative ? -> no
530 ComputeScaleAndOrigin();
533 void wxDC::SetLogicalScale(double x
, double y
)
535 #warning "move this to common code?"
539 ComputeScaleAndOrigin();
542 void wxDC::SetLogicalOrigin( wxCoord x
, wxCoord y
)
544 #warning "move this to common code?"
545 m_logicalOriginX
= x
* m_signX
; // is this still correct ?
546 m_logicalOriginY
= y
* m_signY
;
547 ComputeScaleAndOrigin();
550 void wxDC::SetDeviceOrigin( wxCoord x
, wxCoord y
)
552 #warning "move this to common code?"
553 // only wxPostScripDC has m_signX = -1, we override SetDeviceOrigin there
556 ComputeScaleAndOrigin();
559 void wxDC::SetAxisOrientation( bool xLeftRight
, bool yBottomUp
)
561 #warning "move this to common code?"
562 // only wxPostScripDC has m_signX = -1, we override SetAxisOrientation there
563 m_signX
= (xLeftRight
? 1 : -1);
564 m_signY
= (yBottomUp
? -1 : 1);
565 ComputeScaleAndOrigin();
568 // ---------------------------------------------------------------------------
569 // coordinates transformations
570 // ---------------------------------------------------------------------------
572 wxCoord
wxDCBase::DeviceToLogicalX(wxCoord x
) const
574 return ((wxDC
*)this)->XDEV2LOG(x
);
577 wxCoord
wxDCBase::DeviceToLogicalY(wxCoord y
) const
579 return ((wxDC
*)this)->YDEV2LOG(y
);
582 wxCoord
wxDCBase::DeviceToLogicalXRel(wxCoord x
) const
584 return ((wxDC
*)this)->XDEV2LOGREL(x
);
587 wxCoord
wxDCBase::DeviceToLogicalYRel(wxCoord y
) const
589 return ((wxDC
*)this)->YDEV2LOGREL(y
);
592 wxCoord
wxDCBase::LogicalToDeviceX(wxCoord x
) const
594 return ((wxDC
*)this)->XLOG2DEV(x
);
597 wxCoord
wxDCBase::LogicalToDeviceY(wxCoord y
) const
599 return ((wxDC
*)this)->YLOG2DEV(y
);
602 wxCoord
wxDCBase::LogicalToDeviceXRel(wxCoord x
) const
604 return ((wxDC
*)this)->XLOG2DEVREL(x
);
607 wxCoord
wxDCBase::LogicalToDeviceYRel(wxCoord y
) const
609 return ((wxDC
*)this)->YLOG2DEVREL(y
);
613 void wxDC::DoGetSize(int *w
, int *h
) const
615 wxCHECK_RET( Ok(), wxT("invalid dc") );
617 DFB_CALL( m_surface
->GetSize(m_surface
, w
, h
) );
620 void wxDC::DoGetSizeMM(int *width
, int *height
) const
622 #warning "move this to common code?"
626 if ( width
) *width
= int(double(w
) / (m_userScaleX
*m_mm_to_pix_x
));
627 if ( height
) *height
= int(double(h
) / (m_userScaleY
*m_mm_to_pix_y
));
630 wxSize
wxDC::GetPPI() const
632 #warning "move this to common code?"
633 return wxSize(int(double(m_mm_to_pix_x
) * inches2mm
),
634 int(double(m_mm_to_pix_y
) * inches2mm
));
638 // ---------------------------------------------------------------------------
640 // ---------------------------------------------------------------------------
642 bool wxDC::DoBlit(wxCoord xdest
, wxCoord ydest
,
643 wxCoord width
, wxCoord height
,
644 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
,
645 int rop
, bool useMask
,
646 wxCoord xsrcMask
, wxCoord ysrcMask
)
651 wxCHECK_MSG( Ok(), false, wxT("invalid dc") );
652 wxCHECK_MSG( source
, false, wxT("invalid source dc") );
654 // transform the source DC coords to the device ones
655 xsrc
= source
->LogicalToDeviceX(xsrc
);
656 ysrc
= source
->LogicalToDeviceY(ysrc
);
658 /* FIXME_MGL: use the mask origin when drawing transparently */
659 if (xsrcMask
== -1 && ysrcMask
== -1)
661 xsrcMask
= xsrc
; ysrcMask
= ysrc
;
665 xsrcMask
= source
->LogicalToDeviceX(xsrcMask
);
666 ysrcMask
= source
->LogicalToDeviceY(ysrcMask
);
669 CalcBoundingBox(xdest
, ydest
);
670 CalcBoundingBox(xdest
+ width
, ydest
+ height
);
672 /* scale/translate size and position */
673 wxCoord xx
= XLOG2DEV(xdest
);
674 wxCoord yy
= YLOG2DEV(ydest
);
675 wxCoord ww
= XLOG2DEVREL(width
);
676 wxCoord hh
= YLOG2DEVREL(height
);
678 if ( source
->m_isMemDC
)
680 wxMemoryDC
*memDC
= (wxMemoryDC
*) source
;
681 DoDrawSubBitmap(memDC
->GetSelectedObject(), xsrc
, ysrc
, ww
, hh
,
682 xdest
, ydest
, rop
, useMask
);
686 m_MGLDC
->makeCurrent(); // will go away with MGL6.0
687 m_MGLDC
->bitBlt(*source
->GetMGLDC(),
688 xsrc
, ysrc
, xsrc
+ ww
, ysrc
+ hh
,
689 xx
, yy
, LogicalFunctionToMGLRop(rop
));
696 void wxDC::DoDrawBitmap(const wxBitmap
&bmp
, wxCoord x
, wxCoord y
, bool useMask
)
698 wxCHECK_RET( Ok(), wxT("invalid dc") );
699 wxCHECK_RET( bmp
.Ok(), wxT("invalid bitmap") );
701 wxCoord w
= bmp
.GetWidth();
702 wxCoord h
= bmp
.GetHeight();
704 DoDrawSubBitmap(bmp
, 0, 0, w
, h
, x
, y
, m_logicalFunction
, useMask
);
707 void wxDC::DoDrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
)
709 // VZ: egcs 1.0.3 refuses to compile this without cast, no idea why
710 DoDrawBitmap((const wxBitmap
&)icon
, x
, y
, true);
713 void wxDC::DoDrawSubBitmap(const wxBitmap
&bmp
,
714 wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
,
715 wxCoord destx
, wxCoord desty
, int rop
, bool useMask
)
718 wxCHECK_RET( Ok(), wxT("invalid dc") );
719 wxCHECK_RET( bmp
.Ok(), wxT("invalid bitmap") );
721 CalcBoundingBox(x
, y
);
722 CalcBoundingBox(x
+ w
, y
+ h
);
724 wxCoord dx
= XLOG2DEV(destx
);
725 wxCoord dy
= YLOG2DEV(desty
);
726 wxCoord dw
= XLOG2DEVREL(w
);
727 wxCoord dh
= YLOG2DEVREL(h
);
729 m_MGLDC
->makeCurrent(); // will go away with MGL6.0
731 bool useStretching
= ((w
!= dw
) || (h
!= dh
));
732 bool putSection
= (w
!= bmp
.GetWidth() || h
!= bmp
.GetHeight());
733 MGL_writeModeType mglRop
= (MGL_writeModeType
)LogicalFunctionToMGLRop(rop
);
735 if ( bmp
.GetDepth() == 1 )
737 // Mono bitmaps are handled in special way -- all 1s are drawn in
738 // foreground colours, all 0s in background colour.
740 ((wxBitmap
&)bmp
).SetMonoPalette(m_textForegroundColour
, m_textBackgroundColour
);
743 if ( useMask
&& bmp
.GetMask() )
745 // Since MGL does not support masks directly (in MGL, mask is handled
746 // in same way as in wxImage, i.e. there is one "key" color), we
747 // simulate masked bitblt in 6 steps (same as in MSW):
749 // 1. Create a temporary bitmap and copy the destination area into it.
750 // 2. Copy the source area into the temporary bitmap using the
751 // specified logical function.
752 // 3. Set the masked area in the temporary bitmap to BLACK by ANDing
753 // the mask bitmap with the temp bitmap with the foreground colour
754 // set to WHITE and the bg colour set to BLACK.
755 // 4. Set the unmasked area in the destination area to BLACK by
756 // ANDing the mask bitmap with the destination area with the
757 // foreground colour set to BLACK and the background colour set
759 // 5. OR the temporary bitmap with the destination area.
760 // 6. Delete the temporary bitmap.
762 // This sequence of operations ensures that the source's transparent
763 // area need not be black, and logical functions are supported.
765 wxBitmap
*mask
= bmp
.GetMask()->GetBitmap();
769 if ( GetDepth() <= 8 )
771 temp
= new MGLMemoryDC(dw
, dh
, GetDepth(), NULL
);
773 tempdc
.SetMGLDC(temp
, false);
774 tempdc
.SetPalette(m_palette
);
779 m_MGLDC
->getPixelFormat(pf
);
780 temp
= new MGLMemoryDC(dw
, dh
, GetDepth(), &pf
);
783 wxCHECK_RET( temp
->isValid(), wxT("cannot create temporary dc") );
785 temp
->bitBlt(*m_MGLDC
, dx
, dy
, dx
+ dw
, dy
+ dh
, 0, 0, MGL_REPLACE_MODE
);
787 DoBitBlt(bmp
, temp
, x
, y
, w
, h
, 0, 0, dw
, dh
, mglRop
,
788 useStretching
, putSection
);
790 mask
->SetMonoPalette(wxColour(0,0,0), wxColour(255,255,255));
791 DoBitBlt(*mask
, temp
, x
, y
, w
, h
, 0, 0, dw
, dh
, MGL_R2_MASKSRC
,
792 useStretching
, putSection
);
793 DoBitBlt(*mask
, m_MGLDC
, x
, y
, w
, h
, dx
, dy
, dw
, dh
, MGL_R2_MASKNOTSRC
,
794 useStretching
, putSection
);
796 m_MGLDC
->bitBlt(*temp
, 0, 0, dw
, dh
, dx
, dy
, MGL_OR_MODE
);
803 DoBitBlt(bmp
, m_MGLDC
, x
, y
, w
, h
, dx
, dy
, dw
, dh
, mglRop
,
804 useStretching
, putSection
);