Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_null_paintdevice.cpp
- Timestamp:
- Nov 3, 2026, 10:53:35 AM (3 weeks ago)
- File:
-
- 1 edited
-
trunk/BNC/qwt/qwt_null_paintdevice.cpp (modified) (40 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_null_paintdevice.cpp
r9383 r11158 1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*-*****************************1 /****************************************************************************** 2 2 * Qwt Widget Library 3 3 * Copyright (C) 1997 Josef Wilgen … … 11 11 #include <qpaintengine.h> 12 12 #include <qpainterpath.h> 13 #include <qpixmap.h>14 13 15 14 class QwtNullPaintDevice::PrivateData 16 15 { 17 public: 16 public: 18 17 PrivateData(): 19 18 mode( QwtNullPaintDevice::NormalMode ) … … 24 23 }; 25 24 26 class QwtNullPaintDevice::PaintEngine: public QPaintEngine 27 { 28 public: 25 class QwtNullPaintDevice::PaintEngine QWT_FINAL : public QPaintEngine 26 { 27 public: 29 28 PaintEngine(); 30 29 31 virtual bool begin( QPaintDevice * ); 32 virtual bool end(); 33 34 virtual Type type () const; 35 virtual void updateState(const QPaintEngineState &); 36 37 virtual void drawRects(const QRect *, int ); 38 virtual void drawRects(const QRectF *, int ); 39 40 virtual void drawLines(const QLine *, int ); 41 virtual void drawLines(const QLineF *, int ); 42 43 virtual void drawEllipse(const QRectF &); 44 virtual void drawEllipse(const QRect &); 45 46 virtual void drawPath(const QPainterPath &); 47 48 virtual void drawPoints(const QPointF *, int ); 49 virtual void drawPoints(const QPoint *, int ); 50 51 virtual void drawPolygon(const QPointF *, int , PolygonDrawMode ); 52 virtual void drawPolygon(const QPoint *, int , PolygonDrawMode ); 53 54 virtual void drawPixmap(const QRectF &, 55 const QPixmap &, const QRectF &); 56 57 virtual void drawTextItem(const QPointF &, const QTextItem &); 58 59 virtual void drawTiledPixmap(const QRectF &, 60 const QPixmap &, const QPointF &s); 61 62 virtual void drawImage(const QRectF &, 63 const QImage &, const QRectF &, Qt::ImageConversionFlags ); 64 65 private: 66 QwtNullPaintDevice *nullDevice(); 30 virtual bool begin( QPaintDevice* ) QWT_OVERRIDE; 31 virtual bool end() QWT_OVERRIDE; 32 33 virtual Type type () const QWT_OVERRIDE; 34 virtual void updateState(const QPaintEngineState&) QWT_OVERRIDE; 35 36 virtual void drawRects(const QRect*, int ) QWT_OVERRIDE; 37 virtual void drawRects(const QRectF*, int ) QWT_OVERRIDE; 38 39 virtual void drawLines(const QLine*, int ) QWT_OVERRIDE; 40 virtual void drawLines(const QLineF*, int ) QWT_OVERRIDE; 41 42 virtual void drawEllipse(const QRectF&) QWT_OVERRIDE; 43 virtual void drawEllipse(const QRect&) QWT_OVERRIDE; 44 45 virtual void drawPath(const QPainterPath&) QWT_OVERRIDE; 46 47 virtual void drawPoints(const QPointF*, int ) QWT_OVERRIDE; 48 virtual void drawPoints(const QPoint*, int ) QWT_OVERRIDE; 49 50 virtual void drawPolygon( 51 const QPointF*, int, PolygonDrawMode ) QWT_OVERRIDE; 52 53 virtual void drawPolygon( 54 const QPoint*, int, PolygonDrawMode ) QWT_OVERRIDE; 55 56 virtual void drawPixmap(const QRectF&, 57 const QPixmap&, const QRectF&) QWT_OVERRIDE; 58 59 virtual void drawTextItem( 60 const QPointF&, const QTextItem&) QWT_OVERRIDE; 61 62 virtual void drawTiledPixmap(const QRectF&, 63 const QPixmap&, const QPointF& s) QWT_OVERRIDE; 64 65 virtual void drawImage(const QRectF&, const QImage&, 66 const QRectF&, Qt::ImageConversionFlags ) QWT_OVERRIDE; 67 68 private: 69 QwtNullPaintDevice* nullDevice(); 67 70 }; 68 71 69 QwtNullPaintDevice::PaintEngine::PaintEngine() :70 QPaintEngine( QPaintEngine::AllFeatures ) 71 { 72 } 73 74 bool QwtNullPaintDevice::PaintEngine::begin( QPaintDevice * )72 QwtNullPaintDevice::PaintEngine::PaintEngine() 73 : QPaintEngine( QPaintEngine::AllFeatures ) 74 { 75 } 76 77 bool QwtNullPaintDevice::PaintEngine::begin( QPaintDevice* ) 75 78 { 76 79 setActive( true ); … … 86 89 QPaintEngine::Type QwtNullPaintDevice::PaintEngine::type() const 87 90 { 88 return QPaintEngine::User; 91 /* 92 How to avoid conflicts with other 3rd party pain engines ? 93 At least we don't use QPaintEngine::User what is known to 94 be the value of some print engines 95 */ 96 return static_cast< QPaintEngine::Type >( QPaintEngine::MaxUser - 2 ); 89 97 } 90 98 91 99 void QwtNullPaintDevice::PaintEngine::drawRects( 92 const QRect *rects, int rectCount)93 { 94 QwtNullPaintDevice *device = nullDevice();100 const QRect* rects, int rectCount) 101 { 102 QwtNullPaintDevice* device = nullDevice(); 95 103 if ( device == NULL ) 96 104 return; … … 106 114 107 115 void QwtNullPaintDevice::PaintEngine::drawRects( 108 const QRectF *rects, int rectCount)109 { 110 QwtNullPaintDevice *device = nullDevice();116 const QRectF* rects, int rectCount) 117 { 118 QwtNullPaintDevice* device = nullDevice(); 111 119 if ( device == NULL ) 112 120 return; … … 122 130 123 131 void QwtNullPaintDevice::PaintEngine::drawLines( 124 const QLine *lines, int lineCount)125 { 126 QwtNullPaintDevice *device = nullDevice();132 const QLine* lines, int lineCount) 133 { 134 QwtNullPaintDevice* device = nullDevice(); 127 135 if ( device == NULL ) 128 136 return; … … 138 146 139 147 void QwtNullPaintDevice::PaintEngine::drawLines( 140 const QLineF *lines, int lineCount)141 { 142 QwtNullPaintDevice *device = nullDevice();148 const QLineF* lines, int lineCount) 149 { 150 QwtNullPaintDevice* device = nullDevice(); 143 151 if ( device == NULL ) 144 152 return; … … 154 162 155 163 void QwtNullPaintDevice::PaintEngine::drawEllipse( 156 const QRectF &rect)157 { 158 QwtNullPaintDevice *device = nullDevice();164 const QRectF& rect) 165 { 166 QwtNullPaintDevice* device = nullDevice(); 159 167 if ( device == NULL ) 160 168 return; … … 170 178 171 179 void QwtNullPaintDevice::PaintEngine::drawEllipse( 172 const QRect &rect)173 { 174 QwtNullPaintDevice *device = nullDevice();180 const QRect& rect) 181 { 182 QwtNullPaintDevice* device = nullDevice(); 175 183 if ( device == NULL ) 176 184 return; … … 187 195 188 196 void QwtNullPaintDevice::PaintEngine::drawPath( 189 const QPainterPath &path)190 { 191 QwtNullPaintDevice *device = nullDevice();197 const QPainterPath& path) 198 { 199 QwtNullPaintDevice* device = nullDevice(); 192 200 if ( device == NULL ) 193 201 return; … … 197 205 198 206 void QwtNullPaintDevice::PaintEngine::drawPoints( 199 const QPointF *points, int pointCount)200 { 201 QwtNullPaintDevice *device = nullDevice();207 const QPointF* points, int pointCount) 208 { 209 QwtNullPaintDevice* device = nullDevice(); 202 210 if ( device == NULL ) 203 211 return; … … 213 221 214 222 void QwtNullPaintDevice::PaintEngine::drawPoints( 215 const QPoint *points, int pointCount)216 { 217 QwtNullPaintDevice *device = nullDevice();223 const QPoint* points, int pointCount) 224 { 225 QwtNullPaintDevice* device = nullDevice(); 218 226 if ( device == NULL ) 219 227 return; … … 229 237 230 238 void QwtNullPaintDevice::PaintEngine::drawPolygon( 231 const QPointF *points, int pointCount, PolygonDrawMode mode)232 { 233 QwtNullPaintDevice *device = nullDevice();239 const QPointF* points, int pointCount, PolygonDrawMode mode) 240 { 241 QwtNullPaintDevice* device = nullDevice(); 234 242 if ( device == NULL ) 235 243 return; … … 257 265 258 266 void QwtNullPaintDevice::PaintEngine::drawPolygon( 259 const QPoint *points, int pointCount, PolygonDrawMode mode)260 { 261 QwtNullPaintDevice *device = nullDevice();267 const QPoint* points, int pointCount, PolygonDrawMode mode) 268 { 269 QwtNullPaintDevice* device = nullDevice(); 262 270 if ( device == NULL ) 263 271 return; … … 285 293 286 294 void QwtNullPaintDevice::PaintEngine::drawPixmap( 287 const QRectF &rect, const QPixmap&pm, const QRectF&subRect )288 { 289 QwtNullPaintDevice *device = nullDevice();295 const QRectF& rect, const QPixmap& pm, const QRectF& subRect ) 296 { 297 QwtNullPaintDevice* device = nullDevice(); 290 298 if ( device == NULL ) 291 299 return; … … 295 303 296 304 void QwtNullPaintDevice::PaintEngine::drawTextItem( 297 const QPointF &pos, const QTextItem&textItem)298 { 299 QwtNullPaintDevice *device = nullDevice();305 const QPointF& pos, const QTextItem& textItem) 306 { 307 QwtNullPaintDevice* device = nullDevice(); 300 308 if ( device == NULL ) 301 309 return; … … 311 319 312 320 void QwtNullPaintDevice::PaintEngine::drawTiledPixmap( 313 const QRectF &rect, const QPixmap&pixmap,314 const QPointF &subRect)315 { 316 QwtNullPaintDevice *device = nullDevice();321 const QRectF& rect, const QPixmap& pixmap, 322 const QPointF& subRect) 323 { 324 QwtNullPaintDevice* device = nullDevice(); 317 325 if ( device == NULL ) 318 326 return; … … 328 336 329 337 void QwtNullPaintDevice::PaintEngine::drawImage( 330 const QRectF &rect, const QImage&image,331 const QRectF &subRect, Qt::ImageConversionFlags flags)332 { 333 QwtNullPaintDevice *device = nullDevice();338 const QRectF& rect, const QImage& image, 339 const QRectF& subRect, Qt::ImageConversionFlags flags) 340 { 341 QwtNullPaintDevice* device = nullDevice(); 334 342 if ( device == NULL ) 335 343 return; … … 339 347 340 348 void QwtNullPaintDevice::PaintEngine::updateState( 341 const QPaintEngineState &engineState)342 { 343 QwtNullPaintDevice *device = nullDevice();349 const QPaintEngineState& engineState) 350 { 351 QwtNullPaintDevice* device = nullDevice(); 344 352 if ( device == NULL ) 345 353 return; … … 348 356 } 349 357 350 inline QwtNullPaintDevice *QwtNullPaintDevice::PaintEngine::nullDevice()358 inline QwtNullPaintDevice* QwtNullPaintDevice::PaintEngine::nullDevice() 351 359 { 352 360 if ( !isActive() ) 353 361 return NULL; 354 362 355 return static_cast<QwtNullPaintDevice *>( paintDevice() );363 return static_cast< QwtNullPaintDevice* >( paintDevice() ); 356 364 } 357 365 358 366 //! Constructor 359 367 QwtNullPaintDevice::QwtNullPaintDevice(): 360 d_engine( NULL )361 { 362 d_data = new PrivateData;368 m_engine( NULL ) 369 { 370 m_data = new PrivateData; 363 371 } 364 372 … … 366 374 QwtNullPaintDevice::~QwtNullPaintDevice() 367 375 { 368 delete d_engine;369 delete d_data;376 delete m_engine; 377 delete m_data; 370 378 } 371 379 … … 378 386 void QwtNullPaintDevice::setMode( Mode mode ) 379 387 { 380 d_data->mode = mode;388 m_data->mode = mode; 381 389 } 382 390 … … 384 392 \return Render mode 385 393 \sa setMode() 386 */ 394 */ 387 395 QwtNullPaintDevice::Mode QwtNullPaintDevice::mode() const 388 396 { 389 return d_data->mode;397 return m_data->mode; 390 398 } 391 399 392 400 //! See QPaintDevice::paintEngine() 393 QPaintEngine *QwtNullPaintDevice::paintEngine() const394 { 395 if ( d_engine == NULL )396 { 397 QwtNullPaintDevice *that =398 const_cast< QwtNullPaintDevice * >( this );399 400 that-> d_engine = new PaintEngine();401 } 402 403 return d_engine;401 QPaintEngine* QwtNullPaintDevice::paintEngine() const 402 { 403 if ( m_engine == NULL ) 404 { 405 QwtNullPaintDevice* that = 406 const_cast< QwtNullPaintDevice* >( this ); 407 408 that->m_engine = new PaintEngine(); 409 } 410 411 return m_engine; 404 412 } 405 413 … … 411 419 412 420 \sa sizeMetrics() 413 */ 421 */ 414 422 int QwtNullPaintDevice::metric( PaintDeviceMetric deviceMetric ) const 415 423 { … … 456 464 break; 457 465 } 466 #if QT_VERSION >= 0x050100 467 case PdmDevicePixelRatio: 468 { 469 value = 1.0; 470 break; 471 } 472 #endif 458 473 default: 459 value = 0; 460 } 474 { 475 value = QPaintDevice::metric( deviceMetric ); 476 } 477 } 478 461 479 return value; 462 463 480 } 464 481 465 482 //! See QPaintEngine::drawRects() 466 483 void QwtNullPaintDevice::drawRects( 467 const QRect *rects, int rectCount)484 const QRect* rects, int rectCount) 468 485 { 469 486 Q_UNUSED(rects); … … 473 490 //! See QPaintEngine::drawRects() 474 491 void QwtNullPaintDevice::drawRects( 475 const QRectF *rects, int rectCount)492 const QRectF* rects, int rectCount) 476 493 { 477 494 Q_UNUSED(rects); … … 481 498 //! See QPaintEngine::drawLines() 482 499 void QwtNullPaintDevice::drawLines( 483 const QLine *lines, int lineCount)500 const QLine* lines, int lineCount) 484 501 { 485 502 Q_UNUSED(lines); … … 489 506 //! See QPaintEngine::drawLines() 490 507 void QwtNullPaintDevice::drawLines( 491 const QLineF *lines, int lineCount)508 const QLineF* lines, int lineCount) 492 509 { 493 510 Q_UNUSED(lines); … … 496 513 497 514 //! See QPaintEngine::drawEllipse() 498 void QwtNullPaintDevice::drawEllipse( const QRectF &rect )515 void QwtNullPaintDevice::drawEllipse( const QRectF& rect ) 499 516 { 500 517 Q_UNUSED(rect); … … 502 519 503 520 //! See QPaintEngine::drawEllipse() 504 void QwtNullPaintDevice::drawEllipse( const QRect &rect )521 void QwtNullPaintDevice::drawEllipse( const QRect& rect ) 505 522 { 506 523 Q_UNUSED(rect); … … 508 525 509 526 //! See QPaintEngine::drawPath() 510 void QwtNullPaintDevice::drawPath( const QPainterPath &path )527 void QwtNullPaintDevice::drawPath( const QPainterPath& path ) 511 528 { 512 529 Q_UNUSED(path); … … 515 532 //! See QPaintEngine::drawPoints() 516 533 void QwtNullPaintDevice::drawPoints( 517 const QPointF *points, int pointCount)534 const QPointF* points, int pointCount) 518 535 { 519 536 Q_UNUSED(points); … … 523 540 //! See QPaintEngine::drawPoints() 524 541 void QwtNullPaintDevice::drawPoints( 525 const QPoint *points, int pointCount)542 const QPoint* points, int pointCount) 526 543 { 527 544 Q_UNUSED(points); … … 531 548 //! See QPaintEngine::drawPolygon() 532 549 void QwtNullPaintDevice::drawPolygon( 533 const QPointF *points, int pointCount,550 const QPointF* points, int pointCount, 534 551 QPaintEngine::PolygonDrawMode mode) 535 552 { … … 541 558 //! See QPaintEngine::drawPolygon() 542 559 void QwtNullPaintDevice::drawPolygon( 543 const QPoint *points, int pointCount,560 const QPoint* points, int pointCount, 544 561 QPaintEngine::PolygonDrawMode mode) 545 562 { … … 550 567 551 568 //! See QPaintEngine::drawPixmap() 552 void QwtNullPaintDevice::drawPixmap( const QRectF &rect,553 const QPixmap &pm, const QRectF&subRect )569 void QwtNullPaintDevice::drawPixmap( const QRectF& rect, 570 const QPixmap& pm, const QRectF& subRect ) 554 571 { 555 572 Q_UNUSED(rect); … … 560 577 //! See QPaintEngine::drawTextItem() 561 578 void QwtNullPaintDevice::drawTextItem( 562 const QPointF &pos, const QTextItem&textItem)579 const QPointF& pos, const QTextItem& textItem) 563 580 { 564 581 Q_UNUSED(pos); … … 568 585 //! See QPaintEngine::drawTiledPixmap() 569 586 void QwtNullPaintDevice::drawTiledPixmap( 570 const QRectF &rect, const QPixmap&pixmap,571 const QPointF &subRect)587 const QRectF& rect, const QPixmap& pixmap, 588 const QPointF& subRect) 572 589 { 573 590 Q_UNUSED(rect); … … 578 595 //! See QPaintEngine::drawImage() 579 596 void QwtNullPaintDevice::drawImage( 580 const QRectF &rect, const QImage&image,581 const QRectF &subRect, Qt::ImageConversionFlags flags)597 const QRectF& rect, const QImage& image, 598 const QRectF& subRect, Qt::ImageConversionFlags flags) 582 599 { 583 600 Q_UNUSED(rect); … … 589 606 //! See QPaintEngine::updateState() 590 607 void QwtNullPaintDevice::updateState( 591 const QPaintEngineState &state )608 const QPaintEngineState& state ) 592 609 { 593 610 Q_UNUSED(state);
Note:
See TracChangeset
for help on using the changeset viewer.
