Closed Bug 1152728 Opened 9 years ago Closed 9 years ago

Canvas graphics context doesn't update anymore after ctx.scale(..) was called with 0 values on linux.

Categories

(Firefox :: Untriaged, defect)

x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 661452

People

(Reporter: thomas.darimont, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36

Steps to reproduce:

0) On Linux (e.g. ubuntu 14.04) 
1) start firefox
2) Goto https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/scale
3) In the example replace ctx.scale(1, 1); with ctx.scale(0, 1); and again with ctx.scale(1, 1);

This only happens on linux, works fine on osx and windows 7 / 8.
I found 661452 which was specific to windows so I created this new ticket.


Actual results:

Canvas is not updated anymore - no box is painted.


Expected results:

Canavs should update - one should see a box painted.
tested this with the latest ff release version 37.0.1 - still doesn't work under linux.
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
When running a custom linux build from the branch GECKO3701_2015040222_RELBRANCH
I see the following error message in the log when I change ctx.scale(1,1) to ctx.scale(0,1):
  [GFX2-]: DrawTargetCairo context in error state: invalid matrix (not invertible)(5)
For a quit test I changed the CanvasRenderingContext2D::Scale function in CanvasRenderingContext2D.cpp:

from 
	void
	CanvasRenderingContext2D::Scale(double x, double y, ErrorResult& error)
	{
	  TransformWillUpdate();
	  if (!IsTargetValid()) {
		error.Throw(NS_ERROR_FAILURE);
		return;
	  }

	  Matrix newMatrix = mTarget->GetTransform();
	  mTarget->SetTransform(newMatrix.PreScale(x, y));
	}
To

	void
	CanvasRenderingContext2D::Scale(double x, double y, ErrorResult& error)
	{
	  TransformWillUpdate();
	  if (!IsTargetValid()) {
		error.Throw(NS_ERROR_FAILURE);
		return;
	  }
	  
	  if(x == 0.0){
	    x = 0.00001;
	  }
	  if(y == 0.0){
	    y = 0.00001;
	  }

	  Matrix newMatrix = mTarget->GetTransform();
	  mTarget->SetTransform(newMatrix.PreScale(x, y));
	}

It works fine with the 0 guards - but that's of course not a real fix, I guess one has to tweak the logic in "SetTransform" to be more resilient when zeros are passed in - which really seams to be the actual problem.
You need to log in before you can comment on or make changes to this bug.