From c8a814c28961d3e6faa823c656b5ecbce39565fb Mon Sep 17 00:00:00 2001 From: Ulf Hermann <ulf.hermann@digia.com> Date: Fri, 11 Apr 2014 17:15:10 +0200 Subject: [PATCH] QmlProfiler: Always reset the context before drawing on a canvas The context is stateful and there could be any kind of junk left in it. In particular, the W3C spec says that it should be set up with a default clipping path on creation, but it doesn't say what should happen if the canvas is resized. Thus, we can never be sure that the clipping path is sane. Task-number: QTBUG-38297 Change-Id: If04597234e71574573888ce14deac5cf50df4a3f Reviewed-by: Eike Ziller <eike.ziller@digia.com> Reviewed-by: Kai Koehne <kai.koehne@digia.com> --- src/plugins/qmlprofiler/qml/Overview.qml | 2 ++ src/plugins/qmlprofiler/qml/TimeDisplay.qml | 2 ++ src/plugins/qmlprofiler/qml/TimeMarks.qml | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/plugins/qmlprofiler/qml/Overview.qml b/src/plugins/qmlprofiler/qml/Overview.qml index 42df9b03671..284ceb564a2 100644 --- a/src/plugins/qmlprofiler/qml/Overview.qml +++ b/src/plugins/qmlprofiler/qml/Overview.qml @@ -98,6 +98,8 @@ Canvas { onPaint: { if (context === null) return; // canvas isn't ready + + context.reset(); Plotter.qmlProfilerModelProxy = qmlProfilerModelProxy; if (dataReady) { Plotter.plot(canvas, context, region); diff --git a/src/plugins/qmlprofiler/qml/TimeDisplay.qml b/src/plugins/qmlprofiler/qml/TimeDisplay.qml index 81e3b9933b7..38548e7bb9a 100644 --- a/src/plugins/qmlprofiler/qml/TimeDisplay.qml +++ b/src/plugins/qmlprofiler/qml/TimeDisplay.qml @@ -50,6 +50,8 @@ Canvas { onPaint: { if (context === null) return; // canvas isn't ready + + context.reset(); context.fillStyle = "white"; context.fillRect(0, 0, width, height); diff --git a/src/plugins/qmlprofiler/qml/TimeMarks.qml b/src/plugins/qmlprofiler/qml/TimeMarks.qml index 94e8fd058b0..7b19272403f 100644 --- a/src/plugins/qmlprofiler/qml/TimeMarks.qml +++ b/src/plugins/qmlprofiler/qml/TimeMarks.qml @@ -49,6 +49,8 @@ Canvas { onPaint: { if (context === null) return; // canvas isn't ready + + context.reset(); drawBackgroundBars( context, region ); var totalTime = endTime - startTime; -- GitLab