Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_painter_command.cpp
- Timestamp:
- Nov 3, 2026, 10:53:35 AM (3 weeks ago)
- File:
-
- 1 edited
-
trunk/BNC/qwt/qwt_painter_command.cpp (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_painter_command.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 12 12 //! Construct an invalid command 13 QwtPainterCommand::QwtPainterCommand() :14 d_type( Invalid )13 QwtPainterCommand::QwtPainterCommand() 14 : m_type( Invalid ) 15 15 { 16 16 } 17 17 18 18 //! Copy constructor 19 QwtPainterCommand::QwtPainterCommand( const QPainterPath &path ):20 d_type( Path )21 { 22 d_path = new QPainterPath( path );23 } 24 25 /*! 26 Constructor for Pixmap paint operation 27 28 \param rect Target rectangle 29 \param pixmap Pixmap 30 \param subRect Rectangle inside the pixmap 31 32 \sa QPainter::drawPixmap() 33 */ 34 QwtPainterCommand::QwtPainterCommand( const QRectF &rect,35 const QPixmap &pixmap, const QRectF& subRect ):36 d_type( Pixmap )37 { 38 d_pixmapData = new PixmapData();39 d_pixmapData->rect = rect;40 d_pixmapData->pixmap = pixmap;41 d_pixmapData->subRect = subRect;42 } 43 44 /*! 45 Constructor for Image paint operation 46 47 \param rect Target rectangle 48 \param image Image 49 \param subRect Rectangle inside the image 50 \param flags Conversion flags 51 52 \sa QPainter::drawImage() 53 */ 54 QwtPainterCommand::QwtPainterCommand( const QRectF &rect,55 const QImage &image, const QRectF& subRect,56 Qt::ImageConversionFlags flags ) :57 d_type( Image )58 { 59 d_imageData = new ImageData();60 d_imageData->rect = rect;61 d_imageData->image = image;62 d_imageData->subRect = subRect;63 d_imageData->flags = flags;64 } 65 66 /*! 67 Constructor for State paint operation 68 \param state Paint engine state 69 */ 70 QwtPainterCommand::QwtPainterCommand( const QPaintEngineState &state ):71 d_type( State )72 { 73 d_stateData = new StateData();74 75 d_stateData->flags = state.state();76 77 if ( d_stateData->flags & QPaintEngine::DirtyPen )78 d_stateData->pen = state.pen();79 80 if ( d_stateData->flags & QPaintEngine::DirtyBrush )81 d_stateData->brush = state.brush();82 83 if ( d_stateData->flags & QPaintEngine::DirtyBrushOrigin )84 d_stateData->brushOrigin = state.brushOrigin();85 86 if ( d_stateData->flags & QPaintEngine::DirtyFont )87 d_stateData->font = state.font();88 89 if ( d_stateData->flags & QPaintEngine::DirtyBackground )90 { 91 d_stateData->backgroundMode = state.backgroundMode();92 d_stateData->backgroundBrush = state.backgroundBrush();93 } 94 95 if ( d_stateData->flags & QPaintEngine::DirtyTransform )96 d_stateData->transform = state.transform();97 98 if ( d_stateData->flags & QPaintEngine::DirtyClipEnabled )99 d_stateData->isClipEnabled = state.isClipEnabled();100 101 if ( d_stateData->flags & QPaintEngine::DirtyClipRegion )102 { 103 d_stateData->clipRegion = state.clipRegion();104 d_stateData->clipOperation = state.clipOperation();105 } 106 107 if ( d_stateData->flags & QPaintEngine::DirtyClipPath )108 { 109 d_stateData->clipPath = state.clipPath();110 d_stateData->clipOperation = state.clipOperation();111 } 112 113 if ( d_stateData->flags & QPaintEngine::DirtyHints )114 d_stateData->renderHints = state.renderHints();115 116 if ( d_stateData->flags & QPaintEngine::DirtyCompositionMode )117 d_stateData->compositionMode = state.compositionMode();118 119 if ( d_stateData->flags & QPaintEngine::DirtyOpacity )120 d_stateData->opacity = state.opacity();121 } 122 123 /*! 124 Copy constructor 125 \param other Command to be copied 126 127 */ 128 QwtPainterCommand::QwtPainterCommand(const QwtPainterCommand &other)19 QwtPainterCommand::QwtPainterCommand( const QPainterPath& path ) 20 : m_type( Path ) 21 { 22 m_path = new QPainterPath( path ); 23 } 24 25 /*! 26 Constructor for Pixmap paint operation 27 28 \param rect Target rectangle 29 \param pixmap Pixmap 30 \param subRect Rectangle inside the pixmap 31 32 \sa QPainter::drawPixmap() 33 */ 34 QwtPainterCommand::QwtPainterCommand( const QRectF& rect, 35 const QPixmap& pixmap, const QRectF& subRect ) 36 : m_type( Pixmap ) 37 { 38 m_pixmapData = new PixmapData(); 39 m_pixmapData->rect = rect; 40 m_pixmapData->pixmap = pixmap; 41 m_pixmapData->subRect = subRect; 42 } 43 44 /*! 45 Constructor for Image paint operation 46 47 \param rect Target rectangle 48 \param image Image 49 \param subRect Rectangle inside the image 50 \param flags Conversion flags 51 52 \sa QPainter::drawImage() 53 */ 54 QwtPainterCommand::QwtPainterCommand( const QRectF& rect, 55 const QImage& image, const QRectF& subRect, 56 Qt::ImageConversionFlags flags ) 57 : m_type( Image ) 58 { 59 m_imageData = new ImageData(); 60 m_imageData->rect = rect; 61 m_imageData->image = image; 62 m_imageData->subRect = subRect; 63 m_imageData->flags = flags; 64 } 65 66 /*! 67 Constructor for State paint operation 68 \param state Paint engine state 69 */ 70 QwtPainterCommand::QwtPainterCommand( const QPaintEngineState& state ) 71 : m_type( State ) 72 { 73 m_stateData = new StateData(); 74 75 m_stateData->flags = state.state(); 76 77 if ( m_stateData->flags & QPaintEngine::DirtyPen ) 78 m_stateData->pen = state.pen(); 79 80 if ( m_stateData->flags & QPaintEngine::DirtyBrush ) 81 m_stateData->brush = state.brush(); 82 83 if ( m_stateData->flags & QPaintEngine::DirtyBrushOrigin ) 84 m_stateData->brushOrigin = state.brushOrigin(); 85 86 if ( m_stateData->flags & QPaintEngine::DirtyFont ) 87 m_stateData->font = state.font(); 88 89 if ( m_stateData->flags & QPaintEngine::DirtyBackground ) 90 { 91 m_stateData->backgroundMode = state.backgroundMode(); 92 m_stateData->backgroundBrush = state.backgroundBrush(); 93 } 94 95 if ( m_stateData->flags & QPaintEngine::DirtyTransform ) 96 m_stateData->transform = state.transform(); 97 98 if ( m_stateData->flags & QPaintEngine::DirtyClipEnabled ) 99 m_stateData->isClipEnabled = state.isClipEnabled(); 100 101 if ( m_stateData->flags & QPaintEngine::DirtyClipRegion ) 102 { 103 m_stateData->clipRegion = state.clipRegion(); 104 m_stateData->clipOperation = state.clipOperation(); 105 } 106 107 if ( m_stateData->flags & QPaintEngine::DirtyClipPath ) 108 { 109 m_stateData->clipPath = state.clipPath(); 110 m_stateData->clipOperation = state.clipOperation(); 111 } 112 113 if ( m_stateData->flags & QPaintEngine::DirtyHints ) 114 m_stateData->renderHints = state.renderHints(); 115 116 if ( m_stateData->flags & QPaintEngine::DirtyCompositionMode ) 117 m_stateData->compositionMode = state.compositionMode(); 118 119 if ( m_stateData->flags & QPaintEngine::DirtyOpacity ) 120 m_stateData->opacity = state.opacity(); 121 } 122 123 /*! 124 Copy constructor 125 \param other Command to be copied 126 127 */ 128 QwtPainterCommand::QwtPainterCommand( const QwtPainterCommand& other ) 129 129 { 130 130 copy( other ); … … 138 138 139 139 /*! 140 Assignment operator 141 142 \param other Command to be copied 143 \return Modified command 144 */ 145 QwtPainterCommand &QwtPainterCommand::operator=(const QwtPainterCommand&other)140 Assignment operator 141 142 \param other Command to be copied 143 \return Modified command 144 */ 145 QwtPainterCommand& QwtPainterCommand::operator=( const QwtPainterCommand& other ) 146 146 { 147 147 reset(); … … 151 151 } 152 152 153 void QwtPainterCommand::copy( const QwtPainterCommand &other )154 { 155 d_type = other.d_type;156 157 switch( other. d_type )153 void QwtPainterCommand::copy( const QwtPainterCommand& other ) 154 { 155 m_type = other.m_type; 156 157 switch( other.m_type ) 158 158 { 159 159 case Path: 160 160 { 161 d_path = new QPainterPath( *other.d_path );161 m_path = new QPainterPath( *other.m_path ); 162 162 break; 163 163 } 164 164 case Pixmap: 165 165 { 166 d_pixmapData = new PixmapData( *other.d_pixmapData );166 m_pixmapData = new PixmapData( *other.m_pixmapData ); 167 167 break; 168 168 } 169 169 case Image: 170 170 { 171 d_imageData = new ImageData( *other.d_imageData );171 m_imageData = new ImageData( *other.m_imageData ); 172 172 break; 173 173 } 174 174 case State: 175 175 { 176 d_stateData = new StateData( *other.d_stateData );176 m_stateData = new StateData( *other.m_stateData ); 177 177 break; 178 178 } … … 184 184 void QwtPainterCommand::reset() 185 185 { 186 switch( d_type )186 switch( m_type ) 187 187 { 188 188 case Path: 189 189 { 190 delete d_path;190 delete m_path; 191 191 break; 192 192 } 193 193 case Pixmap: 194 194 { 195 delete d_pixmapData;195 delete m_pixmapData; 196 196 break; 197 197 } 198 198 case Image: 199 199 { 200 delete d_imageData;200 delete m_imageData; 201 201 break; 202 202 } 203 203 case State: 204 204 { 205 delete d_stateData;205 delete m_stateData; 206 206 break; 207 207 } … … 210 210 } 211 211 212 d_type = Invalid;212 m_type = Invalid; 213 213 } 214 214 215 215 //! \return Painter path to be painted 216 QPainterPath *QwtPainterCommand::path()217 { 218 return d_path;216 QPainterPath* QwtPainterCommand::path() 217 { 218 return m_path; 219 219 } 220 220 … … 222 222 QwtPainterCommand::PixmapData* QwtPainterCommand::pixmapData() 223 223 { 224 return d_pixmapData;224 return m_pixmapData; 225 225 } 226 226 … … 228 228 QwtPainterCommand::ImageData* QwtPainterCommand::imageData() 229 229 { 230 return d_imageData;230 return m_imageData; 231 231 } 232 232 … … 234 234 QwtPainterCommand::StateData* QwtPainterCommand::stateData() 235 235 { 236 return d_stateData;237 } 236 return m_stateData; 237 }
Note:
See TracChangeset
for help on using the changeset viewer.
