+
+
+
+void wxDCImpl::DoGradientFillLinear(const wxRect& rect,
+ const wxColour& initialColour,
+ const wxColour& destColour,
+ wxDirection nDirection)
+{
+ // save old pen
+ wxPen oldPen = m_pen;
+ wxBrush oldBrush = m_brush;
+
+ wxUint8 nR1 = initialColour.Red();
+ wxUint8 nG1 = initialColour.Green();
+ wxUint8 nB1 = initialColour.Blue();
+ wxUint8 nR2 = destColour.Red();
+ wxUint8 nG2 = destColour.Green();
+ wxUint8 nB2 = destColour.Blue();
+ wxUint8 nR, nG, nB;
+
+ if ( nDirection == wxEAST || nDirection == wxWEST )
+ {
+ wxInt32 x = rect.GetWidth();
+ wxInt32 w = x; // width of area to shade
+ wxInt32 xDelta = w/256; // height of one shade bend
+ if (xDelta < 1)
+ xDelta = 1;
+
+ while (x >= xDelta)
+ {
+ x -= xDelta;
+ if (nR1 > nR2)
+ nR = nR1 - (nR1-nR2)*(w-x)/w;
+ else
+ nR = nR1 + (nR2-nR1)*(w-x)/w;
+
+ if (nG1 > nG2)
+ nG = nG1 - (nG1-nG2)*(w-x)/w;
+ else
+ nG = nG1 + (nG2-nG1)*(w-x)/w;
+
+ if (nB1 > nB2)
+ nB = nB1 - (nB1-nB2)*(w-x)/w;
+ else
+ nB = nB1 + (nB2-nB1)*(w-x)/w;
+
+ wxColour colour(nR,nG,nB);
+ SetPen(wxPen(colour, 1, wxPENSTYLE_SOLID));
+ SetBrush(wxBrush(colour));
+ if(nDirection == wxEAST)
+ DoDrawRectangle(rect.GetRight()-x-xDelta+1, rect.GetTop(),
+ xDelta, rect.GetHeight());
+ else //nDirection == wxWEST
+ DoDrawRectangle(rect.GetLeft()+x, rect.GetTop(),
+ xDelta, rect.GetHeight());
+ }
+ }
+ else // nDirection == wxNORTH || nDirection == wxSOUTH
+ {
+ wxInt32 y = rect.GetHeight();
+ wxInt32 w = y; // height of area to shade
+ wxInt32 yDelta = w/255; // height of one shade bend
+ if (yDelta < 1)
+ yDelta = 1;
+
+ while (y > 0)
+ {
+ y -= yDelta;
+ if (nR1 > nR2)
+ nR = nR1 - (nR1-nR2)*(w-y)/w;
+ else
+ nR = nR1 + (nR2-nR1)*(w-y)/w;
+
+ if (nG1 > nG2)
+ nG = nG1 - (nG1-nG2)*(w-y)/w;
+ else
+ nG = nG1 + (nG2-nG1)*(w-y)/w;
+
+ if (nB1 > nB2)
+ nB = nB1 - (nB1-nB2)*(w-y)/w;
+ else
+ nB = nB1 + (nB2-nB1)*(w-y)/w;
+
+ wxColour colour(nR,nG,nB);
+ SetPen(wxPen(colour, 1, wxPENSTYLE_SOLID));
+ SetBrush(wxBrush(colour));
+ if(nDirection == wxNORTH)
+ DoDrawRectangle(rect.GetLeft(), rect.GetTop()+y,
+ rect.GetWidth(), yDelta);
+ else //nDirection == wxSOUTH
+ DoDrawRectangle(rect.GetLeft(), rect.GetBottom()-y-yDelta+1,
+ rect.GetWidth(), yDelta);
+ }
+ }
+
+ SetPen(oldPen);
+ SetBrush(oldBrush);
+}
+
+void wxDCImpl::DoGradientFillConcentric(const wxRect& rect,
+ const wxColour& initialColour,
+ const wxColour& destColour,
+ const wxPoint& circleCenter)
+{
+ // save the old pen and ensure it is restored on exit
+ const wxPen penOrig = m_pen;
+ wxON_BLOCK_EXIT_SET(m_pen, penOrig);
+
+ wxUint8 nR1 = destColour.Red();
+ wxUint8 nG1 = destColour.Green();
+ wxUint8 nB1 = destColour.Blue();
+ wxUint8 nR2 = initialColour.Red();
+ wxUint8 nG2 = initialColour.Green();
+ wxUint8 nB2 = initialColour.Blue();
+ wxUint8 nR, nG, nB;
+
+
+ //Radius
+ double cx = rect.GetWidth() / 2;
+ double cy = rect.GetHeight() / 2;
+ double dRadius;
+ if (cx < cy)
+ dRadius = cx;
+ else
+ dRadius = cy;
+
+ //Offset of circle
+ double ptX, ptY;
+ ptX = circleCenter.x;
+ ptY = circleCenter.y;
+ double nCircleOffX = ptX - cx;
+ double nCircleOffY = ptY - cy;
+
+ double dGradient;
+ double dx, dy;
+
+ for ( wxInt32 x = 0; x < rect.GetWidth(); x++ )
+ {
+ for ( wxInt32 y = 0; y < rect.GetHeight(); y++ )
+ {
+ //get color difference
+ dx = x;
+ dy = y;
+
+ dGradient = ((dRadius - sqrt( (dx - cx - nCircleOffX) * (dx - cx - nCircleOffX)
+ +(dy - cy - nCircleOffY) * (dy - cy - nCircleOffY)
+ )
+ ) * 100
+ ) / dRadius;
+
+ //normalize Gradient
+ if (dGradient < 0)
+ dGradient = 0.0;
+
+ //get dest colors
+ nR = (wxUint8)(nR1 + ((nR2 - nR1) * dGradient / 100));
+ nG = (wxUint8)(nG1 + ((nG2 - nG1) * dGradient / 100));
+ nB = (wxUint8)(nB1 + ((nB2 - nB1) * dGradient / 100));
+
+ //set the pixel
+ SetPen(wxColour(nR,nG,nB));
+ DoDrawPoint(x + rect.GetLeft(), y + rect.GetTop());
+ }
+ }
+}
+
+void wxDCImpl::InheritAttributes(wxWindow *win)
+{
+ wxCHECK_RET( win, "window can't be NULL" );
+
+ SetFont(win->GetFont());
+ SetTextForeground(win->GetForegroundColour());
+ SetTextBackground(win->GetBackgroundColour());
+ SetBackground(win->GetBackgroundColour());
+ SetLayoutDirection(win->GetLayoutDirection());
+}
+
+void wxDCImpl::DoGetFontMetrics(int *height,
+ int *ascent,
+ int *descent,
+ int *internalLeading,
+ int *externalLeading,
+ int *averageWidth) const
+{
+ // Average width is typically the same as width of 'x'.
+ wxCoord h, d;
+ DoGetTextExtent("x", averageWidth, &h, &d, externalLeading);
+
+ if ( height )
+ *height = h;
+ if ( ascent )
+ *ascent = h - d;
+ if ( descent )
+ *descent = d;
+ if ( internalLeading )
+ *internalLeading = 0;
+}
+
+//-----------------------------------------------------------------------------
+// wxDC
+//-----------------------------------------------------------------------------
+
+IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
+
+void wxDC::CopyAttributes(const wxDC& dc)
+{
+ SetFont(dc.GetFont());
+ SetTextForeground(dc.GetTextForeground());
+ SetTextBackground(dc.GetTextBackground());
+ SetBackground(dc.GetBackground());
+ SetLayoutDirection(dc.GetLayoutDirection());
+}
+
+void wxDC::DrawLabel(const wxString& text,
+ const wxBitmap& bitmap,
+ const wxRect& rect,
+ int alignment,
+ int indexAccel,
+ wxRect *rectBounding)
+{
+ // find the text position
+ wxCoord widthText, heightText, heightLine;
+ GetMultiLineTextExtent(text, &widthText, &heightText, &heightLine);
+
+ wxCoord width, height;
+ if ( bitmap.IsOk() )
+ {
+ width = widthText + bitmap.GetWidth();
+ height = bitmap.GetHeight();
+ }
+ else // no bitmap
+ {
+ width = widthText;
+ height = heightText;
+ }
+
+ wxCoord x, y;
+ if ( alignment & wxALIGN_RIGHT )
+ {
+ x = rect.GetRight() - width;
+ }
+ else if ( alignment & wxALIGN_CENTRE_HORIZONTAL )
+ {
+ x = (rect.GetLeft() + rect.GetRight() + 1 - width) / 2;
+ }
+ else // alignment & wxALIGN_LEFT
+ {
+ x = rect.GetLeft();
+ }
+
+ if ( alignment & wxALIGN_BOTTOM )
+ {
+ y = rect.GetBottom() - height;
+ }
+ else if ( alignment & wxALIGN_CENTRE_VERTICAL )
+ {
+ y = (rect.GetTop() + rect.GetBottom() + 1 - height) / 2;
+ }
+ else // alignment & wxALIGN_TOP
+ {
+ y = rect.GetTop();
+ }
+
+ // draw the bitmap first
+ wxCoord x0 = x,
+ y0 = y,
+ width0 = width;
+ if ( bitmap.IsOk() )
+ {
+ DrawBitmap(bitmap, x, y, true /* use mask */);
+
+ wxCoord offset = bitmap.GetWidth() + 4;
+ x += offset;
+ width -= offset;
+
+ y += (height - heightText) / 2;
+ }
+
+ // we will draw the underscore under the accel char later
+ wxCoord startUnderscore = 0,
+ endUnderscore = 0,
+ yUnderscore = 0;
+
+ // split the string into lines and draw each of them separately
+ //
+ // NB: while wxDC::DrawText() on some platforms supports drawing multi-line
+ // strings natively, this is not the case for all of them, notably not
+ // wxMSW which uses this function for multi-line texts, so we may only
+ // call DrawText() for single-line strings from here to avoid infinite
+ // recursion.
+ wxString curLine;
+ for ( wxString::const_iterator pc = text.begin(); ; ++pc )
+ {
+ if ( pc == text.end() || *pc == '\n' )
+ {
+ int xRealStart = x; // init it here to avoid compielr warnings
+
+ if ( !curLine.empty() )
+ {
+ // NB: can't test for !(alignment & wxALIGN_LEFT) because
+ // wxALIGN_LEFT is 0
+ if ( alignment & (wxALIGN_RIGHT | wxALIGN_CENTRE_HORIZONTAL) )
+ {
+ wxCoord widthLine;
+ GetTextExtent(curLine, &widthLine, NULL);
+
+ if ( alignment & wxALIGN_RIGHT )
+ {
+ xRealStart += width - widthLine;
+ }
+ else // if ( alignment & wxALIGN_CENTRE_HORIZONTAL )
+ {
+ xRealStart += (width - widthLine) / 2;
+ }
+ }
+ //else: left aligned, nothing to do
+
+ DrawText(curLine, xRealStart, y);
+ }
+
+ y += heightLine;
+
+ // do we have underscore in this line? we can check yUnderscore
+ // because it is set below to just y + heightLine if we do
+ if ( y == yUnderscore )
+ {
+ // adjust the horz positions to account for the shift
+ startUnderscore += xRealStart;
+ endUnderscore += xRealStart;
+ }
+
+ if ( pc == text.end() )
+ break;
+
+ curLine.clear();
+ }
+ else // not end of line
+ {
+ if ( pc - text.begin() == indexAccel )
+ {
+ // remember to draw underscore here
+ GetTextExtent(curLine, &startUnderscore, NULL);
+ curLine += *pc;
+ GetTextExtent(curLine, &endUnderscore, NULL);
+
+ yUnderscore = y + heightLine;
+ }
+ else
+ {
+ curLine += *pc;
+ }
+ }
+ }
+
+ // draw the underscore if found
+ if ( startUnderscore != endUnderscore )
+ {
+ // it should be of the same colour as text
+ SetPen(wxPen(GetTextForeground(), 0, wxPENSTYLE_SOLID));
+
+ // This adjustment is relatively arbitrary: we need to draw the
+ // underline slightly higher to avoid overflowing the character cell
+ // but whether we should do it 1, 2 or 3 pixels higher is not clear.
+ //
+ // The currently used value seems to be compatible with native MSW
+ // behaviour, i.e. it results in the same appearance of the owner-drawn
+ // and normal labels.
+ yUnderscore -= 2;
+
+ DrawLine(startUnderscore, yUnderscore, endUnderscore, yUnderscore);
+ }
+
+ // return bounding rect if requested
+ if ( rectBounding )
+ {
+ *rectBounding = wxRect(x, y - heightText, widthText, heightText);
+ }
+
+ CalcBoundingBox(x0, y0);
+ CalcBoundingBox(x0 + width0, y0 + height);
+}
+
+#if WXWIN_COMPATIBILITY_2_8
+ // for compatibility with the old code when wxCoord was long everywhere
+void wxDC::GetTextExtent(const wxString& string,
+ long *x, long *y,
+ long *descent,
+ long *externalLeading,
+ const wxFont *theFont) const
+ {
+ wxCoord x2, y2, descent2, externalLeading2;
+ m_pimpl->DoGetTextExtent(string, &x2, &y2,
+ &descent2, &externalLeading2,
+ theFont);
+ if ( x )
+ *x = x2;
+ if ( y )
+ *y = y2;
+ if ( descent )
+ *descent = descent2;
+ if ( externalLeading )
+ *externalLeading = externalLeading2;
+ }
+
+void wxDC::GetLogicalOrigin(long *x, long *y) const
+ {
+ wxCoord x2, y2;
+ m_pimpl->DoGetLogicalOrigin(&x2, &y2);
+ if ( x )
+ *x = x2;
+ if ( y )
+ *y = y2;
+ }
+
+void wxDC::GetDeviceOrigin(long *x, long *y) const
+ {
+ wxCoord x2, y2;
+ m_pimpl->DoGetDeviceOrigin(&x2, &y2);
+ if ( x )
+ *x = x2;
+ if ( y )
+ *y = y2;
+ }
+
+void wxDC::GetClippingBox(long *x, long *y, long *w, long *h) const
+ {
+ wxCoord xx,yy,ww,hh;
+ m_pimpl->DoGetClippingBox(&xx, &yy, &ww, &hh);
+ if (x) *x = xx;
+ if (y) *y = yy;
+ if (w) *w = ww;
+ 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 too 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;
+}