summaryrefslogtreecommitdiff
authorsandman <sandman>2002-04-16 22:22:14 (UTC)
committer sandman <sandman>2002-04-16 22:22:14 (UTC)
commitf27ad352830a751937dc427f2677753545f38b16 (patch) (unidiff)
tree654858e6708eaaf09dd146a72f5fe1dbbf99a536
parentece373988ee95e4dc3c22eeb012a077595740057 (diff)
downloadopie-f27ad352830a751937dc427f2677753545f38b16.zip
opie-f27ad352830a751937dc427f2677753545f38b16.tar.gz
opie-f27ad352830a751937dc427f2677753545f38b16.tar.bz2
Fix (previous commit was an experimental version)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/qpdf/QOutputDev.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/noncore/unsupported/qpdf/QOutputDev.cpp b/noncore/unsupported/qpdf/QOutputDev.cpp
index 15a58b1..f587a33 100644
--- a/noncore/unsupported/qpdf/QOutputDev.cpp
+++ b/noncore/unsupported/qpdf/QOutputDev.cpp
@@ -1,377 +1,375 @@
1///======================================================================== 1///========================================================================
2// 2//
3// QOutputDev.cc 3// QOutputDev.cc
4// 4//
5// Copyright 1996 Derek B. Noonburg 5// Copyright 1996 Derek B. Noonburg
6// CopyRight 2002 Robert Griebl 6// CopyRight 2002 Robert Griebl
7// 7//
8//======================================================================== 8//========================================================================
9 9
10#ifdef __GNUC__ 10#ifdef __GNUC__
11#pragma implementation 11#pragma implementation
12#endif 12#endif
13 13
14#include <aconf.h> 14#include <aconf.h>
15#include <stdio.h> 15#include <stdio.h>
16#include <stdlib.h> 16#include <stdlib.h>
17#include <stddef.h> 17#include <stddef.h>
18#include <unistd.h> 18#include <unistd.h>
19#include <string.h> 19#include <string.h>
20#include <ctype.h> 20#include <ctype.h>
21#include <math.h> 21#include <math.h>
22#include "GString.h" 22#include "GString.h"
23#include "Object.h" 23#include "Object.h"
24#include "Stream.h" 24#include "Stream.h"
25#include "Link.h" 25#include "Link.h"
26#include "GfxState.h" 26#include "GfxState.h"
27#include "GfxFont.h" 27#include "GfxFont.h"
28#include "UnicodeMap.h" 28#include "UnicodeMap.h"
29#include "CharCodeToUnicode.h" 29#include "CharCodeToUnicode.h"
30#include "FontFile.h" 30#include "FontFile.h"
31#include "Error.h" 31#include "Error.h"
32#include "TextOutputDev.h" 32#include "TextOutputDev.h"
33#include "QOutputDev.h" 33#include "QOutputDev.h"
34 34
35 35
36#include <qpixmap.h> 36#include <qpixmap.h>
37#include <qimage.h> 37#include <qimage.h>
38#include <qpainter.h> 38#include <qpainter.h>
39#include <qdict.h> 39#include <qdict.h>
40#include <qtimer.h> 40#include <qtimer.h>
41#include <qapplication.h> 41#include <qapplication.h>
42#include <qclipboard.h> 42#include <qclipboard.h>
43 43
44 //#define QPDFDBG(x) x // special debug mode 44 //#define QPDFDBG(x) x // special debug mode
45 #define QPDFDBG(x) // normal compilation 45 #define QPDFDBG(x) // normal compilation
46 46
47 47
48//------------------------------------------------------------------------ 48//------------------------------------------------------------------------
49// Constants and macros 49// Constants and macros
50//------------------------------------------------------------------------ 50//------------------------------------------------------------------------
51 51
52 52
53static inline QColor q_col ( const GfxRGB &rgb ) 53static inline QColor q_col ( const GfxRGB &rgb )
54{ 54{
55 return QColor ( lrint ( rgb. r * 255 ), lrint ( rgb. g * 255 ), lrint ( rgb. b * 255 )); 55 return QColor ( lrint ( rgb. r * 255 ), lrint ( rgb. g * 255 ), lrint ( rgb. b * 255 ));
56} 56}
57 57
58 58
59//------------------------------------------------------------------------ 59//------------------------------------------------------------------------
60// Font substitutions 60// Font substitutions
61//------------------------------------------------------------------------ 61//------------------------------------------------------------------------
62 62
63struct QOutFontSubst { 63struct QOutFontSubst {
64 char * m_name; 64 char * m_name;
65 char * m_sname; 65 char * m_sname;
66 bool m_bold; 66 bool m_bold;
67 bool m_italic; 67 bool m_italic;
68 QFont::StyleHint m_hint; 68 QFont::StyleHint m_hint;
69}; 69};
70 70
71static QOutFontSubst qStdFonts [] = { 71static QOutFontSubst qStdFonts [] = {
72 { "Helvetica", "Helvetica", false, false, QFont::Helvetica }, 72 { "Helvetica", "Helvetica", false, false, QFont::Helvetica },
73 { "Helvetica-Oblique", "Helvetica", false, true, QFont::Helvetica }, 73 { "Helvetica-Oblique", "Helvetica", false, true, QFont::Helvetica },
74 { "Helvetica-Bold", "Helvetica", true, false, QFont::Helvetica }, 74 { "Helvetica-Bold", "Helvetica", true, false, QFont::Helvetica },
75 { "Helvetica-BoldOblique", "Helvetica", true, true, QFont::Helvetica }, 75 { "Helvetica-BoldOblique", "Helvetica", true, true, QFont::Helvetica },
76 { "Times-Roman", "Times", false, false, QFont::Times }, 76 { "Times-Roman", "Times", false, false, QFont::Times },
77 { "Times-Italic", "Times", false, true, QFont::Times }, 77 { "Times-Italic", "Times", false, true, QFont::Times },
78 { "Times-Bold", "Times", true, false, QFont::Times }, 78 { "Times-Bold", "Times", true, false, QFont::Times },
79 { "Times-BoldItalic", "Times", true, true, QFont::Times }, 79 { "Times-BoldItalic", "Times", true, true, QFont::Times },
80 { "Courier", "Courier", false, false, QFont::Courier }, 80 { "Courier", "Courier", false, false, QFont::Courier },
81 { "Courier-Oblique", "Courier", false, true, QFont::Courier }, 81 { "Courier-Oblique", "Courier", false, true, QFont::Courier },
82 { "Courier-Bold", "Courier", true, false, QFont::Courier }, 82 { "Courier-Bold", "Courier", true, false, QFont::Courier },
83 { "Courier-BoldOblique", "Courier", true, true, QFont::Courier }, 83 { "Courier-BoldOblique", "Courier", true, true, QFont::Courier },
84 84
85 { "Symbol", 0, false, false, QFont::AnyStyle }, 85 { "Symbol", 0, false, false, QFont::AnyStyle },
86 { "Zapf-Dingbats", 0, false, false, QFont::AnyStyle }, 86 { "Zapf-Dingbats", 0, false, false, QFont::AnyStyle },
87 87
88 { 0, 0, false, false, QFont::AnyStyle } 88 { 0, 0, false, false, QFont::AnyStyle }
89}; 89};
90 90
91 91
92 92
93 93
94 94
95 95
96 96
97QFont QOutputDev::matchFont ( GfxFont *gfxFont, fp_t m11, fp_t m12, fp_t m21, fp_t m22 ) 97QFont QOutputDev::matchFont ( GfxFont *gfxFont, fp_t m11, fp_t m12, fp_t m21, fp_t m22 )
98{ 98{
99 static QDict<QOutFontSubst> stdfonts; 99 static QDict<QOutFontSubst> stdfonts;
100 100
101 // build dict for std. fonts on first invocation 101 // build dict for std. fonts on first invocation
102 if ( stdfonts. isEmpty ( )) { 102 if ( stdfonts. isEmpty ( )) {
103 for ( QOutFontSubst *ptr = qStdFonts; ptr-> m_name; ptr++ ) { 103 for ( QOutFontSubst *ptr = qStdFonts; ptr-> m_name; ptr++ ) {
104 stdfonts. insert ( QString ( ptr-> m_name ), ptr ); 104 stdfonts. insert ( QString ( ptr-> m_name ), ptr );
105 } 105 }
106 } 106 }
107 107
108 // compute size and normalized transform matrix 108 // compute size and normalized transform matrix
109 int size = lrint ( sqrt ( m21 * m21 + m22 * m22 )); 109 int size = lrint ( sqrt ( m21 * m21 + m22 * m22 ));
110 110
111 QPDFDBG( printf ( "SET FONT: Name=%s, Size=%d, Bold=%d, Italic=%d, Mono=%d, Serif=%d, Symbol=%d, CID=%d, EmbFN=%s, M=(%f,%f,%f,%f)\n", 111 QPDFDBG( printf ( "SET FONT: Name=%s, Size=%d, Bold=%d, Italic=%d, Mono=%d, Serif=%d, Symbol=%d, CID=%d, EmbFN=%s, M=(%f,%f,%f,%f)\n",
112 (( gfxFont-> getName ( )) ? gfxFont-> getName ( )-> getCString ( ) : "<n/a>" ), 112 (( gfxFont-> getName ( )) ? gfxFont-> getName ( )-> getCString ( ) : "<n/a>" ),
113 size, 113 size,
114 gfxFont-> isBold ( ), 114 gfxFont-> isBold ( ),
115 gfxFont-> isItalic ( ), 115 gfxFont-> isItalic ( ),
116 gfxFont-> isFixedWidth ( ), 116 gfxFont-> isFixedWidth ( ),
117 gfxFont-> isSerif ( ), 117 gfxFont-> isSerif ( ),
118 gfxFont-> isSymbolic ( ), 118 gfxFont-> isSymbolic ( ),
119 gfxFont-> isCIDFont ( ), 119 gfxFont-> isCIDFont ( ),
120 ( gfxFont-> getEmbeddedFontName ( ) ? gfxFont-> getEmbeddedFontName ( ) : "<n/a>" ), 120 ( gfxFont-> getEmbeddedFontName ( ) ? gfxFont-> getEmbeddedFontName ( ) : "<n/a>" ),
121 (double) m11, (double) m12, (double) m21, (double) m22 )); 121 (double) m11, (double) m12, (double) m21, (double) m22 ));
122 122
123 123
124 QString fname (( gfxFont-> getName ( )) ? gfxFont-> getName ( )-> getCString ( ) : "<n/a>" ); 124 QString fname (( gfxFont-> getName ( )) ? gfxFont-> getName ( )-> getCString ( ) : "<n/a>" );
125 125
126 QFont f; 126 QFont f;
127 f. setPixelSize ( size > 0 ? size : 8 ); // type3 fonts misbehave sometimes 127 f. setPixelSize ( size > 0 ? size : 8 ); // type3 fonts misbehave sometimes
128 128
129 // fast lookup for std. fonts 129 // fast lookup for std. fonts
130 QOutFontSubst *subst = stdfonts [fname]; 130 QOutFontSubst *subst = stdfonts [fname];
131 131
132 if ( subst ) { 132 if ( subst ) {
133 if ( subst-> m_sname ) 133 if ( subst-> m_sname )
134 f. setFamily ( subst-> m_sname ); 134 f. setFamily ( subst-> m_sname );
135 f. setStyleHint ( subst-> m_hint, (QFont::StyleStrategy) ( QFont::PreferOutline | QFont::PreferQuality )); 135 f. setStyleHint ( subst-> m_hint, (QFont::StyleStrategy) ( QFont::PreferOutline | QFont::PreferQuality ));
136 f. setBold ( subst-> m_bold ); 136 f. setBold ( subst-> m_bold );
137 f. setItalic ( subst-> m_italic ); 137 f. setItalic ( subst-> m_italic );
138 } 138 }
139 else { 139 else {
140 QFont::StyleHint sty; 140 QFont::StyleHint sty;
141 141
142 if ( gfxFont-> isSerif ( )) 142 if ( gfxFont-> isSerif ( ))
143 sty = QFont::Serif; 143 sty = QFont::Serif;
144 else if ( gfxFont-> isFixedWidth ( )) 144 else if ( gfxFont-> isFixedWidth ( ))
145 sty = QFont::TypeWriter; 145 sty = QFont::TypeWriter;
146 else 146 else
147 sty = QFont::Helvetica; 147 sty = QFont::Helvetica;
148 148
149 f. setStyleHint ( sty, (QFont::StyleStrategy) ( QFont::PreferOutline | QFont::PreferQuality )); 149 f. setStyleHint ( sty, (QFont::StyleStrategy) ( QFont::PreferOutline | QFont::PreferQuality ));
150 f. setBold ( gfxFont-> isBold ( ) > 0 ); 150 f. setBold ( gfxFont-> isBold ( ) > 0 );
151 f. setItalic ( gfxFont-> isItalic ( ) > 0 ); 151 f. setItalic ( gfxFont-> isItalic ( ) > 0 );
152 f. setFixedPitch ( gfxFont-> isFixedWidth ( ) > 0 ); 152 f. setFixedPitch ( gfxFont-> isFixedWidth ( ) > 0 );
153 153
154 // common specifiers in font names 154 // common specifiers in font names
155 if ( fname. contains ( "Oblique" ) || fname. contains ( "Italic" )) 155 if ( fname. contains ( "Oblique" ) || fname. contains ( "Italic" ))
156 f. setItalic ( true ); 156 f. setItalic ( true );
157 if ( fname. contains ( "Bold" )) 157 if ( fname. contains ( "Bold" ))
158 f. setWeight ( QFont::Bold ); 158 f. setWeight ( QFont::Bold );
159 if ( fname. contains ( "Demi" )) 159 if ( fname. contains ( "Demi" ))
160 f. setWeight ( QFont::DemiBold ); 160 f. setWeight ( QFont::DemiBold );
161 if ( fname. contains ( "Light" )) 161 if ( fname. contains ( "Light" ))
162 f. setWeight ( QFont::Light ); 162 f. setWeight ( QFont::Light );
163 if ( fname. contains ( "Black" )) 163 if ( fname. contains ( "Black" ))
164 f. setWeight ( QFont::Black ); 164 f. setWeight ( QFont::Black );
165 } 165 }
166 // Treat x-sheared fonts as italic 166 // Treat x-sheared fonts as italic
167 if (( m12 > -0.1 ) && ( m12 < 0.1 ) && ((( m21 > -5.0 ) && ( m21 < -0.1 )) || (( m21 > 0.1 ) && ( m21 < 5.0 )))) { 167 if (( m12 > -0.1 ) && ( m12 < 0.1 ) && ((( m21 > -5.0 ) && ( m21 < -0.1 )) || (( m21 > 0.1 ) && ( m21 < 5.0 )))) {
168 f. setItalic ( true ); 168 f. setItalic ( true );
169 } 169 }
170 return f; 170 return f;
171} 171}
172 172
173 173
174 174
175//------------------------------------------------------------------------ 175//------------------------------------------------------------------------
176// QOutputDev 176// QOutputDev
177//------------------------------------------------------------------------ 177//------------------------------------------------------------------------
178 178
179QOutputDev::QOutputDev ( QWidget *parent, const char *name, int flags ) : QScrollView ( parent, name, WRepaintNoErase | WResizeNoErase | flags ) 179QOutputDev::QOutputDev ( QWidget *parent, const char *name, int flags ) : QScrollView ( parent, name, WRepaintNoErase | WResizeNoErase | flags )
180{ 180{
181 m_pixmap = 0; 181 m_pixmap = 0;
182 m_painter = 0; 182 m_painter = 0;
183 183
184 m_use_string = true;
185
186 // create text object 184 // create text object
187 m_text = new TextPage ( gFalse ); 185 m_text = new TextPage ( gFalse );
188} 186}
189 187
190QOutputDev::~QOutputDev ( ) 188QOutputDev::~QOutputDev ( )
191{ 189{
192 delete m_painter; 190 delete m_painter;
193 delete m_pixmap; 191 delete m_pixmap;
194 delete m_text; 192 delete m_text;
195} 193}
196 194
197 195
198void QOutputDev::startPage ( int /*pageNum*/, GfxState *state ) 196void QOutputDev::startPage ( int /*pageNum*/, GfxState *state )
199{ 197{
200 delete m_pixmap; 198 delete m_pixmap;
201 delete m_painter; 199 delete m_painter;
202 200
203 m_pixmap = new QPixmap ( lrint ( state-> getPageWidth ( )), lrint ( state-> getPageHeight ( ))); 201 m_pixmap = new QPixmap ( lrint ( state-> getPageWidth ( )), lrint ( state-> getPageHeight ( )));
204 m_painter = new QPainter ( m_pixmap ); 202 m_painter = new QPainter ( m_pixmap );
205 203
206 QPDFDBG( printf ( "NEW PIXMAP (%ld x %ld)\n", lrint ( state-> getPageWidth ( )), lrint ( state-> getPageHeight ( )))); 204 QPDFDBG( printf ( "NEW PIXMAP (%ld x %ld)\n", lrint ( state-> getPageWidth ( )), lrint ( state-> getPageHeight ( ))));
207 205
208 resizeContents ( m_pixmap-> width ( ), m_pixmap-> height ( )); 206 resizeContents ( m_pixmap-> width ( ), m_pixmap-> height ( ));
209 setContentsPos ( 0, 0 ); 207 setContentsPos ( 0, 0 );
210 208
211 m_pixmap-> fill ( white ); // clear window 209 m_pixmap-> fill ( white ); // clear window
212 m_text-> clear ( ); // cleat text object 210 m_text-> clear ( ); // cleat text object
213 viewport ( )-> repaint ( ); 211 viewport ( )-> repaint ( );
214} 212}
215 213
216void QOutputDev::endPage ( ) 214void QOutputDev::endPage ( )
217{ 215{
218 m_text-> coalesce ( ); 216 m_text-> coalesce ( );
219 217
220 delete m_painter; 218 delete m_painter;
221 m_painter = 0; 219 m_painter = 0;
222 220
223 updateContents ( 0, 0, contentsWidth ( ), contentsHeight ( )); 221 updateContents ( 0, 0, contentsWidth ( ), contentsHeight ( ));
224} 222}
225 223
226void QOutputDev::drawLink ( Link *link, Catalog */*catalog*/ ) 224void QOutputDev::drawLink ( Link *link, Catalog */*catalog*/ )
227{ 225{
228 fp_t x1, y1, x2, y2, w; 226 fp_t x1, y1, x2, y2, w;
229 227
230 link-> getBorder ( &x1, &y1, &x2, &y2, &w ); 228 link-> getBorder ( &x1, &y1, &x2, &y2, &w );
231 229
232 if ( w > 0 ) { 230 if ( w > 0 ) {
233 int x, y, dx, dy; 231 int x, y, dx, dy;
234 232
235 cvtUserToDev ( x1, y1, &x, &y ); 233 cvtUserToDev ( x1, y1, &x, &y );
236 cvtUserToDev ( x2, y2, &dx, &dy ); 234 cvtUserToDev ( x2, y2, &dx, &dy );
237 235
238 QPen oldpen = m_painter-> pen ( ); 236 QPen oldpen = m_painter-> pen ( );
239 m_painter-> setPen ( blue ); 237 m_painter-> setPen ( blue );
240 m_painter-> drawRect ( x, y, dx, dy ); 238 m_painter-> drawRect ( x, y, dx, dy );
241 m_painter-> setPen ( oldpen ); 239 m_painter-> setPen ( oldpen );
242 } 240 }
243} 241}
244 242
245void QOutputDev::saveState ( GfxState */*state*/ ) 243void QOutputDev::saveState ( GfxState */*state*/ )
246{ 244{
247 QPDFDBG( printf ( "SAVE (CLIP=%d/%d)\n", m_painter-> hasClipping ( ), !m_painter-> clipRegion ( ). isEmpty ( ))); 245 QPDFDBG( printf ( "SAVE (CLIP=%d/%d)\n", m_painter-> hasClipping ( ), !m_painter-> clipRegion ( ). isEmpty ( )));
248 246
249 m_painter-> save ( ); 247 m_painter-> save ( );
250} 248}
251 249
252void QOutputDev::restoreState ( GfxState */*state*/ ) 250void QOutputDev::restoreState ( GfxState */*state*/ )
253{ 251{
254 m_painter-> restore ( ); 252 m_painter-> restore ( );
255 253
256 //m_painter-> setClipRegion ( QRect ( 0, 0, m_pixmap-> width ( ), m_pixmap-> height ( ))); 254 //m_painter-> setClipRegion ( QRect ( 0, 0, m_pixmap-> width ( ), m_pixmap-> height ( )));
257 //m_painter-> setClipping ( false ); 255 //m_painter-> setClipping ( false );
258 QPDFDBG ( printf ( "RESTORE (CLIP=%d/%d)\n", m_painter-> hasClipping ( ), !m_painter-> clipRegion ( ). isEmpty ( ))); 256 QPDFDBG ( printf ( "RESTORE (CLIP=%d/%d)\n", m_painter-> hasClipping ( ), !m_painter-> clipRegion ( ). isEmpty ( )));
259} 257}
260 258
261void QOutputDev::updateAll ( GfxState *state ) 259void QOutputDev::updateAll ( GfxState *state )
262{ 260{
263 updateLineAttrs ( state, gTrue ); 261 updateLineAttrs ( state, gTrue );
264 //updateFlatness ( state ); 262 //updateFlatness ( state );
265 //updateMiterLimit ( state ); 263 //updateMiterLimit ( state );
266 updateFillColor ( state ); 264 updateFillColor ( state );
267 updateStrokeColor ( state ); 265 updateStrokeColor ( state );
268 updateFont ( state ); 266 updateFont ( state );
269} 267}
270 268
271void QOutputDev::updateCTM ( GfxState *state, fp_t /*m11*/, fp_t /*m12*/, fp_t /*m21*/, fp_t /*m22*/, fp_t /*m31*/, fp_t /*m32*/ ) 269void QOutputDev::updateCTM ( GfxState *state, fp_t /*m11*/, fp_t /*m12*/, fp_t /*m21*/, fp_t /*m22*/, fp_t /*m31*/, fp_t /*m32*/ )
272{ 270{
273 updateLineAttrs ( state, gTrue ); 271 updateLineAttrs ( state, gTrue );
274} 272}
275 273
276void QOutputDev::updateLineDash ( GfxState *state ) 274void QOutputDev::updateLineDash ( GfxState *state )
277{ 275{
278 updateLineAttrs ( state, gTrue ); 276 updateLineAttrs ( state, gTrue );
279} 277}
280 278
281void QOutputDev::updateFlatness ( GfxState */*state*/ ) 279void QOutputDev::updateFlatness ( GfxState */*state*/ )
282{ 280{
283 // not supported 281 // not supported
284 QPDFDBG( printf ( "updateFlatness not supported !\n" )); 282 QPDFDBG( printf ( "updateFlatness not supported !\n" ));
285} 283}
286 284
287void QOutputDev::updateLineJoin ( GfxState *state ) 285void QOutputDev::updateLineJoin ( GfxState *state )
288{ 286{
289 updateLineAttrs ( state, gFalse ); 287 updateLineAttrs ( state, gFalse );
290} 288}
291 289
292void QOutputDev::updateLineCap ( GfxState *state ) 290void QOutputDev::updateLineCap ( GfxState *state )
293{ 291{
294 updateLineAttrs ( state, gFalse ); 292 updateLineAttrs ( state, gFalse );
295} 293}
296 294
297// unimplemented 295// unimplemented
298void QOutputDev::updateMiterLimit ( GfxState */*state*/ ) 296void QOutputDev::updateMiterLimit ( GfxState */*state*/ )
299{ 297{
300 QPDFDBG( printf ( "updateMiterLimit not supported !\n" )); 298 QPDFDBG( printf ( "updateMiterLimit not supported !\n" ));
301} 299}
302 300
303void QOutputDev::updateLineWidth ( GfxState *state ) 301void QOutputDev::updateLineWidth ( GfxState *state )
304{ 302{
305 updateLineAttrs ( state, gFalse ); 303 updateLineAttrs ( state, gFalse );
306} 304}
307 305
308void QOutputDev::updateLineAttrs ( GfxState *state, GBool updateDash ) 306void QOutputDev::updateLineAttrs ( GfxState *state, GBool updateDash )
309{ 307{
310 fp_t *dashPattern; 308 fp_t *dashPattern;
311 int dashLength; 309 int dashLength;
312 fp_t dashStart; 310 fp_t dashStart;
313 311
314 Qt::PenCapStyle cap; 312 Qt::PenCapStyle cap;
315 Qt::PenJoinStyle join; 313 Qt::PenJoinStyle join;
316 int width; 314 int width;
317 315
318 width = lrint ( state-> getTransformedLineWidth ( )); 316 width = lrint ( state-> getTransformedLineWidth ( ));
319 317
320 switch ( state-> getLineCap ( )) { 318 switch ( state-> getLineCap ( )) {
321 case 0: cap = FlatCap; break; 319 case 0: cap = FlatCap; break;
322 case 1: cap = RoundCap; break; 320 case 1: cap = RoundCap; break;
323 case 2: cap = SquareCap; break; 321 case 2: cap = SquareCap; break;
324 default: 322 default:
325 qWarning ( "Bad line cap style (%d)\n", state-> getLineCap ( )); 323 qWarning ( "Bad line cap style (%d)\n", state-> getLineCap ( ));
326 cap = FlatCap; 324 cap = FlatCap;
327 break; 325 break;
328 } 326 }
329 327
330 switch (state->getLineJoin()) { 328 switch (state->getLineJoin()) {
331 case 0: join = MiterJoin; break; 329 case 0: join = MiterJoin; break;
332 case 1: join = RoundJoin; break; 330 case 1: join = RoundJoin; break;
333 case 2: join = BevelJoin; break; 331 case 2: join = BevelJoin; break;
334 default: 332 default:
335 qWarning ( "Bad line join style (%d)\n", state->getLineJoin ( )); 333 qWarning ( "Bad line join style (%d)\n", state->getLineJoin ( ));
336 join = MiterJoin; 334 join = MiterJoin;
337 break; 335 break;
338 } 336 }
339 337
340 state-> getLineDash ( &dashPattern, &dashLength, &dashStart ); 338 state-> getLineDash ( &dashPattern, &dashLength, &dashStart );
341 339
342 QColor oldcol = m_painter-> pen ( ). color ( ); 340 QColor oldcol = m_painter-> pen ( ). color ( );
343 GfxRGB rgb; 341 GfxRGB rgb;
344 342
345 state-> getStrokeRGB ( &rgb ); 343 state-> getStrokeRGB ( &rgb );
346 oldcol = q_col ( rgb ); 344 oldcol = q_col ( rgb );
347 345
348 m_painter-> setPen ( QPen ( oldcol, width, dashLength > 0 ? DashLine : SolidLine, cap, join )); 346 m_painter-> setPen ( QPen ( oldcol, width, dashLength > 0 ? DashLine : SolidLine, cap, join ));
349 347
350 if ( updateDash && ( dashLength > 0 )) { 348 if ( updateDash && ( dashLength > 0 )) {
351 // Not supported by QT 349 // Not supported by QT
352 /* 350 /*
353 char dashList[20]; 351 char dashList[20];
354 if (dashLength > 20) 352 if (dashLength > 20)
355 dashLength = 20; 353 dashLength = 20;
356 for ( int i = 0; i < dashLength; ++i ) { 354 for ( int i = 0; i < dashLength; ++i ) {
357 dashList[i] = xoutRound(state->transformWidth(dashPattern[i])); 355 dashList[i] = xoutRound(state->transformWidth(dashPattern[i]));
358 if (dashList[i] == 0) 356 if (dashList[i] == 0)
359 dashList[i] = 1; 357 dashList[i] = 1;
360 } 358 }
361 XSetDashes(display, strokeGC, xoutRound(dashStart), dashList, dashLength); 359 XSetDashes(display, strokeGC, xoutRound(dashStart), dashList, dashLength);
362*/ 360*/
363 } 361 }
364} 362}
365 363
366void QOutputDev::updateFillColor ( GfxState *state ) 364void QOutputDev::updateFillColor ( GfxState *state )
367{ 365{
368 GfxRGB rgb; 366 GfxRGB rgb;
369 state-> getFillRGB ( &rgb ); 367 state-> getFillRGB ( &rgb );
370 368
371 m_painter-> setBrush ( q_col ( rgb )); 369 m_painter-> setBrush ( q_col ( rgb ));
372} 370}
373 371
374void QOutputDev::updateStrokeColor ( GfxState *state ) 372void QOutputDev::updateStrokeColor ( GfxState *state )
375{ 373{
376 GfxRGB rgb; 374 GfxRGB rgb;
377 state-> getStrokeRGB ( &rgb ); 375 state-> getStrokeRGB ( &rgb );