diff options
author | Charles Yin <yinyunqiao@gmail.com> | 2012-03-28 00:06:28 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-30 05:18:32 +0200 |
commit | 200f783745b571725f899f08c34d1155be632523 (patch) | |
tree | 146c481f5ad5bbb900acf9fbf9251a68d633c266 /src/quick/items/context2d/qquickcontext2d_p.h | |
parent | 652fa5b7a44d2d7bb38126b4659e7347caa5d4a8 (diff) |
Fix context2d transform issues
After calling transform related methods, the current path should be transformed with the same method but in reversal mode.
So that during painting, the painter will apply the CTM to this path again, otherwise path will be transformed twice.
Change-Id: I7e12bdff82dabb408f47152ba07b608872d4093f
Task-number: QTBUG-24988
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'src/quick/items/context2d/qquickcontext2d_p.h')
-rw-r--r-- | src/quick/items/context2d/qquickcontext2d_p.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/quick/items/context2d/qquickcontext2d_p.h b/src/quick/items/context2d/qquickcontext2d_p.h index 3230881134..4112d4ebf0 100644 --- a/src/quick/items/context2d/qquickcontext2d_p.h +++ b/src/quick/items/context2d/qquickcontext2d_p.h @@ -116,6 +116,7 @@ public: , fillPatternRepeatY(false) , strokePatternRepeatX(false) , strokePatternRepeatY(false) + , invertibleCTM(true) , fillRule(Qt::WindingFill) , globalAlpha(1.0) , lineWidth(1) @@ -141,6 +142,7 @@ public: bool fillPatternRepeatY:1; bool strokePatternRepeatX:1; bool strokePatternRepeatY:1; + bool invertibleCTM:1; Qt::FillRule fillRule; qreal globalAlpha; qreal lineWidth; @@ -180,7 +182,23 @@ public: void pushState(); void reset(); - // path API + void fill(); + void clip(); + void stroke(); + void fillRect(qreal x, qreal y, qreal w, qreal h); + void strokeRect(qreal x, qreal y, qreal w, qreal h); + void clearRect(qreal x, qreal y, qreal w, qreal h); + void drawText(const QString& text, qreal x, qreal y, bool fill); + + //Transform APIs + void scale(qreal x, qreal y); + void rotate(qreal angle); + void shear(qreal h, qreal v); + void translate(qreal x, qreal y); + void transform(qreal a, qreal b, qreal c, qreal d, qreal e, qreal f); + void setTransform(qreal a, qreal b, qreal c, qreal d, qreal e, qreal f); + + // Path APIs void beginPath(); void closePath(); void moveTo(qreal x, qreal y); @@ -195,7 +213,7 @@ public: void text(const QString& str, qreal x, qreal y); void arc(qreal x, qreal y, qreal radius, qreal startAngle, qreal endAngle, - bool anticlockwise, bool transform=true); + bool anticlockwise); void addArcTo(const QPointF& p1, const QPointF& p2, float radius); bool isPointInPath(qreal x, qreal y) const; |