]>
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") );
95 wxSize
size(GetSize());
97 // NB: We intersect the clipping rectangle with surface's area here because
98 // DirectFB will return an error if you try to set clipping rectangle
99 // that is partially outside of the surface.
101 r
.x1
= wxMax(0, XLOG2DEV(cx
));
102 r
.y1
= wxMax(0, YLOG2DEV(cy
));
103 r
.x2
= wxMin(r
.x1
+ XLOG2DEVREL(cw
), size
.x
) - 1;
104 r
.y2
= wxMin(r
.y1
+ YLOG2DEVREL(ch
), size
.y
) - 1;
106 if ( !m_surface
->SetClip(&r
) )
111 m_clipX2
= cx
+ cw
- 1;
112 m_clipY2
= cy
+ ch
-1;
116 void wxDC::DoSetClippingRegionAsRegion(const wxRegion
& region
)
118 // NB: this can be done because wxDFB only supports
119 // rectangular regions
120 SetClippingRegion(region
.AsRect());
123 void wxDC::DestroyClippingRegion()
125 wxCHECK_RET( Ok(), wxT("invalid dc") );
127 m_surface
->SetClip(NULL
);
132 // ---------------------------------------------------------------------------
133 // query capabilities
134 // ---------------------------------------------------------------------------
136 int wxDC::GetDepth() const
138 return m_surface
->GetDepth();
141 // ---------------------------------------------------------------------------
143 // ---------------------------------------------------------------------------
147 wxCHECK_RET( Ok(), wxT("invalid dc") );
149 if ( m_backgroundBrush
.GetStyle() == wxTRANSPARENT
)
152 wxColour clr
= m_backgroundBrush
.GetColour();
153 m_surface
->Clear(clr
.Red(), clr
.Green(), clr
.Blue(), clr
.Alpha());
155 wxSize
size(GetSize());
156 CalcBoundingBox(XDEV2LOG(0), YDEV2LOG(0));
157 CalcBoundingBox(XDEV2LOG(size
.x
), YDEV2LOG(size
.y
));
160 extern bool wxDoFloodFill(wxDC
*dc
, wxCoord x
, wxCoord y
,
161 const wxColour
& col
, int style
);
163 bool wxDC::DoFloodFill(wxCoord x
, wxCoord y
,
164 const wxColour
& col
, int style
)
166 return wxDoFloodFill(this, x
, y
, col
, style
);
169 bool wxDC::DoGetPixel(wxCoord x
, wxCoord y
, wxColour
*col
) const
171 wxCHECK_MSG( col
, false, _T("NULL colour parameter in wxDC::GetPixel"));
173 wxFAIL_MSG( _T("GetPixel not implemented") );
177 void wxDC::DoCrossHair(wxCoord x
, wxCoord y
)
179 wxCHECK_RET( Ok(), wxT("invalid dc") );
181 wxFAIL_MSG( _T("CrossHair not implemented") );
184 void wxDC::DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
)
186 wxCHECK_RET( Ok(), wxT("invalid dc") );
188 if ( m_pen
.GetStyle() == wxTRANSPARENT
)
191 m_surface
->DrawLine(XLOG2DEV(x1
), YLOG2DEV(y1
),
192 XLOG2DEV(x2
), YLOG2DEV(y2
));
194 CalcBoundingBox(x1
, y1
);
195 CalcBoundingBox(x2
, y2
);
198 // Draws an arc of a circle, centred on (xc, yc), with starting point (x1, y1)
199 // and ending at (x2, y2)
200 void wxDC::DoDrawArc(wxCoord x1
, wxCoord y1
,
201 wxCoord x2
, wxCoord y2
,
202 wxCoord xc
, wxCoord yc
)
204 wxCHECK_RET( Ok(), wxT("invalid dc") );
206 wxFAIL_MSG( _T("DrawArc not implemented") );
209 void wxDC::DoDrawPoint(wxCoord x
, wxCoord y
)
211 wxCHECK_RET( Ok(), wxT("invalid dc") );
213 // NB: DirectFB API doesn't provide a function for drawing points, so
214 // implement it as 1px long line. This is inefficient, but then, so is
215 // using DrawPoint() for drawing more than a few points.
216 DoDrawLine(x
, y
, x
, y
);
218 // FIXME_DFB: implement special cases for common formats (RGB24,RGBA/RGB32)
221 void wxDC::DoDrawPolygon(int n
, wxPoint points
[], wxCoord xoffset
, wxCoord yoffset
,int WXUNUSED(fillStyle
))
223 wxCHECK_RET( Ok(), wxT("invalid dc") );
225 wxFAIL_MSG( _T("DrawPolygon not implemented") );
228 void wxDC::DoDrawLines(int n
, wxPoint points
[], wxCoord xoffset
, wxCoord yoffset
)
230 wxCHECK_RET( Ok(), wxT("invalid dc") );
232 // TODO: impl. using DirectDB's DrawLines
233 wxFAIL_MSG( _T("DrawLines not implemented") );
236 void wxDC::DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
238 wxCHECK_RET( Ok(), wxT("invalid dc") );
240 wxCoord xx
= XLOG2DEV(x
);
241 wxCoord yy
= YLOG2DEV(y
);
242 wxCoord ww
= m_signX
* XLOG2DEVREL(width
);
243 wxCoord hh
= m_signY
* YLOG2DEVREL(height
);
245 if ( ww
== 0 || hh
== 0 ) return;
258 if ( m_brush
.GetStyle() != wxTRANSPARENT
)
260 SelectColour(m_brush
.GetColour());
261 m_surface
->FillRectangle(xx
, yy
, ww
, hh
);
262 // restore pen's colour, because other drawing functions expect the
263 // colour to be set to the pen:
264 SelectColour(m_pen
.GetColour());
267 if ( m_pen
.GetStyle() != wxTRANSPARENT
)
269 m_surface
->DrawRectangle(xx
, yy
, ww
, hh
);
272 CalcBoundingBox(x
, y
);
273 CalcBoundingBox(x
+ width
, y
+ height
);
276 void wxDC::DoDrawRoundedRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
, double radius
)
278 wxCHECK_RET( Ok(), wxT("invalid dc") );
280 wxFAIL_MSG( _T("DrawRoundedRectangle not implemented") );
283 void wxDC::DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
)
285 wxCHECK_RET( Ok(), wxT("invalid dc") );
287 wxFAIL_MSG( _T("DrawElipse not implemented") );
290 void wxDC::DoDrawEllipticArc(wxCoord x
,wxCoord y
,wxCoord w
,wxCoord h
,double sa
,double ea
)
292 wxCHECK_RET( Ok(), wxT("invalid dc") );
294 wxFAIL_MSG( _T("DrawElipticArc not implemented") );
297 void wxDC::DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
)
299 wxCHECK_RET( Ok(), wxT("invalid dc") );
301 wxCoord xx
= XLOG2DEV(x
);
302 wxCoord yy
= YLOG2DEV(y
);
304 // update the bounding box
306 CalcBoundingBox(x
, y
);
307 GetTextExtent(text
, &w
, &h
);
308 CalcBoundingBox(x
+ w
, y
+ h
);
310 // if background mode is solid, DrawText must paint text's background:
311 if ( m_backgroundMode
== wxSOLID
)
313 wxCHECK_RET( m_textBackgroundColour
.Ok(),
314 wxT("invalid background color") );
316 SelectColour(m_textBackgroundColour
);
317 m_surface
->FillRectangle(xx
, yy
, XLOG2DEVREL(w
), YLOG2DEVREL(h
));
320 // finally draw the text itself:
321 wxCHECK_RET( m_textForegroundColour
.Ok(),
322 wxT("invalid foreground color") );
323 SelectColour(m_textForegroundColour
);
324 m_surface
->DrawString(wxSTR_TO_DFB(text
), -1, xx
, yy
, DSTF_LEFT
| DSTF_TOP
);
326 // restore pen's colour, because other drawing functions expect the colour
327 // to be set to the pen:
328 SelectColour(m_pen
.GetColour());
331 void wxDC::DoDrawRotatedText(const wxString
& text
,
332 wxCoord x
, wxCoord y
,
335 wxCHECK_RET( Ok(), wxT("invalid dc") );
337 wxFAIL_MSG( _T("DrawRotatedText not implemented") );
340 // ---------------------------------------------------------------------------
342 // ---------------------------------------------------------------------------
344 void wxDC::SetPen(const wxPen
& pen
)
346 m_pen
= pen
.Ok() ? pen
: DEFAULT_PEN
;
348 SelectColour(m_pen
.GetColour());
351 void wxDC::SetBrush(const wxBrush
& brush
)
353 m_brush
= brush
.Ok() ? brush
: DEFAULT_BRUSH
;
356 void wxDC::SelectColour(const wxColour
& clr
)
358 m_surface
->SetColor(clr
.Red(), clr
.Green(), clr
.Blue(), clr
.Alpha());
359 #warning "use SetColorIndex?"
363 void wxDC::SetPalette(const wxPalette
& WXUNUSED(palette
))
365 wxCHECK_RET( Ok(), wxT("invalid dc") );
367 wxFAIL_MSG( _T("SetPalette not implemented") );
369 #endif // wxUSE_PALETTE
371 void wxDC::SetFont(const wxFont
& font
)
373 wxCHECK_RET( Ok(), wxT("invalid dc") );
375 wxFont
f(font
.Ok() ? font
: DEFAULT_FONT
);
377 if ( !m_surface
->SetFont(f
.GetDirectFBFont()) )
383 void wxDC::SetBackground(const wxBrush
& brush
)
385 wxCHECK_RET( Ok(), wxT("invalid dc") );
387 if (!brush
.Ok()) return;
389 m_backgroundBrush
= brush
;
392 void wxDC::SetBackgroundMode(int mode
)
394 m_backgroundMode
= mode
;
397 void wxDC::SetLogicalFunction(int function
)
399 wxCHECK_RET( Ok(), wxT("invalid dc") );
401 // NB: we could also support XOR, but for blitting only (via DSBLIT_XOR);
402 // and possibly others via SetSrc/DstBlendFunction()
403 wxASSERT_MSG( function
== wxCOPY
,
404 _T("only wxCOPY logical function supported") );
406 m_logicalFunction
= function
;
409 bool wxDC::StartDoc(const wxString
& WXUNUSED(message
))
411 // We might be previewing, so return true to let it continue.
419 void wxDC::StartPage()
427 // ---------------------------------------------------------------------------
429 // ---------------------------------------------------------------------------
431 wxCoord
wxDC::GetCharHeight() const
433 wxCHECK_MSG( Ok(), -1, wxT("invalid dc") );
434 wxCHECK_MSG( m_font
.Ok(), -1, wxT("no font selected") );
437 m_font
.GetDirectFBFont()->GetHeight(&h
);
438 return YDEV2LOGREL(h
);
441 wxCoord
wxDC::GetCharWidth() const
443 wxCHECK_MSG( Ok(), -1, wxT("invalid dc") );
444 wxCHECK_MSG( m_font
.Ok(), -1, wxT("no font selected") );
447 m_font
.GetDirectFBFont()->GetStringWidth("H", 1, &w
);
448 // VS: YDEV is corrent, it should *not* be XDEV, because font's are only
449 // scaled according to m_scaleY
450 return YDEV2LOGREL(w
);
453 void wxDC::DoGetTextExtent(const wxString
& string
, wxCoord
*x
, wxCoord
*y
,
454 wxCoord
*descent
, wxCoord
*externalLeading
,
455 wxFont
*theFont
) const
457 wxCHECK_RET( Ok(), wxT("invalid dc") );
458 wxCHECK_RET( m_font
.Ok(), wxT("no font selected") );
459 wxCHECK_RET( !theFont
|| theFont
->Ok(), wxT("invalid font") );
462 if ( theFont
!= NULL
)
465 wxConstCast(this, wxDC
)->SetFont(*theFont
);
468 wxCoord xx
= 0, yy
= 0;
470 wxIDirectFBFontPtr f
= m_font
.GetDirectFBFont();
472 if ( f
->GetStringExtents(wxSTR_TO_DFB(string
), -1, &rect
, NULL
) )
474 // VS: YDEV is corrent, it should *not* be XDEV, because font's are
475 // only scaled according to m_scaleY
476 xx
= YDEV2LOGREL(rect
.w
);
477 yy
= YDEV2LOGREL(rect
.h
);
482 if ( f
->GetDescender(&d
) )
483 *descent
= YDEV2LOGREL(-d
);
491 if ( externalLeading
) *externalLeading
= 0;
493 if ( theFont
!= NULL
)
494 wxConstCast(this, wxDC
)->SetFont(oldFont
);
499 // ---------------------------------------------------------------------------
501 // ---------------------------------------------------------------------------
503 void wxDC::ComputeScaleAndOrigin()
505 m_scaleX
= m_logicalScaleX
* m_userScaleX
;
506 m_scaleY
= m_logicalScaleY
* m_userScaleY
;
508 // FIXME_DFB: scaling affects pixel size of font, pens, brushes, which
509 // is not currently implemented here; probably makes sense to
510 // switch to Cairo instead of implementing everything for DFB
511 wxASSERT_MSG( m_scaleX
== 1.0 && m_scaleY
== 1.0,
512 _T("scaling is not implemented in wxDFB") );
515 void wxDC::SetMapMode(int mode
)
517 #warning "move this to common code, it's shared by almost all ports!"
521 SetLogicalScale(twips2mm
*m_mm_to_pix_x
, twips2mm
*m_mm_to_pix_y
);
524 SetLogicalScale(pt2mm
*m_mm_to_pix_x
, pt2mm
*m_mm_to_pix_y
);
527 SetLogicalScale(m_mm_to_pix_x
, m_mm_to_pix_y
);
530 SetLogicalScale(m_mm_to_pix_x
/10.0, m_mm_to_pix_y
/10.0);
534 SetLogicalScale(1.0, 1.0);
537 m_mappingMode
= mode
;
540 void wxDC::SetUserScale(double x
, double y
)
542 #warning "move this to common code?"
543 // allow negative ? -> no
546 ComputeScaleAndOrigin();
549 void wxDC::SetLogicalScale(double x
, double y
)
551 #warning "move this to common code?"
555 ComputeScaleAndOrigin();
558 void wxDC::SetLogicalOrigin( wxCoord x
, wxCoord y
)
560 #warning "move this to common code?"
561 m_logicalOriginX
= x
* m_signX
; // is this still correct ?
562 m_logicalOriginY
= y
* m_signY
;
563 ComputeScaleAndOrigin();
566 void wxDC::SetDeviceOrigin( wxCoord x
, wxCoord y
)
568 #warning "move this to common code?"
569 // only wxPostScripDC has m_signX = -1, we override SetDeviceOrigin there
572 ComputeScaleAndOrigin();
575 void wxDC::SetAxisOrientation( bool xLeftRight
, bool yBottomUp
)
577 #warning "move this to common code?"
578 // only wxPostScripDC has m_signX = -1, we override SetAxisOrientation there
579 m_signX
= (xLeftRight
? 1 : -1);
580 m_signY
= (yBottomUp
? -1 : 1);
581 ComputeScaleAndOrigin();
584 // ---------------------------------------------------------------------------
585 // coordinates transformations
586 // ---------------------------------------------------------------------------
588 wxCoord
wxDCBase::DeviceToLogicalX(wxCoord x
) const
590 return ((wxDC
*)this)->XDEV2LOG(x
);
593 wxCoord
wxDCBase::DeviceToLogicalY(wxCoord y
) const
595 return ((wxDC
*)this)->YDEV2LOG(y
);
598 wxCoord
wxDCBase::DeviceToLogicalXRel(wxCoord x
) const
600 return ((wxDC
*)this)->XDEV2LOGREL(x
);
603 wxCoord
wxDCBase::DeviceToLogicalYRel(wxCoord y
) const
605 return ((wxDC
*)this)->YDEV2LOGREL(y
);
608 wxCoord
wxDCBase::LogicalToDeviceX(wxCoord x
) const
610 return ((wxDC
*)this)->XLOG2DEV(x
);
613 wxCoord
wxDCBase::LogicalToDeviceY(wxCoord y
) const
615 return ((wxDC
*)this)->YLOG2DEV(y
);
618 wxCoord
wxDCBase::LogicalToDeviceXRel(wxCoord x
) const
620 return ((wxDC
*)this)->XLOG2DEVREL(x
);
623 wxCoord
wxDCBase::LogicalToDeviceYRel(wxCoord y
) const
625 return ((wxDC
*)this)->YLOG2DEVREL(y
);
629 void wxDC::DoGetSize(int *w
, int *h
) const
631 wxCHECK_RET( Ok(), wxT("invalid dc") );
633 m_surface
->GetSize(w
, h
);
636 void wxDC::DoGetSizeMM(int *width
, int *height
) const
638 #warning "move this to common code?"
642 if ( width
) *width
= int(double(w
) / (m_userScaleX
*m_mm_to_pix_x
));
643 if ( height
) *height
= int(double(h
) / (m_userScaleY
*m_mm_to_pix_y
));
646 wxSize
wxDC::GetPPI() const
648 #warning "move this to common code?"
649 return wxSize(int(double(m_mm_to_pix_x
) * inches2mm
),
650 int(double(m_mm_to_pix_y
) * inches2mm
));
654 // ---------------------------------------------------------------------------
656 // ---------------------------------------------------------------------------
658 bool wxDC::DoBlit(wxCoord xdest
, wxCoord ydest
,
659 wxCoord width
, wxCoord height
,
660 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
,
661 int rop
, bool useMask
,
662 wxCoord xsrcMask
, wxCoord ysrcMask
)
664 wxCHECK_MSG( Ok(), false, _T("invalid dc") );
665 wxCHECK_MSG( source
, false, _T("invalid source dc") );
667 // NB: we could also support XOR here (via DSBLIT_XOR)
668 // and possibly others via SetSrc/DstBlendFunction()
669 wxCHECK_MSG( rop
== wxCOPY
, false, _T("only wxCOPY function supported") );
671 // transform the source DC coords to the device ones
672 xsrc
= source
->LogicalToDeviceX(xsrc
);
673 ysrc
= source
->LogicalToDeviceY(ysrc
);
675 // FIXME_DFB: use the mask origin when drawing transparently
676 wxASSERT_MSG( xsrcMask
== -1 && ysrcMask
== -1,
677 _T("non-default source mask offset not implemented") );
679 if (xsrcMask
== -1 && ysrcMask
== -1)
681 xsrcMask
= xsrc
; ysrcMask
= ysrc
;
685 xsrcMask
= source
->LogicalToDeviceX(xsrcMask
);
686 ysrcMask
= source
->LogicalToDeviceY(ysrcMask
);
690 wxMemoryDC
*sourceAsMemDC
= wxDynamicCast(source
, wxMemoryDC
);
693 DoDrawSubBitmap(sourceAsMemDC
->GetSelectedObject(),
702 return DoBlitFromSurface(source
->GetDirectFBSurface(),
711 void wxDC::DoDrawBitmap(const wxBitmap
&bmp
, wxCoord x
, wxCoord y
, bool useMask
)
713 wxCHECK_RET( Ok(), wxT("invalid dc") );
714 wxCHECK_RET( bmp
.Ok(), wxT("invalid bitmap") );
717 0, 0, bmp
.GetWidth(), bmp
.GetHeight(),
719 m_logicalFunction
, useMask
);
722 void wxDC::DoDrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
)
724 // VZ: egcs 1.0.3 refuses to compile this without cast, no idea why
725 DoDrawBitmap((const wxBitmap
&)icon
, x
, y
, true);
728 void wxDC::DoDrawSubBitmap(const wxBitmap
&bmp
,
729 wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
,
730 wxCoord destx
, wxCoord desty
, int rop
, bool useMask
)
732 wxCHECK_RET( Ok(), wxT("invalid dc") );
733 wxCHECK_RET( bmp
.Ok(), wxT("invalid bitmap") );
735 // NB: we could also support XOR here (via DSBLIT_XOR)
736 // and possibly others via SetSrc/DstBlendFunction()
737 wxCHECK_RET( rop
== wxCOPY
, _T("only wxCOPY function supported") );
739 if ( bmp
.GetDepth() == 1 )
741 // Mono bitmaps are handled in special way -- all 1s are drawn in
742 // foreground colours, all 0s in background colour.
743 wxFAIL_MSG( _T("drawing mono bitmaps not implemented") );
747 if ( useMask
&& bmp
.GetMask() )
749 // FIXME_DFB: see MGL sources for a way to do it, but it's not directly
750 // applicable because DirectFB doesn't implement ROPs; OTOH,
751 // it has blitting modes that can be useful; finally, see
752 // DFB's SetSrcBlendFunction() and SetSrcColorKey()
753 wxFAIL_MSG( _T("drawing bitmaps with masks not implemented") );
757 DoBlitFromSurface(bmp
.GetDirectFBSurface(),
763 bool wxDC::DoBlitFromSurface(const wxIDirectFBSurfacePtr
& src
,
764 wxCoord srcx
, wxCoord srcy
,
765 wxCoord w
, wxCoord h
,
766 wxCoord dstx
, wxCoord dsty
)
768 CalcBoundingBox(dstx
, dsty
);
769 CalcBoundingBox(dstx
+ w
, dsty
+ h
);
771 DFBRectangle srcRect
= { srcx
, srcy
, w
, h
};
772 DFBRectangle dstRect
= { XLOG2DEV(dstx
), YLOG2DEV(dsty
),
773 XLOG2DEVREL(w
), YLOG2DEVREL(h
) };
775 wxIDirectFBSurfacePtr
dst(m_surface
);
777 // FIXME: this will have to be different in useMask case, see above
778 if ( !dst
->SetBlittingFlags(DSBLIT_NOFX
) )
781 if ( srcRect
.w
!= dstRect
.w
|| srcRect
.h
!= dstRect
.h
)
783 // the bitmap is drawn stretched:
784 dst
->StretchBlit(src
, &srcRect
, &dstRect
);
788 // no stretching, size is preserved:
789 dst
->Blit(src
, &srcRect
, dstRect
.x
, dstRect
.y
);