// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "dcpsg.h"
-#endif
-
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#if wxUSE_POSTSCRIPT
-#include "wx/setup.h"
-
#include "wx/dcmemory.h"
#include "wx/utils.h"
#include "wx/intl.h"
alpha1 = 0.0;
alpha2 = 360.0;
}
- else if (radius == 0.0)
+ else if ( wxIsNullDouble(radius) )
{
- alpha1 = alpha2 = 0.0;
+ alpha1 =
+ alpha2 = 0.0;
}
else
{
{
wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
- if (sa>=360 || sa<=-360) sa=sa-int(sa/360)*360;
- if (ea>=360 || ea<=-360) ea=ea-int(ea/360)*360;
- if (sa<0) sa+=360;
- if (ea<0) ea+=360;
+ if ( sa >= 360 || sa <= -360 )
+ sa -= int(sa/360)*360;
+ if ( ea >= 360 || ea <=- 360 )
+ ea -= int(ea/360)*360;
+ if ( sa < 0 )
+ sa += 360;
+ if ( ea < 0 )
+ ea += 360;
- if (sa==ea)
+ if ( wxIsSameDouble(sa, ea) )
{
DrawEllipse(x,y,w,h);
return;
unsigned char* data = image.GetData();
- /* buffer = line = width*rgb(3)*hexa(2)+'\n'(1)+null(1) */
- char* buffer = new char[ w*6+2 ];
+ // size of the buffer = width*rgb(3)*hexa(2)+'\n'
+ wxCharBuffer buffer(w*6 + 1);
int firstDigit, secondDigit;
//rows
for (int j = 0; j < h; j++)
{
- char* bufferindex = buffer;
+ char* bufferindex = buffer.data();
//cols
for (int i = 0; i < w*3; i++)
case wxSHORT_DASH: psdash = short_dashed; break;
case wxLONG_DASH: psdash = wxCoord_dashed; break;
case wxDOT_DASH: psdash = dotted_dashed; break;
+ case wxUSER_DASH:
+ {
+ wxDash *dashes;
+ int nDashes = m_pen.GetDashes (&dashes);
+ PsPrint ("[");
+ for (int i = 0; i < nDashes; ++i)
+ {
+ sprintf( buffer, "%d ", dashes [i] );
+ PsPrint( buffer );
+ }
+ PsPrint ("] 0 setdash\n");
+ psdash = 0;
+ }
+ break;
case wxSOLID:
case wxTRANSPARENT:
default: psdash = "[] 0"; break;
}
- if ( (oldStyle != m_pen.GetStyle()) )
+ if ( psdash && (oldStyle != m_pen.GetStyle()) )
{
PsPrint( psdash );
PsPrint( " setdash\n" );
double bluePS = (double)(blue) / 255.0;
double greenPS = (double)(green) / 255.0;
- char buffer[100];
sprintf( buffer,
"%.8f %.8f %.8f setrgbcolor\n",
redPS, greenPS, bluePS );
void wxPostScriptDC::DoDrawRotatedText( const wxString& text, wxCoord x, wxCoord y, double angle )
{
- if (angle == 0.0)
+ if ( wxIsNullDouble(angle) )
{
DoDrawText(text, x, y);
return;
{
wxCoord uy = (wxCoord)(y + size - m_underlinePosition);
wxCoord w, h;
- char buffer[100];
GetTextExtent(text, &w, &h);
sprintf( buffer,
// it just crashes
#ifndef __WIN32__
wxPostScriptPrintNativeData *data =
- (wxPostScriptPrintNativeData *) m_printData.GetNativeData();
+ wxDynamicCast(m_printData.GetNativeData(), wxPostScriptPrintNativeData);
- if (!data->GetFontMetricPath().empty())
+ if (data && !data->GetFontMetricPath().empty())
{
afmName = data->GetFontMetricPath();
afmName << wxFILE_SEP_PATH << name;
if ( !afmName.empty() )
afmFile = wxFopen(afmName, wxT("r"));
- if ( !afmFile )
- {
- }
-
if ( !afmFile )
{
#if defined(__UNIX__) && !defined(__VMS__)