Skip to content
Snippets Groups Projects
Commit c8a814c2 authored by Ulf Hermann's avatar Ulf Hermann
Browse files

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: default avatarEike Ziller <eike.ziller@digia.com>
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
parent 9b2672cb
No related branches found
No related tags found
No related merge requests found
...@@ -98,6 +98,8 @@ Canvas { ...@@ -98,6 +98,8 @@ Canvas {
onPaint: { onPaint: {
if (context === null) if (context === null)
return; // canvas isn't ready return; // canvas isn't ready
context.reset();
Plotter.qmlProfilerModelProxy = qmlProfilerModelProxy; Plotter.qmlProfilerModelProxy = qmlProfilerModelProxy;
if (dataReady) { if (dataReady) {
Plotter.plot(canvas, context, region); Plotter.plot(canvas, context, region);
......
...@@ -50,6 +50,8 @@ Canvas { ...@@ -50,6 +50,8 @@ Canvas {
onPaint: { onPaint: {
if (context === null) if (context === null)
return; // canvas isn't ready return; // canvas isn't ready
context.reset();
context.fillStyle = "white"; context.fillStyle = "white";
context.fillRect(0, 0, width, height); context.fillRect(0, 0, width, height);
......
...@@ -49,6 +49,8 @@ Canvas { ...@@ -49,6 +49,8 @@ Canvas {
onPaint: { onPaint: {
if (context === null) if (context === null)
return; // canvas isn't ready return; // canvas isn't ready
context.reset();
drawBackgroundBars( context, region ); drawBackgroundBars( context, region );
var totalTime = endTime - startTime; var totalTime = endTime - startTime;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment