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>
This commit is contained in:
Ulf Hermann
2014-04-11 17:15:10 +02:00
parent 9b2672cb05
commit c8a814c289
3 changed files with 6 additions and 0 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -49,6 +49,8 @@ Canvas {
onPaint: {
if (context === null)
return; // canvas isn't ready
context.reset();
drawBackgroundBars( context, region );
var totalTime = endTime - startTime;