aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin McPherson <justin.mcpherson@nokia.com>2012-02-09 15:48:40 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-10 07:24:29 +0100
commitdcd47afed9834f3503bb4c412603c20cb433cebb (patch)
tree079119e0009171b559a35101971e3077c1b5e864
parent66f740c5e7ea74e00808d8f1b73570726eeda5a0 (diff)
Use only standard API in examples.
Change-Id: I62a864de35c5b595ffda4397edb16342f54a86ce Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
-rw-r--r--examples/declarative/canvas/bezierCurve/bezierCurve.qml5
-rw-r--r--examples/declarative/canvas/clip/clip.qml3
-rw-r--r--examples/declarative/canvas/quadraticCurveTo/quadraticCurveTo.qml5
-rw-r--r--examples/declarative/canvas/roundedrect/roundedrect.qml5
-rw-r--r--examples/declarative/canvas/smile/smile.qml5
-rw-r--r--examples/declarative/canvas/squircle/squircle.qml5
-rw-r--r--examples/declarative/canvas/stockchart/stock.qml5
-rw-r--r--examples/declarative/canvas/tiger/tiger.qml5
-rw-r--r--examples/declarative/canvas/twitterfriends/twitter.qml3
9 files changed, 25 insertions, 16 deletions
diff --git a/examples/declarative/canvas/bezierCurve/bezierCurve.qml b/examples/declarative/canvas/bezierCurve/bezierCurve.qml
index 4dc9dd1cf5..f57839b0a5 100644
--- a/examples/declarative/canvas/bezierCurve/bezierCurve.qml
+++ b/examples/declarative/canvas/bezierCurve/bezierCurve.qml
@@ -82,7 +82,7 @@ Item {
onPaint: {
var ctx = canvas.getContext('2d');
- ctx.reset();
+ ctx.save();
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.globalAlpha = canvas.alpha;
ctx.strokeStyle = canvas.strokeStyle;
@@ -103,6 +103,7 @@ Item {
ctx.fill();
if (canvas.stroke)
ctx.stroke();
+ ctx.restore();
}
}
@@ -120,4 +121,4 @@ Item {
}
}
}
-} \ No newline at end of file
+}
diff --git a/examples/declarative/canvas/clip/clip.qml b/examples/declarative/canvas/clip/clip.qml
index bf0d8fb75b..d861ff0a46 100644
--- a/examples/declarative/canvas/clip/clip.qml
+++ b/examples/declarative/canvas/clip/clip.qml
@@ -92,7 +92,7 @@ Item {
if (N>100) M=100;
if (N<0.00000000001) M=0.00000000001;
- ctx.reset();
+ ctx.save();
ctx.globalAlpha =canvas.alpha;
ctx.fillStyle = "gray";
ctx.fillRect(0, 0, canvas.width, canvas.height);
@@ -129,6 +129,7 @@ Item {
ctx.clip();
ctx.drawImage(canvas.imagefile, 0, 0);
+ ctx.restore();
}
}
diff --git a/examples/declarative/canvas/quadraticCurveTo/quadraticCurveTo.qml b/examples/declarative/canvas/quadraticCurveTo/quadraticCurveTo.qml
index 047fcfd949..bc3ca0071a 100644
--- a/examples/declarative/canvas/quadraticCurveTo/quadraticCurveTo.qml
+++ b/examples/declarative/canvas/quadraticCurveTo/quadraticCurveTo.qml
@@ -80,7 +80,7 @@ Item {
onPaint: {
var ctx = canvas.getContext('2d');
- ctx.reset();
+ ctx.save();
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.globalAlpha = canvas.alpha;
ctx.strokeStyle = canvas.strokeStyle;
@@ -107,6 +107,7 @@ Item {
ctx.font = "Bold 15px";
ctx.fillText("QML酷毙了", 30, 60);
+ ctx.restore();
}
}
@@ -124,4 +125,4 @@ Item {
}
}
}
-} \ No newline at end of file
+}
diff --git a/examples/declarative/canvas/roundedrect/roundedrect.qml b/examples/declarative/canvas/roundedrect/roundedrect.qml
index 9fb9181fd1..fd86c63a3b 100644
--- a/examples/declarative/canvas/roundedrect/roundedrect.qml
+++ b/examples/declarative/canvas/roundedrect/roundedrect.qml
@@ -79,7 +79,7 @@ Item {
onPaint: {
var ctx = getContext("2d");
- ctx.reset();
+ ctx.save();
ctx.clearRect(0,0,canvas.width, canvas.height);
ctx.strokeStyle = canvas.strokeStyle;
ctx.lineWidth = canvas.lineWidth
@@ -104,6 +104,7 @@ Item {
ctx.fill();
if (canvas.stroke)
ctx.stroke();
+ ctx.restore();
}
}
@@ -121,4 +122,4 @@ Item {
}
}
}
-} \ No newline at end of file
+}
diff --git a/examples/declarative/canvas/smile/smile.qml b/examples/declarative/canvas/smile/smile.qml
index 44909564c9..28a48a6c81 100644
--- a/examples/declarative/canvas/smile/smile.qml
+++ b/examples/declarative/canvas/smile/smile.qml
@@ -82,7 +82,7 @@ Item {
onPaint: {
var ctx = canvas.getContext('2d');
- ctx.reset();
+ ctx.save();
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.globalAlpha = canvas.alpha;
ctx.strokeStyle = canvas.strokeStyle;
@@ -107,6 +107,7 @@ Item {
ctx.fill();
if (canvas.stroke)
ctx.stroke();
+ ctx.restore();
}
}
@@ -124,4 +125,4 @@ Item {
}
}
}
-} \ No newline at end of file
+}
diff --git a/examples/declarative/canvas/squircle/squircle.qml b/examples/declarative/canvas/squircle/squircle.qml
index 9c0860c9f5..2fc65b67b3 100644
--- a/examples/declarative/canvas/squircle/squircle.qml
+++ b/examples/declarative/canvas/squircle/squircle.qml
@@ -96,7 +96,7 @@ Item {
if (N>100) M=100;
if (N<0.00000000001) M=0.00000000001;
- ctx.reset();
+ ctx.save();
ctx.globalAlpha =canvas.alpha;
ctx.fillStyle = "gray";
ctx.fillRect(0, 0, canvas.width, canvas.height);
@@ -134,6 +134,7 @@ Item {
ctx.fillStyle = "yellow";
ctx.font = "Helvetica 16px";
ctx.fillText("|X-" + Math.round(canvas.px) + "|^" + N + " + |Y-"+Math.round(canvas.py)+"|^" + N + " = |" + Math.round(R) + "|^" + N, canvas.px - 125, canvas.py);
+ ctx.restore();
}
}
@@ -151,4 +152,4 @@ Item {
}
}
}
-} \ No newline at end of file
+}
diff --git a/examples/declarative/canvas/stockchart/stock.qml b/examples/declarative/canvas/stockchart/stock.qml
index d02f07bc38..1c95fde2ce 100644
--- a/examples/declarative/canvas/stockchart/stock.qml
+++ b/examples/declarative/canvas/stockchart/stock.qml
@@ -688,7 +688,7 @@ Rectangle {
//console.log("painting... first:" + first + ", last:" + last + " current:" + view.currentIndex);
var ctx = canvas.getContext("2d");
- ctx.reset();
+ ctx.save();
ctx.globalCompositeOperation = "source-over";
ctx.lineWidth = 1;
@@ -720,6 +720,7 @@ Rectangle {
drawPrice(ctx, first, last, Qt.rgba(0.5, 0.5, 0.5, 1),"close", points, highestPrice);
drawVolume(ctx, first, last, Qt.rgba(0.3, 0.5, 0.7, 1),"volume", points, highestValume);
drawKLine(ctx, first, last, points, highestPrice);
+ ctx.restore();
}
}
-} \ No newline at end of file
+}
diff --git a/examples/declarative/canvas/tiger/tiger.qml b/examples/declarative/canvas/tiger/tiger.qml
index 0e3770e6e3..2eb1bb2106 100644
--- a/examples/declarative/canvas/tiger/tiger.qml
+++ b/examples/declarative/canvas/tiger/tiger.qml
@@ -82,7 +82,7 @@ Item {
}
onPaint: {
var ctx = canvas.getContext('2d');
- ctx.reset();
+ ctx.save();
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.globalAlpha = canvas.alpha;
ctx.scale(canvas.scaleX, canvas.scaleY);
@@ -110,6 +110,7 @@ Item {
ctx.stroke();
}
}
+ ctx.restore();
}
}
Rectangle {
@@ -125,4 +126,4 @@ Item {
}
}
}
-} \ No newline at end of file
+}
diff --git a/examples/declarative/canvas/twitterfriends/twitter.qml b/examples/declarative/canvas/twitterfriends/twitter.qml
index 81b29d2fda..9dc2bcc939 100644
--- a/examples/declarative/canvas/twitterfriends/twitter.qml
+++ b/examples/declarative/canvas/twitterfriends/twitter.qml
@@ -112,7 +112,7 @@ Rectangle {
onImageLoaded:requestPaint();
onPaint: {
var ctx = canvas.getContext('2d');
- ctx.reset();
+ ctx.save();
ctx.fillStyle="black";
ctx.fillRect(0, 0, canvas.width, canvas.height);
@@ -135,6 +135,7 @@ Rectangle {
}
layoutChanged = false;
}
+ ctx.restore();
}
}
}