Closed GoogleCodeExporter closed 8 years ago
I am having problem reproducing this issue. When I can scale() and then
strokeShape()
and drawImage() afterward, it seems to be scaling them correctly
What version of FF are you using? Do you have the same issue when running on
another
browser beside IE and FF (say, Chrome)? Have you tried clearing the cache?
Original comment by hao1...@gmail.com
on 9 Mar 2010 at 12:34
I tried making a simpler project with just a Surface, scale() it and then
drawImage(). In that case, FF (3.5), IE (8) and Chrome (4) all work in the same
manner.
However, in my original project, which is a lot more complicated, I am still
able to
reproduce. FF and Chrome doesn't scale and IE does. The call to scale is
performed in
one method and the drawing of lines and images are done in other methods.
The structure of classes and calls are as follows:
Presenter - Presenter class
Page - Class containing the Surface
In Presenter.renderPage:
Page.scale() (which calls Surface.scale())
Page.drawImage() (which calls Surface.drawImage())
Page.drawStrokes() (which uses ShapeBuilder and draws lines)
I have attached some printscreens.
Original comment by degstud...@gmail.com
on 9 Mar 2010 at 7:49
Attachments:
This is odd. However, if you are seeing that same behavior in FF and Chrome, I
am more
inclined to think that it is IE that is bugged.
Since I can't really reproduce it, would you mind checking the followings in
your
project:
1, Are you sure that you don't have any other call to Surface between scale()
and
drawImage()/drawStrokes()? If you do, try comment them out and see if scaling
works.
2, Does it scale if you comment out one of drawImage() or drawStrokes()?
3, Does it scale if you comment out both drawImage() and drawStrokes() and draw
something in your scale() method right after you call the Surface.scale()
method?
4, Does it scale if you change your scaling factor?
Let me know how it goes.
Original comment by hao1...@gmail.com
on 9 Mar 2010 at 2:33
Hello again
1: No, sorry. I didn't mention that I was making a bunch of other operations on
the
Surface. The chain of calls was as follows:
scale()
setWidth()
setHeight()
clear()
drawImage()
save()
DirectShapeRenderer.beginPath()
setLineCap()
setLineJoin()
setStrokeStyle()
setLineWidth()
DirectShapeRenderer.stroke() // With a bunch of moveTo() and drawLineTo()
restore()
2,3: The problem is the call to clear(). If I comment it out, it works.
It is a bit hard to know which is the expected behavior, but I know your nice
library
is a work in progress. Sorry about the unclear background information earlier.
Tell me if you want some additional information.
Original comment by degstud...@gmail.com
on 9 Mar 2010 at 4:10
It seems to me that when the size of the Surface is changed
(setWidth()/setHeight()),
the transformation state of the Surface is also reset (not sure if other things
are
reset as well). I am not sure what is the expected behavior is as I can't find
what the
Context 2D specification says about this, but just to be safe, you should call
scale()
after setWidth() and setHeight(). (I don't think clear() is the issue though...)
Let me know if this fixes the inconsistency.
Original comment by hao1...@gmail.com
on 9 Mar 2010 at 6:39
I have actually solved my task by scaling the images and coordinates instead of
scaling the canvas.
Just thought that for the sake of gwt-g2d being browser independent, it should
behave
so in this case as well.
However, yesterday, when not using clear() at all and calling scale() after
setWidth() and setHeight(), it all worked.
I think it worked as expected when I just commented out the call to clear()
though,
but since testing this requires deploying an old version of my project, I don't
have
the energy to retry right now. :-)
Original comment by degstud...@gmail.com
on 10 Mar 2010 at 7:38
Well, being truly browser independent is a little tough :/
I am closing this issue ticket. If the problem arises again, feel free to
restart the
ticket or start a new one.
Original comment by hao1...@gmail.com
on 10 Mar 2010 at 1:31
Original issue reported on code.google.com by
degstud...@gmail.com
on 8 Mar 2010 at 12:12