PhotoView icon indicating copy to clipboard operation
PhotoView copied to clipboard

PhotoView.java getDisplayMatrix()

Open zhaoyouqi opened this issue 12 years ago • 5 comments

@Override
public Matrix getDisplayMatrix() {
    return mAttacher.getDrawMatrix();
}

Should be mAttacher.getDisplayMatrix() ?

zhaoyouqi avatar Jun 18 '14 10:06 zhaoyouqi

This is implemented correctly, see: https://github.com/chrisbanes/PhotoView/blob/master/library/src/main/java/uk/co/senab/photoview/PhotoViewAttacher.java#L649

It returns copy of DrawMatrix, not the reference to matrix addressed in PhotoViewAttacher implementation

smarek avatar Jun 18 '14 11:06 smarek

Yes, I think PhotoView#getDisplayMatrix() should returns copy of DrawMatrix, but it returns the reference now.

zhaoyouqi avatar Jun 19 '14 01:06 zhaoyouqi

It is not, https://developer.android.com/reference/android/graphics/Matrix.html#Matrix(android.graphics.Matrix)

smarek avatar Jun 19 '14 08:06 smarek

PhotoView#getDisplayMatrix() returns mAttcher.getDrawMatrix(), which is

public Matrix getDrawMatrix() {
    mDrawMatrix.set(mBaseMatrix);
    mDrawMatrix.postConcat(mSuppMatrix);
    return mDrawMatrix;
}

It returns reference of mDrawMatrix, not copy.

zhaoyouqi avatar Jun 19 '14 09:06 zhaoyouqi

Oh, you're right, typo, corrected within PhotoView, was looking into attacher. Thanks !

smarek avatar Jun 19 '14 09:06 smarek