Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4938201 authored by Romain Guy's avatar Romain Guy
Browse files

Round up ImageView translations to avoid nasty surprises.

Bug #2499812

Change-Id: If90acb7e13aa30e5a0a4e73782d033a5bb4e3264
parent fc2ece4a
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -769,8 +769,8 @@ public class ImageView extends View {
            } else if (ScaleType.CENTER == mScaleType) {
            } else if (ScaleType.CENTER == mScaleType) {
                // Center bitmap in view, no scaling.
                // Center bitmap in view, no scaling.
                mDrawMatrix = mMatrix;
                mDrawMatrix = mMatrix;
                mDrawMatrix.setTranslate((vwidth - dwidth) * 0.5f,
                mDrawMatrix.setTranslate((int) ((vwidth - dwidth) * 0.5f + 0.5f),
                                         (vheight - dheight) * 0.5f);
                                         (int) ((vheight - dheight) * 0.5f + 0.5f));
            } else if (ScaleType.CENTER_CROP == mScaleType) {
            } else if (ScaleType.CENTER_CROP == mScaleType) {
                mDrawMatrix = mMatrix;
                mDrawMatrix = mMatrix;


@@ -786,7 +786,7 @@ public class ImageView extends View {
                }
                }


                mDrawMatrix.setScale(scale, scale);
                mDrawMatrix.setScale(scale, scale);
                mDrawMatrix.postTranslate(dx, dy);
                mDrawMatrix.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
            } else if (ScaleType.CENTER_INSIDE == mScaleType) {
            } else if (ScaleType.CENTER_INSIDE == mScaleType) {
                mDrawMatrix = mMatrix;
                mDrawMatrix = mMatrix;
                float scale;
                float scale;
@@ -800,8 +800,8 @@ public class ImageView extends View {
                            (float) vheight / (float) dheight);
                            (float) vheight / (float) dheight);
                }
                }
                
                
                dx = (vwidth - dwidth * scale) * 0.5f;
                dx = (int) ((vwidth - dwidth * scale) * 0.5f + 0.5f);
                dy = (vheight - dheight * scale) * 0.5f;
                dy = (int) ((vheight - dheight * scale) * 0.5f + 0.5f);


                mDrawMatrix.setScale(scale, scale);
                mDrawMatrix.setScale(scale, scale);
                mDrawMatrix.postTranslate(dx, dy);
                mDrawMatrix.postTranslate(dx, dy);