X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4a624f6ed375e4dbf126743ff1068486cb5241a2..58cccb3b449cff705230aadb936c891b7fa6fd28:/src/common/dcbase.cpp diff --git a/src/common/dcbase.cpp b/src/common/dcbase.cpp index b63d7a4ed0..1742bf8dad 100644 --- a/src/common/dcbase.cpp +++ b/src/common/dcbase.cpp @@ -42,16 +42,26 @@ #include "wx/msw/dcscreen.h" #endif -#ifdef __WXGTK__ +#ifdef __WXGTK20__ #include "wx/gtk/dcclient.h" #include "wx/gtk/dcmemory.h" #include "wx/gtk/dcscreen.h" +#elif defined(__WXGTK__) + #include "wx/gtk1/dcclient.h" + #include "wx/gtk1/dcmemory.h" + #include "wx/gtk1/dcscreen.h" #endif #ifdef __WXMAC__ - #include "wx/mac/dcclient.h" - #include "wx/mac/dcmemory.h" - #include "wx/mac/dcscreen.h" + #include "wx/osx/dcclient.h" + #include "wx/osx/dcmemory.h" + #include "wx/osx/dcscreen.h" +#endif + +#ifdef __WXPM__ + #include "wx/os2/dcclient.h" + #include "wx/os2/dcmemory.h" + #include "wx/os2/dcscreen.h" #endif #ifdef __WXCOCOA__ @@ -60,6 +70,12 @@ #include "wx/cocoa/dcscreen.h" #endif +#ifdef __WXMOTIF__ + #include "wx/motif/dcclient.h" + #include "wx/motif/dcmemory.h" + #include "wx/motif/dcscreen.h" +#endif + #ifdef __WXX11__ #include "wx/x11/dcclient.h" #include "wx/x11/dcmemory.h" @@ -72,6 +88,12 @@ #include "wx/dfb/dcscreen.h" #endif +#ifdef __WXPALMOS__ + #include "wx/palmos/dcclient.h" + #include "wx/palmos/dcmemory.h" + #include "wx/palmos/dcscreen.h" +#endif + //---------------------------------------------------------------------------- // wxDCFactory //---------------------------------------------------------------------------- @@ -109,34 +131,25 @@ IMPLEMENT_DYNAMIC_CLASS(wxDCFactoryCleanupModule, wxModule) // wxNativeDCFactory //----------------------------------------------------------------------------- -wxDCImpl* wxNativeDCFactory::CreateWindowDC( wxWindowDC *owner ) -{ - return new wxWindowDCImpl( owner ); -} - wxDCImpl* wxNativeDCFactory::CreateWindowDC( wxWindowDC *owner, wxWindow *window ) { - return new wxWindowDCImpl( owner, window ); -} - -wxDCImpl* wxNativeDCFactory::CreateClientDC( wxClientDC *owner ) -{ - return new wxClientDCImpl( owner ); + wxDCImpl * const impl = new wxWindowDCImpl( owner, window ); + impl->InheritAttributes(window); + return impl; } wxDCImpl* wxNativeDCFactory::CreateClientDC( wxClientDC *owner, wxWindow *window ) { - return new wxClientDCImpl( owner, window ); -} - -wxDCImpl* wxNativeDCFactory::CreatePaintDC( wxPaintDC *owner ) -{ - return new wxPaintDCImpl( owner ); + wxDCImpl * const impl = new wxClientDCImpl( owner, window ); + impl->InheritAttributes(window); + return impl; } wxDCImpl* wxNativeDCFactory::CreatePaintDC( wxPaintDC *owner, wxWindow *window ) { - return new wxPaintDCImpl( owner, window ); + wxDCImpl * const impl = new wxPaintDCImpl( owner, window ); + impl->InheritAttributes(window); + return impl; } wxDCImpl* wxNativeDCFactory::CreateMemoryDC( wxMemoryDC *owner ) @@ -144,9 +157,19 @@ wxDCImpl* wxNativeDCFactory::CreateMemoryDC( wxMemoryDC *owner ) return new wxMemoryDCImpl( owner ); } -wxDCImpl* wxNativeDCFactory::CreateMemoryDC( wxMemoryDC *owner, wxBitmap &bitmap ) +wxDCImpl* wxNativeDCFactory::CreateMemoryDC(wxMemoryDC *owner, wxBitmap& bitmap) { - return new wxMemoryDCImpl( owner, bitmap ); + // the bitmap may be modified when it's selected into a memory DC so make + // sure changing this bitmap doesn't affect any other shallow copies of it + // (see wxMemoryDC::SelectObject()) + // + // notice that we don't provide any ctor equivalent to SelectObjectAsSource + // method because this should be rarely needed and easy to work around by + // using the default ctor and calling SelectObjectAsSource itself + if ( bitmap.IsOk() ) + bitmap.UnShare(); + + return new wxMemoryDCImpl(owner, bitmap); } wxDCImpl* wxNativeDCFactory::CreateMemoryDC( wxMemoryDC *owner, wxDC *dc ) @@ -277,12 +300,12 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& data) { } -wxRect wxPrinterDC::GetPaperRect() +wxRect wxPrinterDC::GetPaperRect() const { return GetImpl()->GetPaperRect(); } -int wxPrinterDC::GetResolution() +int wxPrinterDC::GetResolution() const { return GetImpl()->GetResolution(); } @@ -312,11 +335,11 @@ wxDCImpl::wxDCImpl( wxDC *owner ) , m_minX(0), m_minY(0), m_maxX(0), m_maxY(0) , m_clipX1(0), m_clipY1(0), m_clipX2(0), m_clipY2(0) , m_logicalFunction(wxCOPY) - , m_backgroundMode(wxTRANSPARENT) + , m_backgroundMode(wxBRUSHSTYLE_TRANSPARENT) , m_mappingMode(wxMM_TEXT) , m_pen() , m_brush() - , m_backgroundBrush(*wxTRANSPARENT_BRUSH) + , m_backgroundBrush() , m_textForegroundColour(*wxBLACK) , m_textBackgroundColour(*wxWHITE) , m_font() @@ -346,12 +369,12 @@ wxDCImpl::~wxDCImpl() wxCoord wxDCImpl::DeviceToLogicalX(wxCoord x) const { - return wxRound((double)(x - m_deviceOriginX - m_deviceLocalOriginX) / m_scaleX) * m_signX + m_logicalOriginX; + return wxRound( (double)((x - m_deviceOriginX - m_deviceLocalOriginX) * m_signX) / m_scaleX ) + m_logicalOriginX ; } wxCoord wxDCImpl::DeviceToLogicalY(wxCoord y) const { - return wxRound((double)(y - m_deviceOriginY - m_deviceLocalOriginY) / m_scaleY) * m_signY + m_logicalOriginY; + return wxRound( (double)((y - m_deviceOriginY - m_deviceLocalOriginY) * m_signY) / m_scaleY ) + m_logicalOriginY ; } wxCoord wxDCImpl::DeviceToLogicalXRel(wxCoord x) const @@ -366,12 +389,12 @@ wxCoord wxDCImpl::DeviceToLogicalYRel(wxCoord y) const wxCoord wxDCImpl::LogicalToDeviceX(wxCoord x) const { - return wxRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX * m_signY + m_deviceLocalOriginX; + return wxRound( (double)((x - m_logicalOriginX) * m_signX) * m_scaleX) + m_deviceOriginX + m_deviceLocalOriginX; } wxCoord wxDCImpl::LogicalToDeviceY(wxCoord y) const { - return wxRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY * m_signY + m_deviceLocalOriginY; + return wxRound( (double)((y - m_logicalOriginY) * m_signY) * m_scaleY) + m_deviceOriginY + m_deviceLocalOriginY; } wxCoord wxDCImpl::LogicalToDeviceXRel(wxCoord x) const @@ -390,7 +413,7 @@ void wxDCImpl::ComputeScaleAndOrigin() m_scaleY = m_logicalScaleY * m_userScaleY; } -void wxDCImpl::SetMapMode( int mode ) +void wxDCImpl::SetMapMode( wxMappingMode mode ) { switch (mode) { @@ -627,7 +650,7 @@ wxDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest, wxDC *source, wxCoord xsrc, wxCoord ysrc, wxCoord srcWidth, wxCoord srcHeight, - int rop, + wxRasterOperationMode rop, bool useMask, wxCoord xsrcMask, wxCoord ysrcMask) @@ -673,7 +696,7 @@ void wxDCImpl::DrawLines(const wxPointList *list, wxCoord xoffset, wxCoord yoffs void wxDCImpl::DrawPolygon(const wxPointList *list, wxCoord xoffset, wxCoord yoffset, - int fillStyle) + wxPolygonFillMode fillStyle) { int n = list->GetCount(); wxPoint *points = new wxPoint[n]; @@ -696,7 +719,7 @@ wxDCImpl::DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, - int fillStyle) + wxPolygonFillMode fillStyle) { if ( n == 1 ) { @@ -723,7 +746,7 @@ wxDCImpl::DoDrawPolyPolygon(int n, } pen = GetPen(); - SetPen(wxPen(*wxBLACK, 0, wxTRANSPARENT)); + SetPen(wxPen(*wxBLACK, 0, wxPENSTYLE_TRANSPARENT)); DoDrawPolygon(j, pts, xoffset, yoffset, fillStyle); SetPen(pen); for (i = j = 0; i < n; i++) @@ -736,38 +759,21 @@ wxDCImpl::DoDrawPolyPolygon(int n, #if wxUSE_SPLINES -void wxDCImpl::DoDrawSpline(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord x3, wxCoord y3) +void wxDCImpl::DrawSpline(wxCoord x1, wxCoord y1, + wxCoord x2, wxCoord y2, + wxCoord x3, wxCoord y3) { - wxPointList point_list; - - wxPoint *point1 = new wxPoint; - point1->x = x1; point1->y = y1; - point_list.Append( point1 ); - - wxPoint *point2 = new wxPoint; - point2->x = x2; point2->y = y2; - point_list.Append( point2 ); - - wxPoint *point3 = new wxPoint; - point3->x = x3; point3->y = y3; - point_list.Append( point3 ); - - DoDrawSpline(&point_list); - - for( wxPointList::compatibility_iterator node = point_list.GetFirst(); node; node = node->GetNext() ) - { - wxPoint *p = node->GetData(); - delete p; - } + wxPoint points[] = { wxPoint(x1, y1), wxPoint(x2, y2), wxPoint(x3, y3) }; + DrawSpline(WXSIZEOF(points), points); } -void wxDCImpl::DoDrawSpline(int n, wxPoint points[]) +void wxDCImpl::DrawSpline(int n, wxPoint points[]) { wxPointList list; - for (int i =0; i < n; i++) - list.Append( &points[i] ); + for ( int i = 0; i < n; i++ ) + list.Append(&points[i]); - DoDrawSpline(&list); + DrawSpline(&list); } // ----------------------------------- spline code ---------------------------------------- @@ -782,7 +788,7 @@ void wx_spline_push(double x1, double y1, double x2, double y2, double x3, doubl static bool wx_spline_add_point(double x, double y); static void wx_spline_draw_point_array(wxDC *dc); -wxPointList wx_spline_point_list; +static wxPointList wx_spline_point_list; #define half(z1, z2) ((z1+z2)/2.0) #define THRESHOLD 5 @@ -991,7 +997,7 @@ void wxDCImpl::DoGradientFillLinear(const wxRect& rect, nB = nB1 + (nB2-nB1)*(w-x)/w; wxColour colour(nR,nG,nB); - SetPen(wxPen(colour, 1, wxSOLID)); + SetPen(wxPen(colour, 1, wxPENSTYLE_SOLID)); SetBrush(wxBrush(colour)); if(nDirection == wxEAST) DoDrawRectangle(rect.GetRight()-x-xDelta+1, rect.GetTop(), @@ -1028,7 +1034,7 @@ void wxDCImpl::DoGradientFillLinear(const wxRect& rect, nB = nB1 + (nB2-nB1)*(w-y)/w; wxColour colour(nR,nG,nB); - SetPen(wxPen(colour, 1, wxSOLID)); + SetPen(wxPen(colour, 1, wxPENSTYLE_SOLID)); SetBrush(wxBrush(colour)); if(nDirection == wxNORTH) DoDrawRectangle(rect.GetLeft(), rect.GetTop()+y, @@ -1102,6 +1108,16 @@ void wxDCImpl::DoGradientFillConcentric(const wxRect& rect, m_pen.SetColour(oldPenColour); } +void wxDCImpl::InheritAttributes(wxWindow *win) +{ + wxCHECK_RET( win, "window can't be NULL" ); + + SetFont(win->GetFont()); + SetTextForeground(win->GetForegroundColour()); + SetTextBackground(win->GetBackgroundColour()); + SetBackground(wxBrush(win->GetBackgroundColour())); +} + //----------------------------------------------------------------------------- // wxDC //----------------------------------------------------------------------------- @@ -1182,7 +1198,7 @@ void wxDC::DrawLabel(const wxString& text, wxString curLine; for ( wxString::const_iterator pc = text.begin(); ; ++pc ) { - if ( *pc == _T('\n') || pc == text.end() ) + if ( pc == text.end() || *pc == '\n' ) { int xRealStart = x; // init it here to avoid compielr warnings @@ -1247,7 +1263,7 @@ void wxDC::DrawLabel(const wxString& text, if ( startUnderscore != endUnderscore ) { // it should be of the same colour as text - SetPen(wxPen(GetTextForeground(), 0, wxSOLID)); + SetPen(wxPen(GetTextForeground(), 0, wxPENSTYLE_SOLID)); yUnderscore--; @@ -1316,4 +1332,338 @@ void wxDC::GetClippingBox(long *x, long *y, long *w, long *h) const if (h) *h = hh; } +void wxDC::DrawObject(wxDrawObject* drawobject) +{ + drawobject->Draw(*this); + CalcBoundingBox(drawobject->MinX(),drawobject->MinY()); + CalcBoundingBox(drawobject->MaxX(),drawobject->MaxY()); +} + #endif // WXWIN_COMPATIBILITY_2_8 + +/* +Notes for wxWidgets DrawEllipticArcRot(...) + +wxDCBase::DrawEllipticArcRot(...) draws a rotated elliptic arc or an ellipse. +It uses wxDCBase::CalculateEllipticPoints(...) and wxDCBase::Rotate(...), +which are also new. + +All methods are generic, so they can be implemented in wxDCBase. +DoDrawEllipticArcRot(...) is virtual, so it can be called from deeper +methods like (WinCE) wxDC::DoDrawArc(...). + +CalculateEllipticPoints(...) fills a given list of wxPoints with some points +of an elliptic arc. The algorithm is pixel-based: In every row (in flat +parts) or every column (in steep parts) only one pixel is calculated. +Trigonometric calculation (sin, cos, tan, atan) is only done if the +starting angle is not equal to the ending angle. The calculation of the +pixels is done using simple arithmetic only and should perform not too +bad even on devices without floating point processor. I didn't test this yet. + +Rotate(...) rotates a list of point pixel-based, you will see rounding errors. +For instance: an ellipse rotated 180 degrees is drawn +slightly different from the original. + +The points are then moved to an array and used to draw a polyline and/or polygon +(with center added, the pie). +The result looks quite similar to the native ellipse, only e few pixels differ. + +The performance on a desktop system (Athlon 1800, WinXP) is about 7 times +slower as DrawEllipse(...), which calls the native API. +An rotated ellipse outside the clipping region takes nearly the same time, +while an native ellipse outside takes nearly no time to draw. + +If you draw an arc with this new method, you will see the starting and ending angles +are calculated properly. +If you use DrawEllipticArc(...), you will see they are only correct for circles +and not properly calculated for ellipses. + +Peter Lenhard +p.lenhard@t-online.de +*/ + +#ifdef __WXWINCE__ +void wxDCImpl::DoDrawEllipticArcRot( wxCoord x, wxCoord y, + wxCoord w, wxCoord h, + double sa, double ea, double angle ) +{ + wxPointList list; + + CalculateEllipticPoints( &list, x, y, w, h, sa, ea ); + Rotate( &list, angle, wxPoint( x+w/2, y+h/2 ) ); + + // Add center (for polygon/pie) + list.Append( new wxPoint( x+w/2, y+h/2 ) ); + + // copy list into array and delete list elements + int n = list.GetCount(); + wxPoint *points = new wxPoint[n]; + int i = 0; + wxPointList::compatibility_iterator node; + for ( node = list.GetFirst(); node; node = node->GetNext(), i++ ) + { + wxPoint *point = node->GetData(); + points[i].x = point->x; + points[i].y = point->y; + delete point; + } + + // first draw the pie without pen, if necessary + if( GetBrush() != *wxTRANSPARENT_BRUSH ) + { + wxPen tempPen( GetPen() ); + SetPen( *wxTRANSPARENT_PEN ); + DoDrawPolygon( n, points, 0, 0 ); + SetPen( tempPen ); + } + + // then draw the arc without brush, if necessary + if( GetPen() != *wxTRANSPARENT_PEN ) + { + // without center + DoDrawLines( n-1, points, 0, 0 ); + } + + delete [] points; + +} // DrawEllipticArcRot + +void wxDCImpl::Rotate( wxPointList* points, double angle, wxPoint center ) +{ + if( angle != 0.0 ) + { + double pi(M_PI); + double dSinA = -sin(angle*2.0*pi/360.0); + double dCosA = cos(angle*2.0*pi/360.0); + wxPointList::compatibility_iterator node; + for ( node = points->GetFirst(); node; node = node->GetNext() ) + { + wxPoint* point = node->GetData(); + + // transform coordinates, if necessary + if( center.x ) point->x -= center.x; + if( center.y ) point->y -= center.y; + + // calculate rotation, rounding simply by implicit cast to integer + int xTemp = point->x * dCosA - point->y * dSinA; + point->y = point->x * dSinA + point->y * dCosA; + point->x = xTemp; + + // back transform coordinates, if necessary + if( center.x ) point->x += center.x; + if( center.y ) point->y += center.y; + } + } +} + +void wxDCImpl::CalculateEllipticPoints( wxPointList* points, + wxCoord xStart, wxCoord yStart, + wxCoord w, wxCoord h, + double sa, double ea ) +{ + double pi = M_PI; + double sar = 0; + double ear = 0; + int xsa = 0; + int ysa = 0; + int xea = 0; + int yea = 0; + int sq = 0; + int eq = 0; + bool bUseAngles = false; + if( w<0 ) w = -w; + if( h<0 ) h = -h; + // half-axes + wxCoord a = w/2; + wxCoord b = h/2; + // decrement 1 pixel if ellipse is smaller than 2*a, 2*b + int decrX = 0; + if( 2*a == w ) decrX = 1; + int decrY = 0; + if( 2*b == h ) decrY = 1; + // center + wxCoord xCenter = xStart + a; + wxCoord yCenter = yStart + b; + // calculate data for start and end, if necessary + if( sa != ea ) + { + bUseAngles = true; + // normalisation of angles + while( sa<0 ) sa += 360; + while( ea<0 ) ea += 360; + while( sa>=360 ) sa -= 360; + while( ea>=360 ) ea -= 360; + // calculate quadrant numbers + if( sa > 270 ) sq = 3; + else if( sa > 180 ) sq = 2; + else if( sa > 90 ) sq = 1; + if( ea > 270 ) eq = 3; + else if( ea > 180 ) eq = 2; + else if( ea > 90 ) eq = 1; + sar = sa * pi / 180.0; + ear = ea * pi / 180.0; + // correct angle circle -> ellipse + sar = atan( -a/(double)b * tan( sar ) ); + if ( sq == 1 || sq == 2 ) sar += pi; + ear = atan( -a/(double)b * tan( ear ) ); + if ( eq == 1 || eq == 2 ) ear += pi; + // coordinates of points + xsa = xCenter + a * cos( sar ); + if( sq == 0 || sq == 3 ) xsa -= decrX; + ysa = yCenter + b * sin( sar ); + if( sq == 2 || sq == 3 ) ysa -= decrY; + xea = xCenter + a * cos( ear ); + if( eq == 0 || eq == 3 ) xea -= decrX; + yea = yCenter + b * sin( ear ); + if( eq == 2 || eq == 3 ) yea -= decrY; + } // if iUseAngles + // calculate c1 = b^2, c2 = b^2/a^2 with a = w/2, b = h/2 + double c1 = b * b; + double c2 = 2.0 / w; + c2 *= c2; + c2 *= c1; + wxCoord x = 0; + wxCoord y = b; + long x2 = 1; + long y2 = y*y; + long y2_old = 0; + long y_old = 0; + // Lists for quadrant 1 to 4 + wxPointList pointsarray[4]; + // Calculate points for first quadrant and set in all quadrants + for( x = 0; x <= a; ++x ) + { + x2 = x2+x+x-1; + y2_old = y2; + y_old = y; + bool bNewPoint = false; + while( y2 > c1 - c2 * x2 && y > 0 ) + { + bNewPoint = true; + y2 = y2-y-y+1; + --y; + } + // old y now to big: set point with old y, old x + if( bNewPoint && x>1) + { + int x1 = x - 1; + // remove points on the same line + pointsarray[0].Insert( new wxPoint( xCenter + x1 - decrX, yCenter - y_old ) ); + pointsarray[1].Append( new wxPoint( xCenter - x1, yCenter - y_old ) ); + pointsarray[2].Insert( new wxPoint( xCenter - x1, yCenter + y_old - decrY ) ); + pointsarray[3].Append( new wxPoint( xCenter + x1 - decrX, yCenter + y_old - decrY ) ); + } // set point + } // calculate point + + // Starting and/or ending points for the quadrants, first quadrant gets both. + pointsarray[0].Insert( new wxPoint( xCenter + a - decrX, yCenter ) ); + pointsarray[0].Append( new wxPoint( xCenter, yCenter - b ) ); + pointsarray[1].Append( new wxPoint( xCenter - a, yCenter ) ); + pointsarray[2].Append( new wxPoint( xCenter, yCenter + b - decrY ) ); + pointsarray[3].Append( new wxPoint( xCenter + a - decrX, yCenter ) ); + + // copy quadrants in original list + if( bUseAngles ) + { + // Copy the right part of the points in the lists + // and delete the wxPoints, because they do not leave this method. + points->Append( new wxPoint( xsa, ysa ) ); + int q = sq; + bool bStarted = false; + bool bReady = false; + bool bForceTurn = ( sq == eq && sa > ea ); + while( !bReady ) + { + wxPointList::compatibility_iterator node; + for( node = pointsarray[q].GetFirst(); node; node = node->GetNext() ) + { + // once: go to starting point in start quadrant + if( !bStarted && + ( + node->GetData()->x < xsa+1 && q <= 1 + || + node->GetData()->x > xsa-1 && q >= 2 + ) + ) + { + bStarted = true; + } + + // copy point, if not at ending point + if( bStarted ) + { + if( q != eq || bForceTurn + || + ( (wxPoint*) node->GetData() )->x > xea+1 && q <= 1 + || + ( (wxPoint*) node->GetData() )->x < xea-1 && q >= 2 + ) + { + // copy point + wxPoint* pPoint = new wxPoint( *(node->GetData()) ); + points->Append( pPoint ); + } + else if( q == eq && !bForceTurn || node->GetData()->x == xea) + { + bReady = true; + } + } + } // for node + ++q; + if( q > 3 ) q = 0; + bForceTurn = false; + bStarted = true; + } // while not bReady + points->Append( new wxPoint( xea, yea ) ); + + // delete points + for( q = 0; q < 4; ++q ) + { + wxPointList::compatibility_iterator node; + for( node = pointsarray[q].GetFirst(); node; node = node->GetNext() ) + { + wxPoint *p = node->GetData(); + delete p; + } + } + } + else + { + wxPointList::compatibility_iterator node; + // copy whole ellipse, wxPoints will be deleted outside + for( node = pointsarray[0].GetFirst(); node; node = node->GetNext() ) + { + wxPoint *p = node->GetData(); + points->Append( p ); + } + for( node = pointsarray[1].GetFirst(); node; node = node->GetNext() ) + { + wxPoint *p = node->GetData(); + points->Append( p ); + } + for( node = pointsarray[2].GetFirst(); node; node = node->GetNext() ) + { + wxPoint *p = node->GetData(); + points->Append( p ); + } + for( node = pointsarray[3].GetFirst(); node; node = node->GetNext() ) + { + wxPoint *p = node->GetData(); + points->Append( p ); + } + } // not iUseAngles +} // CalculateEllipticPoints + +#endif // __WXWINCE__ + +float wxDCImpl::GetFontPointSizeAdjustment(float dpi) +{ + // wxMSW has long-standing bug where wxFont point size is interpreted as + // "pixel size corresponding to given point size *on screen*". In other + // words, on a typical 600dpi printer and a typical 96dpi screen, fonts + // are ~6 times smaller when printing. Unfortunately, this bug is so severe + // that *all* printing code has to account for it and consequently, other + // ports need to emulate this bug too: + const wxSize screenPPI = wxGetDisplayPPI(); + return float(screenPPI.y) / dpi; +}