122 typedef void (*qStrokerCubicToHook)(qfixed c1x, qfixed c1y, |
122 typedef void (*qStrokerCubicToHook)(qfixed c1x, qfixed c1y, |
123 qfixed c2x, qfixed c2y, |
123 qfixed c2x, qfixed c2y, |
124 qfixed ex, qfixed ey, |
124 qfixed ex, qfixed ey, |
125 void *data); |
125 void *data); |
126 |
126 |
|
127 // qtransform.cpp |
|
128 Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale); |
|
129 |
127 class Q_GUI_EXPORT QStrokerOps |
130 class Q_GUI_EXPORT QStrokerOps |
128 { |
131 { |
129 public: |
132 public: |
130 struct Element { |
133 struct Element { |
131 QPainterPath::ElementType type; |
134 QPainterPath::ElementType type; |
159 void strokeEllipse(const QRectF &ellipse, void *data, const QTransform &matrix); |
162 void strokeEllipse(const QRectF &ellipse, void *data, const QTransform &matrix); |
160 |
163 |
161 QRectF clipRect() const { return m_clip_rect; } |
164 QRectF clipRect() const { return m_clip_rect; } |
162 void setClipRect(const QRectF &clip) { m_clip_rect = clip; } |
165 void setClipRect(const QRectF &clip) { m_clip_rect = clip; } |
163 |
166 |
|
167 void setCurveThresholdFromTransform(const QTransform &transform) |
|
168 { |
|
169 qreal scale; |
|
170 qt_scaleForTransform(transform, &scale); |
|
171 setCurveThreshold(scale == 0 ? qreal(0.5) : (qreal(0.5) / scale)); |
|
172 } |
|
173 |
|
174 void setCurveThreshold(qfixed threshold) { m_curveThreshold = threshold; } |
|
175 qfixed curveThreshold() const { return m_curveThreshold; } |
|
176 |
164 protected: |
177 protected: |
165 inline void emitMoveTo(qfixed x, qfixed y); |
178 inline void emitMoveTo(qfixed x, qfixed y); |
166 inline void emitLineTo(qfixed x, qfixed y); |
179 inline void emitLineTo(qfixed x, qfixed y); |
167 inline void emitCubicTo(qfixed c1x, qfixed c1y, qfixed c2x, qfixed c2y, qfixed ex, qfixed ey); |
180 inline void emitCubicTo(qfixed c1x, qfixed c1y, qfixed c2x, qfixed c2y, qfixed ex, qfixed ey); |
168 |
181 |
169 virtual void processCurrentSubpath() = 0; |
182 virtual void processCurrentSubpath() = 0; |
170 QDataBuffer<Element> m_elements; |
183 QDataBuffer<Element> m_elements; |
171 |
184 |
172 QRectF m_clip_rect; |
185 QRectF m_clip_rect; |
|
186 qfixed m_curveThreshold; |
173 |
187 |
174 void *m_customData; |
188 void *m_customData; |
175 qStrokerMoveToHook m_moveTo; |
189 qStrokerMoveToHook m_moveTo; |
176 qStrokerLineToHook m_lineTo; |
190 qStrokerLineToHook m_lineTo; |
177 qStrokerCubicToHook m_cubicTo; |
191 qStrokerCubicToHook m_cubicTo; |
206 LineJoinMode joinStyleMode() const { return m_joinStyle; } |
220 LineJoinMode joinStyleMode() const { return m_joinStyle; } |
207 |
221 |
208 void setMiterLimit(qfixed length) { m_miterLimit = length; } |
222 void setMiterLimit(qfixed length) { m_miterLimit = length; } |
209 qfixed miterLimit() const { return m_miterLimit; } |
223 qfixed miterLimit() const { return m_miterLimit; } |
210 |
224 |
211 void setCurveThreshold(qfixed threshold) { m_curveThreshold = threshold; } |
|
212 qfixed curveThreshold() const { return m_curveThreshold; } |
|
213 |
|
214 void joinPoints(qfixed x, qfixed y, const QLineF &nextLine, LineJoinMode join); |
225 void joinPoints(qfixed x, qfixed y, const QLineF &nextLine, LineJoinMode join); |
215 inline void emitMoveTo(qfixed x, qfixed y); |
226 inline void emitMoveTo(qfixed x, qfixed y); |
216 inline void emitLineTo(qfixed x, qfixed y); |
227 inline void emitLineTo(qfixed x, qfixed y); |
217 inline void emitCubicTo(qfixed c1x, qfixed c1y, qfixed c2x, qfixed c2y, qfixed ex, qfixed ey); |
228 inline void emitCubicTo(qfixed c1x, qfixed c1y, qfixed c2x, qfixed c2y, qfixed ex, qfixed ey); |
218 |
229 |