praeclarum / NGraphics

NGraphics is a cross platform library for rendering vector graphics on .NET. It provides a unified API for both immediate and retained mode graphics using high quality native renderers.
MIT License
710 stars 133 forks source link

Fixed Transform on Android with HW-acceleration #9

Closed AndreasMattsson closed 9 years ago

AndreasMattsson commented 9 years ago

See: https://code.google.com/p/android/issues/detail?id=24517

Matrix-based Translation was broken on Android when Hardware-Acceleration was enabled. Not sure if it applies to all Android versions, but was broken when I tested on 4.4.4.

The end result for the user was that user defined transformed were applied to the origin of the screen, rather than the currently active transform (usually positioned at the View's origin).

getMatrix() in Canvas.java is also deprecated, and should thus not be used: https://github.com/android/platform_frameworks_base/blob/master/graphics/java/android/graphics/Canvas.java#L680

Using Canvas.concat(m) instead appears to fix this issue.

praeclarum commented 9 years ago

Thank you for the research! This is great.