Camera.applyToCanvas() now works with hardware canvases

Change-Id: I7f06b2a74ccc1941d51e12a0417028e094c1b669
This commit is contained in:
Romain Guy
2013-08-13 10:37:25 -07:00
parent b15b446f42
commit 7fbbc3c9c3

View File

@@ -22,6 +22,8 @@ package android.graphics;
* {@link Canvas}.
*/
public class Camera {
private Matrix mMatrix;
/**
* Creates a new camera, with empty transformations.
*/
@@ -147,7 +149,13 @@ public class Camera {
* @param canvas The Canvas to set the transform matrix onto
*/
public void applyToCanvas(Canvas canvas) {
nativeApplyToCanvas(canvas.mNativeCanvas);
if (canvas.isHardwareAccelerated()) {
if (mMatrix == null) mMatrix = new Matrix();
getMatrix(mMatrix);
canvas.concat(mMatrix);
} else {
nativeApplyToCanvas(canvas.mNativeCanvas);
}
}
public native float dotWithNormal(float dx, float dy, float dz);